Jump to content

a long column or several short columns in mysql?


etrader

Recommended Posts

I want to assign some values for each entry. Which plan is better to assist better mysql performance

 

Plan A: Storing as "value1-value2-value3" in a column created by varchar(50); then I can process the values by explode()

or

Plan B: Storing values individually in three columns created by int(11)

 

I want to know several small int() is better OR it is better to keep the number of columns lesser by having a larger column of varchar(), as I need to add "-" separator.

Link to comment
Share on other sites

that all depends on usage of field in ur case.

if u are planing to use later 'IN' inside ur query on a field u want to store implode(',',$var) perhaps this will be more relevant for you, otherwise if u gonna preform searches/filters on this data it is better to separate to few fields.

Link to comment
Share on other sites

No, I do not want to perform search, as they are numbers to define some parameters (even it can be only 0,1). And I never call them separetly, when I get them from mysql database, I need all of them.

 

So you think it is better to store them in a single column to reduce the number of columns?  :shrug:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.