/ Check-in [700a3c69]
Login

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

Overview
Comment:Improved comments, including a typo fix, on the whereLoopCheaperProperSubset() function.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 700a3c694438ca6cca185d0097f24799e82717ef38cb47bd83666c80f0e3cb2f
User & Date: drh 2017-10-16 11:50:12
Context
2017-10-17
13:44
Fix the ".check" command of the command-line shell to return 1 (error) rather than 2 (exit) on a test failure. check-in: e2af0cc6 user: drh tags: trunk
2017-10-16
11:50
Improved comments, including a typo fix, on the whereLoopCheaperProperSubset() function. check-in: 700a3c69 user: drh tags: trunk
2017-10-15
22:16
In the query planner, do not consider index X to be a proper subset of index Y if X is a covering index but Y is not. check-in: ee31c043 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  1881   1881     }
  1882   1882   }
  1883   1883   
  1884   1884   /*
  1885   1885   ** Return TRUE if all of the following are true:
  1886   1886   **
  1887   1887   **   (1)  X has the same or lower cost that Y
  1888         -**   (2)  X users fewer WHERE clause terms than Y
         1888  +**   (2)  X uses fewer WHERE clause terms than Y
  1889   1889   **   (3)  Every WHERE clause term used by X is also used by Y
  1890   1890   **   (4)  X skips at least as many columns as Y
  1891   1891   **   (5)  If X is a covering index, than Y is too
  1892   1892   **
  1893   1893   ** Conditions (2) and (3) mean that X is a "proper subset" of Y.
  1894   1894   ** If X is a proper subset of Y then Y is a better choice and ought
  1895   1895   ** to have a lower cost.  This routine returns TRUE when that cost 
  1896   1896   ** relationship is inverted and needs to be adjusted.  Constraint (4)
  1897   1897   ** was added because if X uses skip-scan less than Y it still might
  1898         -** deserve a lower cost even if it is a proper subset of Y.
         1898  +** deserve a lower cost even if it is a proper subset of Y.  Constraint (5)
         1899  +** was added because a covering index probably deserves to have a lower cost
         1900  +** than a non-covering index even if it is a proper subset.
  1899   1901   */
  1900   1902   static int whereLoopCheaperProperSubset(
  1901   1903     const WhereLoop *pX,       /* First WhereLoop to compare */
  1902   1904     const WhereLoop *pY        /* Compare against this WhereLoop */
  1903   1905   ){
  1904   1906     int i, j;
  1905   1907     if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){