optimization - Mysql - store description and short_description or use SUBSTRING(description..) -


i have 2 fields in db, 1 description (text), other short_desc (varchar-200).

when display search results use short_desc, , when clicks on item full description can several thousand characters in length.

neither of these fields have indexes use sphinx searching.

my question is, need short_desc or wasting space when potentially use substring() retrive shortened description?

if there isn't overhead substring, strikes me being more flexible , less wasteful storing short , long desriptions?

no, isn't (i.e. isn't wasting space) in general. in mysql 5 versions there are:

  • mysql never uses indexes functions in conditions (something where substr(x, 1, 2)=y)
  • you can build index on varchar column. i.e. if use short text - you'll can use indexing , index used. on text column building index possible only length.

so if have many select queries - it's idea have short descriptions (besides written above, text fields stored separately, accessing them cause worst issue - disk operations). in case you'll able create , use index avoiding unnecessary disk reading operations.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -