]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update comments describing the flattening optimization in select.c.
authordrh <drh@noemail.net>
Sun, 11 Dec 2011 21:51:04 +0000 (21:51 +0000)
committerdrh <drh@noemail.net>
Sun, 11 Dec 2011 21:51:04 +0000 (21:51 +0000)
FossilOrigin-Name: dab4c137a852222f11179fa2ade52d17a4206dd2

manifest
manifest.uuid
src/select.c

index 1969ac3e31d8f9d67a3df4691b53ca78f7b6f49c..6a4599845f0cd7a708138662599b03bd5f20533a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sSTAT3\sso\sthat\sit\sworks\swith\sthe\snew\suninitialized\sregister\slogic\sof\nthe\sVDBE.\s\sTicket\s[7bbfb7d4422ff]
-D 2011-12-11T02:30:35.672
+C Update\scomments\sdescribing\sthe\sflattening\soptimization\sin\sselect.c.
+D 2011-12-11T21:51:04.519
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -180,7 +180,7 @@ F src/printf.c 7ffb4ebb8b341f67e049695ba031da717b3d2699
 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
 F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
-F src/select.c f38d6bb54dbe42409b66b038be24765f68b5d44b
+F src/select.c a1d075db66a0ea42807353501b62997969e5be79
 F src/shell.c a1eadb2fdbfa45e54307263f0c8da8ee8cd61b8b
 F src/sqlite.h.in 1dc07194eb1a2c69c8ef75f88022b170be08024a
 F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
@@ -978,7 +978,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 1e6a698aab9270637d3ea00fd6b0e94f4172e875
-R b14f97101207c69b3c216a1f2d4f412b
+P d11a57985c394772043c63d4c2b534944be0a664
+R db74426b5ff988e285b71512d50b85b4
 U drh
-Z ed714f23f92d49472af328d21dd14bdc
+Z fcdcb7d7647c15fa01d78b530015f5fb
index 2526b92bc232c4a8fb4a8ae17e9072059d230e80..9f7b7a620846e2f2bc51a3e062d50f020a8f3cb9 100644 (file)
@@ -1 +1 @@
-d11a57985c394772043c63d4c2b534944be0a664
\ No newline at end of file
+dab4c137a852222f11179fa2ade52d17a4206dd2
\ No newline at end of file
index f0f4b6a5f22a32f5c316be2f684f0b4fd7b819bc..188050e8d14843ed6bd16f86003690d5d4b8acb6 100644 (file)
@@ -2588,9 +2588,8 @@ static void substSelect(
 
 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
 /*
-** This routine attempts to flatten subqueries in order to speed
-** execution.  It returns 1 if it makes changes and 0 if no flattening
-** occurs.
+** This routine attempts to flatten subqueries as a performance optimization.
+** This routine returns 1 if it makes changes and 0 if no flattening occurs.
 **
 ** To understand the concept of flattening, consider the following
 ** query:
@@ -2632,7 +2631,10 @@ static void substSelect(
 **   (6)  The subquery does not use aggregates or the outer query is not
 **        DISTINCT.
 **
-**   (7)  The subquery has a FROM clause.
+**   (7)  The subquery has a FROM clause.  TODO:  For subqueries without
+**        A FROM clause, consider adding a FROM close with the special
+**        table sqlite_once that consists of a single row containing a
+**        single NULL.
 **
 **   (8)  The subquery does not use LIMIT or the outer query is not a join.
 **
@@ -2665,11 +2667,14 @@ static void substSelect(
 **
 **          * is not itself part of a compound select,
 **          * is not an aggregate or DISTINCT query, and
-**          * has no other tables or sub-selects in the FROM clause.
+**          * is not a join
 **
 **        The parent and sub-query may contain WHERE clauses. Subject to
 **        rules (11), (13) and (14), they may also contain ORDER BY,
-**        LIMIT and OFFSET clauses.
+**        LIMIT and OFFSET clauses.  The subquery cannot use any compound
+**        operator other than UNION ALL because all the other compound
+**        operators have an implied DISTINCT which is disallowed by
+**        restriction (4).
 **
 **  (18)  If the sub-query is a compound select, then all terms of the
 **        ORDER by clause of the parent must be simple references to 
@@ -2681,7 +2686,7 @@ static void substSelect(
 **  (20)  If the sub-query is a compound select, then it must not use
 **        an ORDER BY clause.  Ticket #3773.  We could relax this constraint
 **        somewhat by saying that the terms of the ORDER BY clause must
-**        appear as unmodified result columns in the outer query.  But
+**        appear as unmodified result columns in the outer query.  But we
 **        have other optimizations in mind to deal with that case.
 **
 **  (21)  The subquery does not use LIMIT or the outer query is not