/ Check-in [ac4e119a]
Login

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

Overview
Comment:Fix a missing word in a comment. Enhance the "wheretrace" debugging output to show the estimated cost of each table option while planning the join order.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ac4e119a87497f2e422ff1cb711112ed8594bfa9
User & Date: drh 2013-01-15 18:49:07
Context
2013-01-16
00:46
Improvements to query planning for joins: Avoid unnecessary calls to "optimal scan" checks in cases where table reordering is not possible. Make sure optimal scan checks are carried out for CROSS JOINs and LEFT JOINs. check-in: d5ebb787 user: drh tags: trunk
2013-01-15
18:49
Fix a missing word in a comment. Enhance the "wheretrace" debugging output to show the estimated cost of each table option while planning the join order. check-in: ac4e119a user: drh tags: trunk
16:15
Clarification to a comment in where.c. No code changes. check-in: 04507c17 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  3565   3565     assert( p->pOrderBy || (p->cost.plan.wsFlags&WHERE_ORDERED)==0 );
  3566   3566     assert( p->cost.plan.u.pIdx==0 || (p->cost.plan.wsFlags&WHERE_ROWID_EQ)==0 );
  3567   3567     assert( pSrc->pIndex==0 
  3568   3568          || p->cost.plan.u.pIdx==0 
  3569   3569          || p->cost.plan.u.pIdx==pSrc->pIndex 
  3570   3570     );
  3571   3571   
  3572         -  WHERETRACE(("   best index is: %s\n",
  3573         -         p->cost.plan.u.pIdx ? p->cost.plan.u.pIdx->zName : "ipk"));
         3572  +  WHERETRACE(("   best index is %s cost=%.1f\n",
         3573  +         p->cost.plan.u.pIdx ? p->cost.plan.u.pIdx->zName : "ipk",
         3574  +         p->cost.rCost));
  3574   3575     
  3575   3576     bestOrClauseIndex(p);
  3576   3577     bestAutomaticIndex(p);
  3577   3578     p->cost.plan.wsFlags |= eqTermMask;
  3578   3579   }
  3579   3580   
  3580   3581   /*
................................................................................
  5157   5158   
  5158   5159           if( isOptimal && (sWBI.cost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ){
  5159   5160             notIndexed |= m;
  5160   5161           }
  5161   5162           if( isOptimal ){
  5162   5163             pWInfo->a[j].rOptCost = sWBI.cost.rCost;
  5163   5164           }else if( iFrom<nTabList-1 ){
  5164         -          /* If two or more tables have nearly the same outer loop cost,
         5165  +          /* If two or more tables have nearly the same outer loop cost, but
  5165   5166             ** very different inner loop (optimal) cost, we want to choose
  5166   5167             ** for the outer loop that table which benefits the least from
  5167   5168             ** being in the inner loop.  The following code scales the 
  5168   5169             ** outer loop cost estimate to accomplish that. */
  5169   5170             WHERETRACE(("   scaling cost from %.1f to %.1f\n",
  5170   5171                         sWBI.cost.rCost,
  5171   5172                         sWBI.cost.rCost/pWInfo->a[j].rOptCost));