在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ 數(shù)據(jù)庫/ SQLite Explain(解釋)
SQLite Having 子句
SQLite 運算符
SQLite 注入
SQLite Delete 語句
SQLite – Python
SQLite 數(shù)據(jù)類型
SQLite 簡介
SQLite 創(chuàng)建數(shù)據(jù)庫
SQLite Vacuum
SQLite Group By
SQLite 日期 & 時間
SQLite AND/OR 運算符
SQLite 刪除表
SQLite Distinct
SQLite Alter 命令
SQLite PRAGMA
SQLite 約束
SQLite 創(chuàng)建表
SQLite Like 子句
SQLite Limit 子句
SQLite Autoincrement
SQLite 子查詢
SQLite – C/C++
SQLite – PHP
SQLite 命令
SQLite Order By
SQLite Select 語句
SQLite Unions 子句
SQLite – Perl
SQLite – Java
SQLite 別名
SQLite 常用函數(shù)
SQLite Explain(解釋)
SQLite NULL 值
SQLite Glob 子句
SQLite 表達(dá)式
SQLite 視圖
SQLite Where 子句
SQLite Truncate Table
SQLite 索引
SQLite Insert 語句
SQLite 安裝
SQLite Indexed By
SQLite 分離數(shù)據(jù)庫
SQLite 觸發(fā)器
SQLite 語法
SQLite Joins
SQLite Update 語句
SQLite 附加數(shù)據(jù)庫
SQLite 事務(wù)

SQLite Explain(解釋)

在 SQLite 語句之前,可以使用 "EXPLAIN" 關(guān)鍵字或 "EXPLAIN QUERY PLAN" 短語,用于描述表的細(xì)節(jié)。

如果省略了 EXPLAIN 關(guān)鍵字或短語,任何的修改都會引起 SQLite 語句的查詢行為,并返回有關(guān) SQLite 語句如何操作的信息。

  • 來自 EXPLAIN 和 EXPLAIN QUERY PLAN 的輸出只用于交互式分析和排除故障。
  • 輸出格式的細(xì)節(jié)可能會隨著 SQLite 版本的不同而有所變化。
  • 應(yīng)用程序不應(yīng)該使用 EXPLAIN 或 EXPLAIN QUERY PLAN,因為其確切的行為是可變的且只有部分會被記錄。

語法

EXPLAIN 的語法如下:

    EXPLAIN [SQLite Query]

EXPLAIN QUERY PLAN 的語法如下:

    EXPLAIN  QUERY PLAN [SQLite Query]

實例

假設(shè) COMPANY 表有以下記錄:

    ID          NAME        AGE         ADDRESS     SALARY
    ----------  ----------  ----------  ----------  ----------
    1           Paul        32          California  20000.0
    2           Allen       25          Texas       15000.0
    3           Teddy       23          Norway      20000.0
    4           Mark        25          Rich-Mond   65000.0
    5           David       27          Texas       85000.0
    6           Kim         22          South-Hall  45000.0
    7           James       24          Houston     10000.0

現(xiàn)在,讓我們檢查 SELECT 語句中的 Explain 使用:

    sqlite> EXPLAIN SELECT *  FROM COMPANY  WHERE Salary >= 20000;

這將產(chǎn)生以下結(jié)果:

    addr        opcode      p1          p2          p3
    ----------  ----------  ----------  ----------  ----------
    0           Goto        0           19
    1           Integer     0           0
    2           OpenRead    0           8
    3           SetNumColu  0           5
    4           Rewind      0           17
    5           Column      0           4
    6           RealAffini  0           0
    7           Integer     20000       0
    8           Lt          357         16          collseq(BI
    9           Rowid       0           0
    10          Column      0           1
    11          Column      0           2
    12          Column      0           3
    13          Column      0           4
    14          RealAffini  0           0
    15          Callback    5           0
    16          Next        0           5
    17          Close       0           0
    18          Halt        0           0
    19          Transactio  0           0
    20          VerifyCook  0           38
    21          Goto        0           1
    22          Noop        0           0

現(xiàn)在,讓我們檢查 SELECT 語句中的 Explain Query Plan 使用:

    SQLite> EXPLAIN QUERY PLAN SELECT * FROM COMPANY WHERE Salary >= 20000;

    order       from        detail
    ----------  ----------  -------------
    0           0           TABLE COMPANY
上一篇:SQLite Like 子句下一篇:SQLite Vacuum