/ Check-in [723f901a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not search using ON clause constraints of LEFT JOINs to the right of the table.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nextgen-query-plan-exp
Files: files | file ages | folders
SHA1:723f901a63313b64a9f10516711fb6136526b79b
User & Date: drh 2013-05-31 20:28:28
Context
2013-05-31
20:43
The NGQP might not find a solution if INDEXED BY constraints on the query are set wrong. If that is the case, print a "no query solution" error and abort before trying to use the non-existant solution. check-in: 42511a7e user: drh tags: nextgen-query-plan-exp
20:28
Do not search using ON clause constraints of LEFT JOINs to the right of the table. check-in: 723f901a user: drh tags: nextgen-query-plan-exp
20:00
Make sure a unique cursor number is allocated for automatic indices. check-in: 433d1aec user: drh tags: nextgen-query-plan-exp
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  3992   3992     pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol,
  3993   3993                           opMask, pProbe);
  3994   3994     savedLoop = *pNew;
  3995   3995     pNew->rSetup = (double)0;
  3996   3996     rLogSize = estLog(pProbe->aiRowEst[0]);
  3997   3997     for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
  3998   3998       int nIn = 1;
         3999  +    if( pTerm->prereqRight & pNew->maskSelf ) continue;
  3999   4000       pNew->wsFlags = savedLoop.wsFlags;
  4000   4001       pNew->u.btree.nEq = savedLoop.u.btree.nEq;
  4001   4002       pNew->nTerm = savedLoop.nTerm;
  4002   4003       if( pNew->nTerm>=pBuilder->mxTerm ) break; /* Repeated column in index */
  4003   4004       pNew->aTerm[pNew->nTerm++] = pTerm;
  4004   4005       pNew->prereq = (savedLoop.prereq | pTerm->prereqRight) & ~pNew->maskSelf;
  4005   4006       if( pTerm->eOperator & WO_IN ){
................................................................................
  4142   4143      && !pSrc->isCorrelated
  4143   4144     ){
  4144   4145       /* Generate auto-index WhereLoops */
  4145   4146       WhereClause *pWC = pBuilder->pWC;
  4146   4147       WhereTerm *pTerm;
  4147   4148       WhereTerm *pWCEnd = pWC->a + pWC->nTerm;
  4148   4149       for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){
         4150  +      if( pTerm->prereqRight & pNew->maskSelf ) continue;
  4149   4151         if( termCanDriveIndex(pTerm, pSrc, 0) ){
  4150   4152           pNew->u.btree.nEq = 1;
  4151   4153           pNew->u.btree.pIndex = 0;
  4152   4154           pNew->nTerm = 1;
  4153   4155           pNew->aTerm[0] = pTerm;
  4154   4156           pNew->rSetup = 20*rLogSize*pSrc->pTab->nRowEst;
  4155   4157           pNew->nOut = (double)10;