select * vs select column

前端 未结 12 1041
后悔当初
后悔当初 2020-11-22 05:42

If I just need 2/3 columns and I query SELECT * instead of providing those columns in select query, is there any performance degradation regarding more/less I/O

12条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 06:18

    Reference taken from this article:

    Without SELECT *: When you are using ” SELECT * ” at that time you are selecting more columns from the database and some of this column might not be used by your application. This will create extra cost and load on database system and more data travel across the network.

    With SELECT *: If you have special requirements and created dynamic environment when add or delete column automatically handle by application code. In this special case you don’t require to change application and database code and this will automatically affect on production environment. In this case you can use “SELECT *”.

提交回复
热议问题