/ Check-in [351dc8d9]
Login

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

Overview
Comment:Make sure the outer loop cursor numbers are recorded in time for them to be used by the ORDER BY optimizer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 351dc8d9cab8a222f28fb865d3a7d1c622d60d6f
User & Date: drh 2012-10-02 01:25:16
Context
2012-10-02
01:46
Factor an invariant out the loop termination condition for the ORDER BY satisfied-by-index analyzer routine. check-in: 545bb336 user: drh tags: trunk
01:25
Make sure the outer loop cursor numbers are recorded in time for them to be used by the ORDER BY optimizer. check-in: 351dc8d9 user: drh tags: trunk
01:10
Improvements to the wheretrace output. check-in: 76b27765 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  5112   5112       }
  5113   5113       if( (bestPlan.plan.wsFlags & WHERE_DISTINCT)!=0 ){
  5114   5114         assert( pWInfo->eDistinct==0 );
  5115   5115         pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
  5116   5116       }
  5117   5117       andFlags &= bestPlan.plan.wsFlags;
  5118   5118       pLevel->plan = bestPlan.plan;
         5119  +    pLevel->iTabCur = pTabList->a[bestJ].iCursor;
  5119   5120       testcase( bestPlan.plan.wsFlags & WHERE_INDEXED );
  5120   5121       testcase( bestPlan.plan.wsFlags & WHERE_TEMP_INDEX );
  5121   5122       if( bestPlan.plan.wsFlags & (WHERE_INDEXED|WHERE_TEMP_INDEX) ){
  5122   5123         if( (wctrlFlags & WHERE_ONETABLE_ONLY) 
  5123   5124          && (bestPlan.plan.wsFlags & WHERE_TEMP_INDEX)==0 
  5124   5125         ){
  5125   5126           pLevel->iIdxCur = iIdxCur;
................................................................................
  5185   5186     for(ii=0, pLevel=pWInfo->a; ii<nTabList; ii++, pLevel++){
  5186   5187       Table *pTab;     /* Table to open */
  5187   5188       int iDb;         /* Index of database containing table/index */
  5188   5189       struct SrcList_item *pTabItem;
  5189   5190   
  5190   5191       pTabItem = &pTabList->a[pLevel->iFrom];
  5191   5192       pTab = pTabItem->pTab;
  5192         -    pLevel->iTabCur = pTabItem->iCursor;
  5193   5193       pWInfo->nRowOut *= pLevel->plan.nRow;
  5194   5194       iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  5195   5195       if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){
  5196   5196         /* Do nothing */
  5197   5197       }else
  5198   5198   #ifndef SQLITE_OMIT_VIRTUALTABLE
  5199   5199       if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){