Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc

后端 未结 30 3620
清歌不尽
清歌不尽 2020-11-21 23:59

I\'ve heard that SELECT * is generally bad practice to use when writing SQL commands because it is more efficient to SELECT columns you specificall

30条回答
  •  孤街浪徒
    2020-11-22 00:43

    One reason it's better practice to spell out exactly which columns you want is because of possible future changes in the table structure.

    If you are reading in data manually using an index based approach to populate a data structure with the results of your query, then in the future when you add/remove a column you will have headaches trying to figure out what went wrong.

    As to what is faster, I'll defer to others for their expertise.

提交回复
热议问题