From 3410e550dcc82f2bcceac2cf01174621ab6e9c2a Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 3 Mar 2023 21:17:12 +0000 Subject: [PATCH] Make the SQLITE_DBCONFIG_STMT_SCANSTATUS option on by default. FossilOrigin-Name: 5a09191186bc03b374e0c0d029e1a15208c6b845bc2f5f5f9f6a8a882809d9f3 --- ext/rtree/rtree6.test | 2 ++ manifest | 24 ++++++++++++------------ manifest.uuid | 2 +- src/main.c | 3 +++ src/shell.c.in | 1 + src/sqlite.h.in | 2 +- test/fts3join.test | 1 + test/scanstatus.test | 17 ++++++++++------- 8 files changed, 31 insertions(+), 21 deletions(-) diff --git a/ext/rtree/rtree6.test b/ext/rtree/rtree6.test index b6dfe992a6..1cbb2c6e87 100644 --- a/ext/rtree/rtree6.test +++ b/ext/rtree/rtree6.test @@ -104,6 +104,7 @@ do_eqp_test rtree6.2.4.1 { } { QUERY PLAN |--SCAN t1 VIRTUAL TABLE INDEX 2:C0E1 + |--BLOOM FILTER ON t2 (v=?) `--SEARCH t2 USING AUTOMATIC COVERING INDEX (v=?) } do_eqp_test rtree6.2.4.2 { @@ -111,6 +112,7 @@ do_eqp_test rtree6.2.4.2 { } { QUERY PLAN |--SCAN t1 VIRTUAL TABLE INDEX 2:C0E1 + |--BLOOM FILTER ON t2 (v=?) `--SEARCH t2 USING AUTOMATIC PARTIAL COVERING INDEX (v=?) } diff --git a/manifest b/manifest index bad839105c..9ee00ad069 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\svdbe-coverage\smacro\sadded\sby\s[f418bdd627e84e7d]. -D 2023-03-03T19:56:19.090 +C Make\sthe\sSQLITE_DBCONFIG_STMT_SCANSTATUS\soption\son\sby\sdefault. +D 2023-03-03T21:17:12.539 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -400,7 +400,7 @@ F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e130 F ext/rtree/rtree3.test 272594f88c344e973864008bbe4c71fd3a41a264c097d568593ee7886d83d409 F ext/rtree/rtree4.test 304de65d484540111b896827e4261815e5dca4ce28eeecd58be648cd73452c4b F ext/rtree/rtree5.test 49c9041d713d54560b315c2c7ef7207ee287eba1b20f8266968a06f2e55d3142 -F ext/rtree/rtree6.test 9ce3691c1aac43070a9f194f0ebf54372db346c5a82241fd11b525ed53ce9f3f +F ext/rtree/rtree6.test 2f5ffc69670395c1a84fad7924e2d49e82a25460c5293fb1e54e1aa906f04945 F ext/rtree/rtree7.test c8fb2e555b128dd0f0bdb520c61380014f497f8a23c40f2e820acc9f9e4fdce5 F ext/rtree/rtree8.test 2d99006a1386663978c9e1df167554671e4f711c419175b39f332719deb1ce0e F ext/rtree/rtree9.test fd3c9384ef8aabbc127b3878764070398f136eebc551cd20484b570f2cc1956a @@ -586,7 +586,7 @@ F src/insert.c 7940fce7d4aa855606432d82d20694e17c18a03956f5f5776f2404e2df7c18a8 F src/json.c c85ed6fce06f43d414b0d7fff64749d43a0dbd1067123ee407bd3a0752454161 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c b04eb648cedc45efe4298e1ef439ac4f0096ae27b5f01accb0a1f49d57789128 -F src/main.c e5f5323a33c51403bbe83ccb9f3e40aa94f95fd65dbeb5992a12435e0f6c22f9 +F src/main.c 50b4f14242c2949fd1f3e83aacf088ed2f1eb16d8c1369ee0156957ea070916e F src/malloc.c 47b82c5daad557d9b963e3873e99c22570fb470719082c6658bf64e3012f7d23 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de @@ -624,8 +624,8 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 4233c3030341bf1a21cea90890e6b3d3531721acc62ede147e899d36ffad8238 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/select.c f6224c55bc0de16b8559e80015a26f1eced7809a4a0e774efabacca98b3150f6 -F src/shell.c.in fde8844845550e7f9332132e2af57e68fe1c37090986483445c5204ee9599e59 -F src/sqlite.h.in dd0f802db5ce8b2e384cf1e04debe175b38ab5ba2c8e09f00672e8b79a1bb134 +F src/shell.c.in 10088fb7a12d9e9b2453b1df32f80f68c6618f998044f82619d769e6f32f72ca +F src/sqlite.h.in 36882eee65db22e2fdb68782e7fb9b9ea1dd0488d8e2918b3567915ddb3c9611 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4 F src/sqliteInt.h 34034353de20c29e04295c3486bbf22b2a47842c887f65f7176530b4c35fdd17 @@ -1083,7 +1083,7 @@ F test/fts3fault.test f4e1342acfe6d216a001490e8cd52afac1f9ffe4a11bbcdcb296129a45 F test/fts3fault2.test 7b2741e5095367238380b0fcdb837f36c24484c7a5f353659b387df63cf039ec F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641 F test/fts3fuzz001.test e3c7b0ce9b04cc02281dcc96812a277f02df03cd7dc082055d87e11eb18aaf56 -F test/fts3join.test ee25def5e763ea8879c19e74f862d5191410ccc7259338887a3685e97f512662 +F test/fts3join.test 1a4d786539b2b79a41c28ef2ac22cacd92a8ee830249b68a7dee4a020848e3bb F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6 F test/fts3matchinfo.test aa66cc50615578b30f6df9984819ae5b702511cf8a94251ec7c594096a703a4a F test/fts3matchinfo2.test 00144e841704b8debfcdf6097969cd9f2a1cf759e2203cda42583648f2e6bf58 @@ -1436,7 +1436,7 @@ F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7 F test/savepoint7.test cde525ea3075283eb950cdcdefe23ead4f700daa F test/savepointfault.test f044eac64b59f09746c7020ee261734de82bf9b2 -F test/scanstatus.test 2adde2d8fb0fbae73e790afa724f15ea4c3d6d0809e5de4d00407c5c14836401 +F test/scanstatus.test b249328caf4d317e71058006872b8012598a5fa045b30bf24a81eeff650ab49e F test/scanstatus2.test b77de449be6ffd7a913a06dd84276dc6eb3517d479126e00ac51cd409c0a0af5 F test/schema.test 5dd11c96ba64744de955315d2e4f8992e447533690153b93377dffb2a5ef5431 F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5 @@ -2048,8 +2048,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2535bc8c256a7642a6ac00ebfd3393beb93da94394c13b886c3ddd20d114aa3c -R 69d00902044004b8ef9c714f6e03d77e -U drh -Z fc0cac54f8cfafa8b58dffee6508db4a +P 77f559d2647615379fed55ced5d69ae90515273e59811b92171bdd3089c90a22 +R b0649eadff654072848a0b28a23fc664 +U dan +Z 3ba2511e2bb55a3e7ecb463946dabd68 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 17f9dc480d..abed977a94 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -77f559d2647615379fed55ced5d69ae90515273e59811b92171bdd3089c90a22 \ No newline at end of file +5a09191186bc03b374e0c0d029e1a15208c6b845bc2f5f5f9f6a8a882809d9f3 \ No newline at end of file diff --git a/src/main.c b/src/main.c index e79d676139..23010d5fc4 100644 --- a/src/main.c +++ b/src/main.c @@ -3364,6 +3364,9 @@ static int openDatabase( #endif #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE) | SQLITE_LegacyAlter +#endif +#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) + | SQLITE_StmtScanStatus #endif ; sqlite3HashInit(&db->aCollSeq); diff --git a/src/shell.c.in b/src/shell.c.in index c2da3dbb38..944f655622 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -5309,6 +5309,7 @@ static void open_db(ShellState *p, int openFlags){ } exit(1); } + sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0); #ifndef SQLITE_OMIT_LOAD_EXTENSION sqlite3_enable_load_extension(p->db, 1); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 03e4862cc8..9dd023821c 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2464,7 +2464,7 @@ struct sqlite3_mem_methods { ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2() ** statistics. For statistics to be collected, the flag must be set on ** the database handle both when the SQL statement is prepared and when it -** is stepped. The flag is clear (collection of statistics is disabled) +** is stepped. The flag is set (collection of statistics is enabled) ** by default. ** */ diff --git a/test/fts3join.test b/test/fts3join.test index 3333b1ab42..cbd08b63f2 100644 --- a/test/fts3join.test +++ b/test/fts3join.test @@ -100,6 +100,7 @@ do_eqp_test 4.2 { |--MATERIALIZE rr | `--SCAN ft4 VIRTUAL TABLE INDEX 3: |--SCAN t4 + |--BLOOM FILTER ON rr (docid=?) `--SEARCH rr USING AUTOMATIC COVERING INDEX (docid=?) LEFT-JOIN } diff --git a/test/scanstatus.test b/test/scanstatus.test index ab87ad944a..549e7fd3c8 100644 --- a/test/scanstatus.test +++ b/test/scanstatus.test @@ -45,17 +45,20 @@ proc do_scanstatus_test {tn res} { uplevel [list do_test $tn [list set {} $ret] [list {*}$res]] } -do_execsql_test 1.0a { SELECT count(*) FROM t1, t2; } 6 -do_scanstatus_test 1.0b { } - -sqlite3_db_config db STMT_SCANSTATUS 1 - -do_execsql_test 1.1 { SELECT count(*) FROM t1, t2; } 6 -do_scanstatus_test 1.2 { +do_execsql_test 1.1a { SELECT count(*) FROM t1, t2; } 6 +do_scanstatus_test 1.1b { nLoop 1 nVisit 2 nEst 1048576.0 zName t1 zExplain {SCAN t1} nLoop 2 nVisit 6 nEst 1048576.0 zName t2 zExplain {SCAN t2} } +sqlite3_db_config db STMT_SCANSTATUS 0 + +do_execsql_test 1.2a { SELECT count(*) FROM t1, t2; } 6 +do_scanstatus_test 1.2b { +} + +sqlite3_db_config db STMT_SCANSTATUS 1 + do_execsql_test 1.3 { ANALYZE; SELECT count(*) FROM t1, t2;