/ Check-in [18501dd1]
Login

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

Overview
Comment:Extend the SQLITE_TESTCTRL_OPTIMIZATIONS option to disable DISTINCT optimizations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 18501dd1a8aa8299c091c36e35b9a10a29d4467b
User & Date: drh 2011-07-08 13:07:02
Context
2011-07-08
16:10
Fix for [54844eea3f]: Do not create automatic indexes on correlated sub-queries. check-in: 9f14fa56 user: dan tags: trunk
13:07
Extend the SQLITE_TESTCTRL_OPTIMIZATIONS option to disable DISTINCT optimizations. check-in: 18501dd1 user: drh tags: trunk
2011-07-07
08:52
Update the tool/symbols.sh script to check for accidentally exported global variables. check-in: 71b749a9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqliteInt.h.

   952    952   #define SQLITE_ColumnCache    0x02        /* Disable the column cache */
   953    953   #define SQLITE_IndexSort      0x04        /* Disable indexes for sorting */
   954    954   #define SQLITE_IndexSearch    0x08        /* Disable indexes for searching */
   955    955   #define SQLITE_IndexCover     0x10        /* Disable index covering table */
   956    956   #define SQLITE_GroupByOrder   0x20        /* Disable GROUPBY cover of ORDERBY */
   957    957   #define SQLITE_FactorOutConst 0x40        /* Disable factoring out constants */
   958    958   #define SQLITE_IdxRealAsInt   0x80        /* Store REAL as INT in indices */
          959  +#define SQLITE_DistinctOpt    0x80        /* DISTINCT using indexes */
   959    960   #define SQLITE_OptMask        0xff        /* Mask of all disablable opts */
   960    961   
   961    962   /*
   962    963   ** Possible values for the sqlite.magic field.
   963    964   ** The numbers are obtained at random and have no special meaning, other
   964    965   ** than being distinct from one another.
   965    966   */

Changes to src/where.c.

  4593   4593     pWInfo->pParse = pParse;
  4594   4594     pWInfo->pTabList = pTabList;
  4595   4595     pWInfo->iBreak = sqlite3VdbeMakeLabel(v);
  4596   4596     pWInfo->pWC = pWC = (WhereClause *)&((u8 *)pWInfo)[nByteWInfo];
  4597   4597     pWInfo->wctrlFlags = wctrlFlags;
  4598   4598     pWInfo->savedNQueryLoop = pParse->nQueryLoop;
  4599   4599     pMaskSet = (WhereMaskSet*)&pWC[1];
         4600  +
         4601  +  /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
         4602  +  ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
         4603  +  if( db->flags & SQLITE_DistinctOpt ) pDistinct = 0;
  4600   4604   
  4601   4605     /* Split the WHERE clause into separate subexpressions where each
  4602   4606     ** subexpression is separated by an AND operator.
  4603   4607     */
  4604   4608     initMaskSet(pMaskSet);
  4605   4609     whereClauseInit(pWC, pParse, pMaskSet);
  4606   4610     sqlite3ExprCodeConstants(pParse, pWhere);