SQL常备知识

1、SQL逻辑查询处理中的各个阶级顺序
      (8)SELECT (9) DISTINCT (11) <tOP_Specification> <select list>
      (1)FROM <Left tables>
      (3)<Join type>Join<Right_table>
      (2) on <join conditions>
      (4)WHERE <where conditions>
      (5)GROUP BY <Group list>
      (6)WITH {CUBE| Rollup}
      (7)Having <Having conditions>
      (10)ORDER BY
2、清除缓存
      dbcc dropcleanbuffers --清空所以数据
      dbcc freeproccache ---要从缓存中清除执行计划
      dbcc flushprocindb(<db_id>)--清空数据库的执行计划
3、STATISTICS IO--返回IO信息
      STATISTICS TIME--返回分析。编译查询的时间以及执行查询时间
      SET SHOWPLAN_TEXT ON--文本格式执行计划      

原文地址:https://www.cnblogs.com/wasp520/p/1581015.html