]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simple fixes to PRAGMA analysis_limit.
authordrh <drh@noemail.net>
Wed, 1 Apr 2020 01:15:16 +0000 (01:15 +0000)
committerdrh <drh@noemail.net>
Wed, 1 Apr 2020 01:15:16 +0000 (01:15 +0000)
FossilOrigin-Name: c20d4fdee21409ebc9c65c9540af8ac48d1f4425499a6674ef9319655c192612

manifest
manifest.uuid
src/analyze.c

index b3aa1c4102282b150755aee56c5bcba178e07934..2f08512a89f5863bb2e00488699abca1e21278c2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\s"PRAGMA\sanalysis_limit=N;"\sto\slimit\sthe\snumber\sof\srows\svisited\sby\nANALYZE\swhen\sN\sis\spositive.\s\sPositive\sN\salso\sdisables\scollecting\sstat4.
-D 2020-03-31T20:57:06.787
+C Simple\sfixes\sto\sPRAGMA\sanalysis_limit.
+D 2020-04-01T01:15:16.332
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -466,7 +466,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
 F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
 F src/alter.c f48a4423c8f198d7f1ae4940f74b606707d05384ac79fb219be8e3323af2a2de
-F src/analyze.c 4b139fa045d17192ba11ee97e6123cc011efbae690ec302f5d1eb53fd52d5ded
+F src/analyze.c 05c99006dfc373a056b05a96539d86482684715b8840c097a6bbc83616c7cb50
 F src/attach.c ff2daea0fe62080192e3f262670e4f61f5a86c1e7bea9cec34e960fe79852aa1
 F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
 F src/backup.c 5e617c087f1c2d6005c2ec694ce80d6e16bc68d906e1b1c556d7c7c2228b636b
@@ -1860,7 +1860,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 c705ce266ad25af71791035590875f0ea9f2c72826b3eda17f065d2bf091de92
-R 89edd918806457e430236657da896c8f
+P a279b151c1623807774daf4975175c62ea252eefb71f9820ced6773769b392c5
+R 29bf358993a7c679676ef1389a2bc787
 U drh
-Z bd47b9db8446ad6b70c7b3bf3d82180a
+Z 5cabae488dd95fb06d50ea84062f02c6
index 788d4b8710412da2a604b125ca0da7e7f3f4d5b2..a36af846371d448a9bef309c13198fc919901499 100644 (file)
@@ -1 +1 @@
-a279b151c1623807774daf4975175c62ea252eefb71f9820ced6773769b392c5
\ No newline at end of file
+c20d4fdee21409ebc9c65c9540af8ac48d1f4425499a6674ef9319655c192612
\ No newline at end of file
index 2cad81817bd84281b5eac7550629bb84651440ab..baca0efad03ebec40b97c18b84c37790fc7d5714 100644 (file)
@@ -444,10 +444,6 @@ static void statInit(
   p->nEst = sqlite3_value_int64(argv[2]);
   p->nRow = 0;
   p->nLimit = sqlite3_value_int64(argv[3]);
-#ifdef SQLITE_ENABLE_STAT4
-  /* Disable STAT4 statistics gathering if there is a analysis_limit set */
-  if( p->nLimit>0 ) p->mxSample = 0;
-#endif
   p->nCol = nCol;
   p->nKeyCol = nKeyCol;
   p->nSkipAhead = 0;
@@ -455,7 +451,7 @@ static void statInit(
   p->current.anEq = &p->current.anDLt[nColUp];
 
 #ifdef SQLITE_ENABLE_STAT4
-  p->mxSample = mxSample;
+  p->mxSample = p->nLimit==0 ? mxSample : 0;
   if( mxSample ){
     u8 *pSpace;                     /* Allocated space not yet assigned */
     int i;                          /* Used to iterate through p->aSample[] */
@@ -489,7 +485,7 @@ static void statInit(
   sqlite3_result_blob(context, p, sizeof(*p), statAccumDestructor);
 }
 static const FuncDef statInitFuncdef = {
-  2+IsStat4,       /* nArg */
+  4,               /* nArg */
   SQLITE_UTF8,     /* funcFlags */
   0,               /* pUserData */
   0,               /* pNext */
@@ -1256,7 +1252,7 @@ static void analyzeOneTable(
 
     /* Add the entries to the stat4 table. */
 #ifdef SQLITE_ENABLE_STAT4
-    if( OptimizationEnabled(db, SQLITE_Stat4) ){
+    if( OptimizationEnabled(db, SQLITE_Stat4) && db->nAnalysisLimit==0 ){
       int regEq = regStat1;
       int regLt = regStat1+1;
       int regDLt = regStat1+2;