hobbywebsite
hobbywebsite

Reputation: 143

php explode vs columns

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

Answers (3)

xkeshav
xkeshav

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

Jezen Thomas
Jezen Thomas

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

Petah
Petah

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

Related Questions