This is faster: "SELECT * FROM table" or "SELECT x, y, q FROM table" (from a table with 4 fields)

I am wondering what is the fastest (or easiest to process the database)

Say the db table has 4 fields: x, y, z, q

I need only 3: x, y, q

Which method is faster or easier for the database to work (using PHP). "SELECT * FROM table" or "SELECT x, y, q FROM table"?

Will there be the same application if there were 5 or more fields in the table, for now I can only select 3?

+5
source share
3 answers

SELECT x,y,z FROM table faster because MySQL does not have to look for which columns are in your table before executing the query.

+10
source

* , .

, , .

+3

SELECT x,y,q FROM tablealways faster than select *, as you do not read all the fields, but references SELECT x,y,q,z FROM tableand select *will have the same effect performance.

+3
source

All Articles