SQLite分析SQL As Understood By SQLite

Original: http://www.sqlite.org/lang_explain.html

 
        Keyword EXPLAIN "or the statement (by the phrase)" EXPLAIN QUERY PLAN " can be placed before the SQL statement. (About this sentence provides original, easy to watch later An SQL statement can be preceded by the keyword" EXPLAIN "). If no keywords or EXPLAIN statements, SQL statements, and usually return to query information is no different (the Either modification of statement Causes at The SQL AS qeruy to behave and to return informationabout How Would have have operated at The SQL of statement IF HAD been at The EXPLAIN keyword orphrase Omitted.)
 
        " EXPLAIN "and" EXPLAIN QUERY PLAN "output is mainly used to find fault analysis and data exchange. for more information about the content of the output current with the different versions of SQLite, subject to change. the application should not use this statement because execution the result is uncertain, and only a small amount of information recorded (since their exact behavior variable and only partially documented).
Note: sqlite3.exe use to teach Cheng Yiwen, a brief introduction to the basic use, and by creating an index, it How to analyze the efficiency of SQL execution.
 
        When the EXPLAIN keyword appears before the SQL statement illustrates, the process of the query will return a set of instructions executed by a virtual machine, output to the console. When using EXPLAIN QUERY TEXT and will return more advanced information, in fact, return more detailed information. the information is actually returned mainly to scan the entire table, or use the index to query, of course, the premise is the need for indexing



EXPLAIN to be executed at runtime, not at the time of preparation
        EXPLAIN and EXPLAIN QUERY PLAN prefix affect the operation of a pre-compiled statement sqlite3_step call the function. It generates a new precompiled statement by calling sqlite3_prepare process is not affected by the EXPLAIN. The exception is that there are some special operation code prohibits the use EXPLAIN QUERY PLAN keywords, in the final analysis is a performance optimization results.
        Sqlite3_prepare process means that calling the function executed, will not be affected by the EXPLAIN.
1) Some compilers statement on the sqlite3_prepare work, rather than sqlite3_step. These statements are not compiled EXPLAIN affected.
2) to specify whether or EXPLAIN QUERY PLAN EXPLAIN keyword, authorize callback SQL statement (authorizer callback) function will be executed

Guess you like

Origin blog.51cto.com/fengyuzaitu/2429768
Recommended