Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Avoid adding an artifical "LIMIT 1" on scalar subqueries that do not need it. This seems like a pointless optimization as it makes minimal run-time difference but does increase code complexity. Parked on a branch for historical reference. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | subquery-limit-opt |
Files: | files | file ages | folders |
SHA3-256: |
c21628e9c166d8481138e04cfbc2ea5a |
User & Date: | drh 2017-06-17 19:06:17.565 |
Context
2017-06-17
| ||
19:06 | Avoid adding an artifical "LIMIT 1" on scalar subqueries that do not need it. This seems like a pointless optimization as it makes minimal run-time difference but does increase code complexity. Parked on a branch for historical reference. (Leaf check-in: c21628e9c1 user: drh tags: subquery-limit-opt) | |
18:49 | Fix a missing comma in the previous check-in. (check-in: f3db02f490 user: drh tags: trunk) | |
Changes
Changes to src/expr.c.
︙ | ︙ | |||
2713 2714 2715 2716 2717 2718 2719 | VdbeComment((v, "Init subquery result")); }else{ dest.eDest = SRT_Exists; sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm); VdbeComment((v, "Init EXISTS result")); } sqlite3ExprDelete(pParse->db, pSel->pLimit); | > > > | | > | 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 | VdbeComment((v, "Init subquery result")); }else{ dest.eDest = SRT_Exists; sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm); VdbeComment((v, "Init EXISTS result")); } sqlite3ExprDelete(pParse->db, pSel->pLimit); if( (pSel->selFlags & SF_Aggregate)!=0 && pSel->pGroupBy==0 ){ pSel->pLimit = 0; }else{ pSel->pLimit = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &sqlite3IntTokens[1], 0); } pSel->iLimit = 0; pSel->selFlags &= ~SF_MultiValue; if( sqlite3Select(pParse, pSel, &dest) ){ return 0; } rReg = dest.iSDParm; ExprSetVVAProperty(pExpr, EP_NoReduce); |
︙ | ︙ |