Revise the "noquery" decision algorithm again. The index now must select
more than 150 rows on average, and the number of rows select must be enough that it seems faster to do a full scan of the associated table. FossilOrigin-Name: f516ef80a0ba87fa3b74da0fc899a7d14ad3de61fac6b467e36e7fa9fe76dcdf
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C Fix\san\sissue\sin\sthe\s"noquery"\sdecision\sin\sthe\sprevious\scheck-in.\s\sAlso\sadd\ncomments\sexplaining\sthe\salgorithm.
|
||||
D 2023-12-29T20:31:32.065
|
||||
C Revise\sthe\s"noquery"\sdecision\salgorithm\sagain.\s\sThe\sindex\snow\smust\sselect\nmore\sthan\s150\srows\son\saverage,\sand\sthe\snumber\sof\srows\sselect\smust\sbe\senough\nthat\sit\sseems\sfaster\sto\sdo\sa\sfull\sscan\sof\sthe\sassociated\stable.
|
||||
D 2023-12-29T21:07:00.789
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@@ -670,7 +670,7 @@ F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F sqlite_cfg.h.in baf2e409c63d4e7a765e17769b6ff17c5a82bbd9cbf1e284fd2e4cefaff3fcf2
|
||||
F src/alter.c 30c2333b8bb3af71e4eb9adeadee8aa20edb15917ed44b8422e5cd15f3dfcddc
|
||||
F src/analyze.c 6f88cfaf7e4de1cf9231b0c6c270b0f7d0d11fa0b33868c3890822757ba8df8d
|
||||
F src/analyze.c 0c4b43ba2e4e7db574c8af8e6cfdb09aff6a91a11caed821867c5b51708534d5
|
||||
F src/attach.c cc9d00d30da916ff656038211410ccf04ed784b7564639b9b61d1839ed69fd39
|
||||
F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4
|
||||
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
|
||||
@@ -2156,8 +2156,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 e514d3fa83662aa19abefebdda5652e6adb0f0b5a75ad7ee9dd3d2d2c87e03c5
|
||||
R 5434c613e51a90ac2d4be4dfede8fa3d
|
||||
P 6aaa65adfc3b0c8e1ee7066de38d4385904c80da704b97440b0699fc78176ffa
|
||||
R 25c81b1dd9b3d0d849705539d9441d5c
|
||||
U drh
|
||||
Z afc1c4a983fea7e5c946a28458460117
|
||||
Z eef2167dc56c437be295ceda1d33c4be
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
6aaa65adfc3b0c8e1ee7066de38d4385904c80da704b97440b0699fc78176ffa
|
||||
f516ef80a0ba87fa3b74da0fc899a7d14ad3de61fac6b467e36e7fa9fe76dcdf
|
||||
+7
-6
@@ -891,12 +891,13 @@ static void statGet(
|
||||
sqlite3_str_appendf(&sStat, " %llu", iVal);
|
||||
assert( p->current.anEq[i] );
|
||||
}
|
||||
if( iVal>=1000 && iVal*10>=nRow ){
|
||||
/* If this index always matches 1000 or more rows even if all columns
|
||||
** match, and if the the number of rows matched is 1/10th or more of
|
||||
** the index, then this is a very low selectivity index. Mark it as
|
||||
** "noquery" so that the query planner won't waste any time trying to
|
||||
** use it. */
|
||||
if( iVal>=150 && iVal>=(nRow*10)/sqlite3LogEst(nRow) ){
|
||||
/* If this index is likely to match 150 or more rows even if all columns
|
||||
** match, and if the the number of rows matched is such a large fraction
|
||||
** of the index that a full scan of the table would be faster than
|
||||
** doing a binary search for each row identified by the index,
|
||||
** then this is a very low selectivity index. Mark it as "noquery"
|
||||
** so that the query planner won't waste any time trying to use it. */
|
||||
sqlite3_str_appendf(&sStat, " noquery");
|
||||
}
|
||||
sqlite3ResultStrAccum(context, &sStat);
|
||||
|
||||
Reference in New Issue
Block a user