From 5c82f4df9f2c51b7b53901121b65542d60ca84d6 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 19 Nov 2013 02:34:11 +0000 Subject: [PATCH] Avoid seeking on the main data table during the first loop of an UPDATE if an index is sufficient to check the WHERE clause. FossilOrigin-Name: 57158d9daf4d777411fffb1c1d20d89b291d9214 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/update.c | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index dc1ca6920f..dee084c753 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\srequirement\smark\sin\sa\stest\sscript\sso\sthat\sit\smatches\sthe\ntypo-corrected\srequirement.\s\sNo\schanges\sto\scode. -D 2013-11-19T00:31:25.328 +C Avoid\sseeking\son\sthe\smain\sdata\stable\sduring\sthe\sfirst\sloop\sof\san\sUPDATE\nif\san\sindex\sis\ssufficient\sto\scheck\sthe\sWHERE\sclause. +D 2013-11-19T02:34:11.947 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -276,7 +276,7 @@ F src/test_vfstrace.c 34b544e80ba7fb77be15395a609c669df2e660a2 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c ec4c1a62b890bf1dbcdb966399e140b904c700a4 F src/trigger.c d84e1f3669e9a217731a14a9d472b1c7b87c87ba -F src/update.c cc3d826923f7b61566dedbb3cfce5f13964f35a4 +F src/update.c c05a0ee658f1a149e0960dfd110f3b8bd846bcb0 F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269 F src/util.c 2fa6c821d28bbdbeec1b2a7b091a281c9ef8f918 F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179 @@ -1140,7 +1140,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P e9df04cec48bb8b4ea26ec9024a22ea42b2338eb -R 8f5d4972dc75b885604bc463d0ac1318 +P 072412d5e3f92c9c6548f5c86d396d3f024df3f7 +R ef3f52da3f64e056bcf519f817dc69c2 U drh -Z c2cf09f17232f53b07d5ac061fb00e80 +Z b9dbca4948b9d68d76792a11f3b2fa7e diff --git a/manifest.uuid b/manifest.uuid index 13b5f1cc80..1cdbc74de7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -072412d5e3f92c9c6548f5c86d396d3f024df3f7 \ No newline at end of file +57158d9daf4d777411fffb1c1d20d89b291d9214 \ No newline at end of file diff --git a/src/update.c b/src/update.c index 9405234e8c..f2be6d984c 100644 --- a/src/update.c +++ b/src/update.c @@ -263,6 +263,11 @@ void sqlite3Update( assert( chngPk==0 || chngPk==1 ); chngKey = chngRowid + chngPk; + /* The SET expressions are not actually used inside the WHERE loop. + ** So reset the colUsed mask + */ + pTabList->a[0].colUsed = 0; + hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey); /* There is one entry in the aRegIdx[] array for each index on the table