From: drh <> Date: Thu, 13 Oct 2022 15:09:44 +0000 (+0000) Subject: Optimize the IS NULL and IS NOT NULL operators so that they avoid loading X-Git-Tag: version-3.40.0~164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=921acff92767b6dcda8ed2134c73497fe33905c6;p=thirdparty%2Fsqlite.git Optimize the IS NULL and IS NOT NULL operators so that they avoid loading large strings or blobs off of disk if all it needs to know is whether or not the string or blob is NULL. FossilOrigin-Name: cb94350185f555c333b628ee846c47bcc9df5f76bb82de569b8322f30dbbe1bc --- 921acff92767b6dcda8ed2134c73497fe33905c6 diff --cc manifest index 7cc3384d5a,3fd16f1266..98f55bf418 --- a/manifest +++ b/manifest @@@ -1,5 -1,5 +1,5 @@@ - C Fix\sa\stypo\sin\sthe\sdocumentation\sof\sthe\sOP_Column\sopcode.\n[forum:/forumpost/a2b5bd6d43|Forum\spost\sa2b5bd6d43]. - D 2022-10-13T14:01:11.049 -C Improvements\sto\sthe\sdescription\sof\sthe\sOPFLAG_TYPEOFARG\soption\sto\sOP_Column. -D 2022-10-13T14:54:32.397 ++C Optimize\sthe\sIS\sNULL\sand\sIS\sNOT\sNULL\soperators\sso\sthat\sthey\savoid\sloading\nlarge\sstrings\sor\sblobs\soff\sof\sdisk\sif\sall\sit\sneeds\sto\sknow\sis\swhether\sor\nnot\sthe\sstring\sor\sblob\sis\sNULL. ++D 2022-10-13T15:09:44.252 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@@ -692,11 -692,11 +692,11 @@@ F src/upsert.c 8789047a8f0a601ea42fa025 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c 0be191521ff6d2805995f4910f0b6231b42843678b2efdc1abecaf39929a673f F src/vacuum.c bb346170b0b54c6683bba4a5983aea40485597fdf605c87ec8bc2e199fe88cd8 - F src/vdbe.c 76c402850156e69eaf43c32fc8e5ecffa2c4a0cf0c2dc24c23e48a60d1bf388a - F src/vdbe.h 64619af62603dc3c4f5ff6ff6d2c8f389abd667a29ce6007ed44bd22b3211cd0 -F src/vdbe.c 581496d84d7ce5b4f7302f14b3bc5271bbcef5dce28ce97c505297340e0c46e3 ++F src/vdbe.c 0c7cb1b934ad8611e14e7efaf2c3a95df7dd3f7964d63ea07fef42a23df86131 + F src/vdbe.h 58675f47dcf3105bab182c3ad3726efd60ffd003e954386904ac9107d0d2b743 F src/vdbeInt.h 17b7461ffcf9ee760d1341731715a419f6b8c763089a7ece25c2e8098d702b3f F src/vdbeapi.c 1e8713d0b653acb43cd1bdf579c40e005c4844ea90f414f065946a83db3c27fb - F src/vdbeaux.c c719cebaffa75e166f16a405b3dee96e7150d60fc563ab2dea716b60c6a51312 -F src/vdbeaux.c e22cf8b85b8b0b8dd585e46f13a4db24f42053a549685e79907d7c0812f00fbd ++F src/vdbeaux.c 6946c7082a0d61566794bd35253f0ccd013a9dba3f33488a23fd5360a5744e5b F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd F src/vdbemem.c 6cfed43758d57b6e3b99d9cdedfeccd86e45a07e427b22d8487cbdbebb6c522a F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35 @@@ -2034,8 -2034,8 +2034,9 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 - P ef689e33e464829f5cbe4ca24a53d9dba59abe74d3d80a37a91b93a4eccccf2d - R be99ac3662eff783728d08e4d117e169 -P 79fdd021df256c6a2b9973fd6bf8e52ffaaf4d369d40489b8395ac97880b1325 -R f513ee84e2c3c752a45dcdac513b8ce6 ++P 043e76e6166da5cf8e213cce46aaccb1f910e1fdbdb5556576eafb81b3bc5faa 5e9c67ba18b701aabbb0546acdfc532c9e8f0d27fb0a2c899415a5c47096c90b ++R c0d9c663bdd4b8318254b199c65d7e13 ++T +closed 5e9c67ba18b701aabbb0546acdfc532c9e8f0d27fb0a2c899415a5c47096c90b U drh - Z 157d4043f80d56e9469d6c0aa37164a1 -Z 5b4f99a755b8cb54cd55294bc14ffa4e ++Z 57cc74128fdf4ddaf1ca461d6df422e4 # Remove this line to create a well-formed Fossil manifest. diff --cc manifest.uuid index da43638604,fc10115bbe..82a3113355 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 043e76e6166da5cf8e213cce46aaccb1f910e1fdbdb5556576eafb81b3bc5faa -5e9c67ba18b701aabbb0546acdfc532c9e8f0d27fb0a2c899415a5c47096c90b ++cb94350185f555c333b628ee846c47bcc9df5f76bb82de569b8322f30dbbe1bc diff --cc src/vdbeaux.c index 8785e3b568,45e573535e..18bbcd2f97 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@@ -1155,6 -1155,18 +1155,18 @@@ void sqlite3VdbeChangeP5(Vdbe *p, u16 p if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5; } + /* + ** If the previous opcode is an OP_Column that delivers results -** into register iDest, then add the OPFLAG_TYPEOF flag to that ++** into register iDest, then add the OPFLAG_TYPEOFARG flag to that + ** opcode. + */ + void sqlite3VdbeTypeofColumn(Vdbe *p, int iDest){ + VdbeOp *pOp = sqlite3VdbeGetLastOp(p); + if( pOp->p3==iDest && pOp->opcode==OP_Column ){ + pOp->p5 |= OPFLAG_TYPEOFARG; + } + } + /* ** Change the P2 operand of instruction addr so that it points to ** the address of the next instruction to be coded.