/ Check-in [3dd35f51]
Login

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

Overview
Comment:Increase the initial value of WhereLoopBuilder.iPlanLimit to 20K. Issue a warning if the iPlanLimit reaches zero.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3dd35f51187574f47f860405309877cdbf9dc5710703dfd98cf98073b771140c
User & Date: drh 2018-09-24 10:47:33
Context
2018-09-24
12:37
Use compile-time options SQLITE_QUERY_PLANNER_LIMIT and SQLITE_QUERY_PLANNER_LIMIT_INCR to control the value for WhereLoopBuilder.iPlanLimit, rather than embedding magic numbers in the code. check-in: 903e5018 user: drh tags: trunk
10:47
Increase the initial value of WhereLoopBuilder.iPlanLimit to 20K. Issue a warning if the iPlanLimit reaches zero. check-in: 3dd35f51 user: drh tags: trunk
2018-09-23
02:01
Fix a faulty assert() in the validation logic for the LEFT JOIN strength reduction optimization. Problem found by OSSFuzz. check-in: 2fd62fcc user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  3539   3539   
  3540   3540     /* Loop over the tables in the join, from left to right */
  3541   3541     pNew = pBuilder->pNew;
  3542   3542     whereLoopInit(pNew);
  3543   3543     /* Some pathological queries provide an unreasonable number of indexing
  3544   3544     ** options. The iPlanLimit value prevents these queries from taking up
  3545   3545     ** too much time in the planner. When iPlanLimit reaches zero, no further
  3546         -  ** index+constraint options are considered. Seed iPlanLimit to 10K but
         3546  +  ** index+constraint options are considered. Seed iPlanLimit to 20K but
  3547   3547     ** also add an extra 1K to each table of the join, to ensure that each
  3548   3548     ** table at least gets 1K opportunities. */
  3549         -  pBuilder->iPlanLimit = 10000;
         3549  +  pBuilder->iPlanLimit = 20000;
  3550   3550     for(iTab=0, pItem=pTabList->a; pItem<pEnd; iTab++, pItem++){
  3551   3551       Bitmask mUnusable = 0;
  3552   3552       pNew->iTab = iTab;
  3553   3553       pBuilder->iPlanLimit += 1000;  /* 1000 bonus for each table in the join */
  3554   3554       pNew->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor);
  3555   3555       if( ((pItem->fg.jointype|priorJointype) & (JT_LEFT|JT_CROSS))!=0 ){
  3556   3556         /* This condition is true when pItem is the FROM clause term on the
................................................................................
  3575   3575       if( rc==SQLITE_OK && pBuilder->pWC->hasOr ){
  3576   3576         rc = whereLoopAddOr(pBuilder, mPrereq, mUnusable);
  3577   3577       }
  3578   3578       mPrior |= pNew->maskSelf;
  3579   3579       if( rc || db->mallocFailed ){
  3580   3580         if( rc==SQLITE_DONE ){
  3581   3581           /* We hit the query planner search limit set by iPlanLimit */
         3582  +        sqlite3_log(SQLITE_WARNING, "abbreviated query algorithm search");
  3582   3583           rc = SQLITE_OK;
  3583   3584         }else{
  3584   3585           break;
  3585   3586         }
  3586   3587       }
  3587   3588     }
  3588   3589