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

后端 未结 30 3442
清歌不尽
清歌不尽 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:34

    If you need every column then just use SELECT * but remember that the order could potentially change so when you are consuming the results access them by name and not by index.

    I would ignore comments about how * needs to go get the list - chances are parsing and validating named columns is equal to the processing time if not more. Don't prematurely optimize ;-)

提交回复
热议问题