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.

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.

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:

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.