Enable the count-of-view optimization by default.

Enhancement request [eaed8e36ce888f1e].

FossilOrigin-Name: a4aacdd323a854d771c8cb1e2e4cfc4fb66b0020cfed23525733603605f5c63b
This commit is contained in:
drh
2023-02-22 21:47:02 +00:00
parent 95dee6d2e3
commit af03eb3241
4 changed files with 29 additions and 13 deletions
+21
View File
@@ -163,4 +163,25 @@ do_eqp_test 3.6 {
# We want both arms of the compound subquery to use the
# primary key.
# The following is a test of the count-of-view optimization. This does
# not have anything to do with push-down. It is here because this is a
# convenient place to put the test.
#
do_execsql_test 3.7 {
SELECT count(*) FROM v3;
} 6
do_eqp_test 3.8 {
SELECT count(*) FROM v3;
} {
QUERY PLAN
|--SCAN CONSTANT ROW
|--SCALAR SUBQUERY xxxxxx
| `--SCAN t1
`--SCALAR SUBQUERY xxxxxx
`--SCAN t2
}
# ^^^^^^^^^^^^^^^^^^^^
# The query should be converted into:
# SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
finish_test