What generic techniques can be applied to optimize SQL queries?

后端 未结 11 1718
礼貌的吻别
礼貌的吻别 2020-12-13 21:28

What techniques can be applied effectively to improve the performance of SQL queries? Are there any general rules that apply?

11条回答
  •  一整个雨季
    2020-12-13 22:32

    • Use primary keys
    • Avoid select *
    • Be as specific as you can when building your conditional statements
    • De-normalisation can often be more efficient
    • Table variables and temporary tables (where available) will often be better than using a large source table
    • Partitioned views
    • Employ indices and constraints

提交回复
热议问题