]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the name of the analyze_as_needed pragma to "optimize". Enhance the
authordrh <drh@noemail.net>
Wed, 22 Feb 2017 20:24:10 +0000 (20:24 +0000)
committerdrh <drh@noemail.net>
Wed, 22 Feb 2017 20:24:10 +0000 (20:24 +0000)
comment (which will become documentation, assuming these changes land on trunk)
to explain that the optimize pragma is likely to be enhanced in various ways
in future releases and that applications should not depend upon the current
behavior.

FossilOrigin-Name: 9fced545a6f80c55d6dc4a6106cb2d3569566b3e

manifest
manifest.uuid
src/pragma.c
src/pragma.h
tool/mkpragmatab.tcl

index 392b3afc2963407b69cd9c8a94ec9c7e3fbc8e89..508790c7bd6e509bd7586b50df5923b8a86243db 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\sintegrity_check\sand\sother\simprovements\sfrom\strunk.
-D 2017-02-22T19:49:54.795
+C Change\sthe\sname\sof\sthe\sanalyze_as_needed\spragma\sto\s"optimize".\s\sEnhance\sthe\ncomment\s(which\swill\sbecome\sdocumentation,\sassuming\sthese\schanges\sland\son\strunk)\nto\sexplain\sthat\sthe\soptimize\spragma\sis\slikely\sto\sbe\senhanced\sin\svarious\sways\nin\sfuture\sreleases\sand\sthat\sapplications\sshould\snot\sdepend\supon\sthe\scurrent\nbehavior.
+D 2017-02-22T20:24:10.705
 F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc a89ea37ab5928026001569f056973b9059492fe2
@@ -388,8 +388,8 @@ F src/parse.y af8830094f4aecb91cb69721f3601ad10c36abc4
 F src/pcache.c 62835bed959e2914edd26afadfecce29ece0e870
 F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
 F src/pcache1.c e3967219b2a92b9edcb9324a4ba75009090d3953
-F src/pragma.c 97742aae32e645926f6f8fc426169fb5ef97c268
-F src/pragma.h 065e184494f12e94111da1ab6984faa7b6142e68
+F src/pragma.c 46202f2f5ee6957ff5cba581ee3c36507685def0
+F src/pragma.h d97dd835c7f4dfb6857487707313385d44fa76c0
 F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
 F src/printf.c 67427bbee66d891fc6f6f5aada857e9cdb368c1c
 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
@@ -1496,7 +1496,7 @@ F tool/mkmsvcmin.tcl 95b37e202cbed873aa8ffdbb493b9db45927be2b
 F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
 F tool/mkopcodeh.tcl a01d2c1d8a6205b03fc635adf3735b4c523befd3
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
-F tool/mkpragmatab.tcl 6fd5ecb4a8debee39e3bb4e63f0634f69edfb861
+F tool/mkpragmatab.tcl 9b499f7301fadeddeae52b95f962ef7e5a718f50
 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
 F tool/mksqlite3c-noext.tcl fef88397668ae83166735c41af99d79f56afaabb
 F tool/mksqlite3c.tcl 06b2e6a0f21cc0a5d70fbbd136b3e0a96470645e
@@ -1558,7 +1558,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P ff213f2ef5bf96754a2264685d25546d8b5ccf0a d6afd98de3ee8b714dfd6477ead955096f623972
-R c12096fa1c0a2878a437d029e47aff9d
+P fe073905081b421405ca425ca03c5b8b0ff5f2c8
+R b1ce2ff126387ffc06c8537ddbfa9731
 U drh
-Z 3c7beae38049bf1fe67e75122f4d0189
+Z 5165d34a54df32aa272e95c6a5e5953c
index 54b7ffb813769930676a9174a9f76aa8fd2d27be..8e0845a1c46e7220ecb1f6bd0dcf067d0b987382 100644 (file)
@@ -1 +1 @@
-fe073905081b421405ca425ca03c5b8b0ff5f2c8
\ No newline at end of file
+9fced545a6f80c55d6dc4a6106cb2d3569566b3e
\ No newline at end of file
index 7ff76d02d16054f63e3f3a3d81749e144cb9c374..714fb413b66f67594f42d44967462dc1e5644c4a 100644 (file)
@@ -1863,16 +1863,29 @@ void sqlite3Pragma(
   }
 
   /*
-  **  PRAGMA analyze_as_needed
-  **  PRAGMA schema.analyze_as_needed
+  **  PRAGMA optimize
+  **  PRAGMA schema.optimize
   **
-  ** This pragma runs ANALYZE on any tables which would have benefitted
-  ** from having recent statistics at some point since the start of the
-  ** current connection.  Only tables in "schema" are analyzed in the 
+  ** Attempt to optimize the database.  All schemas are optimized in the first
+  ** form, and only the specified schema is optimized in the second form.
+  **
+  ** The details of optimizations performed by this pragma does are expected
+  ** to change and improve over time.  Applications should anticipate that
+  ** this pragma will perform new optimizations in future releases.
+  **
+  ** Argments to this pragma are currently ignored, but future enhancements
+  ** might make use of arguments to control which optimizations are allowed
+  ** or to suggest limits on how much CPU time and I/O should be expended
+  ** in the optimization effort.
+  **
+  ** The current implementation runs ANALYZE on any tables which might have 
+  ** benefitted from having recent statistics at some point since the start
+  ** of the current connection.  Only tables in "schema" are analyzed in the 
   ** second form.  In the first form, all tables except TEMP tables are
   ** checked.
   **
-  ** A table is analyzed only if both of the following are true:
+  ** In the current implementation, a table is analyzed only if both of
+  ** the following are true:
   **
   ** (1) The query planner used sqlite_stat1-style statistics for one or
   **     more indexes of the table at some point during the lifetime of
@@ -1881,8 +1894,11 @@ void sqlite3Pragma(
   ** (2) One or more indexes of the table are currently unanalyzed OR
   **     the number of rows in the table has increased by 25 times or more
   **     since the last time ANALYZE was run.
+  **
+  ** The rules for when tables are analyzed are likely to change in
+  ** future releases.
   */
-  case PragTyp_ANALYZE_AS_NEEDED: {
+  case PragTyp_OPTIMIZE: {
     int iDbLast;           /* Loop termination point for the schema loop */
     int iTabCur;           /* Cursor for a table whose size needs checking */
     HashElem *k;           /* Loop over tables of a schema */
index ba107ec07eb74099cdfb3fbbe1564071f8f526bb..363975df55a5421eb634a886a0b420143fa6a066 100644 (file)
@@ -5,32 +5,32 @@
 */
 
 /* The various pragma types */
-#define PragTyp_ANALYZE_AS_NEEDED              0
-#define PragTyp_HEADER_VALUE                   1
-#define PragTyp_AUTO_VACUUM                    2
-#define PragTyp_FLAG                           3
-#define PragTyp_BUSY_TIMEOUT                   4
-#define PragTyp_CACHE_SIZE                     5
-#define PragTyp_CACHE_SPILL                    6
-#define PragTyp_CASE_SENSITIVE_LIKE            7
-#define PragTyp_COLLATION_LIST                 8
-#define PragTyp_COMPILE_OPTIONS                9
-#define PragTyp_DATA_STORE_DIRECTORY          10
-#define PragTyp_DATABASE_LIST                 11
-#define PragTyp_DEFAULT_CACHE_SIZE            12
-#define PragTyp_ENCODING                      13
-#define PragTyp_FOREIGN_KEY_CHECK             14
-#define PragTyp_FOREIGN_KEY_LIST              15
-#define PragTyp_INCREMENTAL_VACUUM            16
-#define PragTyp_INDEX_INFO                    17
-#define PragTyp_INDEX_LIST                    18
-#define PragTyp_INTEGRITY_CHECK               19
-#define PragTyp_JOURNAL_MODE                  20
-#define PragTyp_JOURNAL_SIZE_LIMIT            21
-#define PragTyp_LOCK_PROXY_FILE               22
-#define PragTyp_LOCKING_MODE                  23
-#define PragTyp_PAGE_COUNT                    24
-#define PragTyp_MMAP_SIZE                     25
+#define PragTyp_HEADER_VALUE                   0
+#define PragTyp_AUTO_VACUUM                    1
+#define PragTyp_FLAG                           2
+#define PragTyp_BUSY_TIMEOUT                   3
+#define PragTyp_CACHE_SIZE                     4
+#define PragTyp_CACHE_SPILL                    5
+#define PragTyp_CASE_SENSITIVE_LIKE            6
+#define PragTyp_COLLATION_LIST                 7
+#define PragTyp_COMPILE_OPTIONS                8
+#define PragTyp_DATA_STORE_DIRECTORY           9
+#define PragTyp_DATABASE_LIST                 10
+#define PragTyp_DEFAULT_CACHE_SIZE            11
+#define PragTyp_ENCODING                      12
+#define PragTyp_FOREIGN_KEY_CHECK             13
+#define PragTyp_FOREIGN_KEY_LIST              14
+#define PragTyp_INCREMENTAL_VACUUM            15
+#define PragTyp_INDEX_INFO                    16
+#define PragTyp_INDEX_LIST                    17
+#define PragTyp_INTEGRITY_CHECK               18
+#define PragTyp_JOURNAL_MODE                  19
+#define PragTyp_JOURNAL_SIZE_LIMIT            20
+#define PragTyp_LOCK_PROXY_FILE               21
+#define PragTyp_LOCKING_MODE                  22
+#define PragTyp_PAGE_COUNT                    23
+#define PragTyp_MMAP_SIZE                     24
+#define PragTyp_OPTIMIZE                      25
 #define PragTyp_PAGE_SIZE                     26
 #define PragTyp_SECURE_DELETE                 27
 #define PragTyp_SHRINK_MEMORY                 28
@@ -133,11 +133,6 @@ static const PragmaName aPragmaName[] = {
   /* ColNames:  */ 0, 0,
   /* iArg:      */ 0 },
 #endif
- {/* zName:     */ "analyze_as_needed",
-  /* ePragTyp:  */ PragTyp_ANALYZE_AS_NEEDED,
-  /* ePragFlg:  */ PragFlg_NoColumns,
-  /* ColNames:  */ 0, 0,
-  /* iArg:      */ 0 },
 #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
  {/* zName:     */ "application_id",
   /* ePragTyp:  */ PragTyp_HEADER_VALUE,
@@ -419,6 +414,13 @@ static const PragmaName aPragmaName[] = {
   /* ePragFlg:  */ 0,
   /* ColNames:  */ 0, 0,
   /* iArg:      */ 0 },
+#endif
+ {/* zName:     */ "optimize",
+  /* ePragTyp:  */ PragTyp_OPTIMIZE,
+  /* ePragFlg:  */ PragFlg_NoColumns,
+  /* ColNames:  */ 0, 0,
+  /* iArg:      */ 0 },
+#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
  {/* zName:     */ "page_count",
   /* ePragTyp:  */ PragTyp_PAGE_COUNT,
   /* ePragFlg:  */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
index 2201ea130646aa7137a82765768b0ea0617cd7b4..f0ba49b5452dac05516c6e132fe47e57742698a4 100644 (file)
@@ -362,7 +362,7 @@ set pragma_def {
   NAME: threads
   FLAG: Result0
 
-  NAME: analyze_as_needed
+  NAME: optimize
   FLAG: NoColumns
 }