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

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

    Performance wise, SELECT with specific columns can be faster (no need to read in all the data). If your query really does use ALL the columns, SELECT with explicit parameters is still preferred. Any speed difference will be basically unnoticeable and near constant-time. One day your schema will change, and this is good insurance to prevent problems due to this.

提交回复
热议问题