What is the reason not to use select *?

后端 未结 20 2784
独厮守ぢ
独厮守ぢ 2020-11-21 07:14

I\'ve seen a number of people claim that you should specifically name each column you want in your select query.

Assuming I\'m going to use all of the columns anyway

20条回答
  •  一整个雨季
    2020-11-21 07:51

    Selecting only the columns you need keeps the dataset in memory smaller and therefor keeps your application faster.

    Also, a lot of tools (e.g. stored procedures) cache query execution plans too. If you later add or remove a column (particularly easy if you're selecting off a view), the tool will often error when it doesn't get back results that it expects.

提交回复
热议问题