I'm wondering, what is fastest (or lightest for the database to handle)
Let's say, the db table has 4 fields: x,y,z,q
I only need 3: x,y,q
What way is fastest/easiest for the database to perform (using PHP).. "SELECT * FROM table" or "SELECT x,y,q FROM table"?
Would the same apply if the table had 5 or more fields while I still only needed to select 3?
SELECT x,y,z FROM table
is faster because MySQL won't have to look up what columns are in your table before executing the query.
In most databases the * is slower than specifying the fields.
It's also a good programming practice to put all the columns, even though they are many.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With