Reputation: 143
Ok this might be a hardcore question? I was just wondering if there was a "break-even" point for explode vs columns in a database.
For example:
Explode 100 times or get data from 100 columns which is "better/faster"?
Real world example would be a single col for last_name,first_name vs 2 cols. (I guess one would also have to think about if this data needs to be changed.)
My understanding is that explode uses the client side resources whereas pulling data from the database uses the server side.
Just wondering if there is a "rule of thumb"?
Upvotes: 0
Views: 279
Reputation: 54016
remember the thumb rule of Normalization :
Never put comma separated value ( multiple values) in a single column.
and for the sake of performance based on client/server.
PHP also use client side resources
Upvotes: 0
Reputation: 13800
Scientifically, one will be faster than the other. Realistically though, I'm not sure there is any difference. Bear in mind also, that PHP is a server-side technology, so none of what you're asking is done client-side.
Upvotes: 0
Reputation: 46040
You should always split your data into separate columns where applicable.
Not because of performance, but because of the rules of database normalization.
http://en.wikipedia.org/wiki/Database_normalization
Performance wise, its subjective. It depends on what you are doing with your data, and a lot of other factors that we couldn't guess with the limited information you have given us. But my hunch is that columns would be faster.
Upvotes: 4