SQLite

Changes On Branch branch-3.28-in-early-out-fail
Login

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

Changes In Branch branch-3.28-in-early-out-fail Excluding Merge-Ins

This is equivalent to a diff from 0ecda43371 to 8301da31d0

2020-09-01
02:02
Improvements to the IN-early-out optimization so that it works more efficiently when there are two or more indexed IN clauses on a single table. (check-in: 49b7631e86 user: drh tags: branch-3.28)
2020-08-31
19:19
An attempt to improve the performance of the IN-early-out optimization (see check-in [09fffbdf9f2f6ce3]) by avoiding unnecessary calls to the b-tree search algorithm in OP_IfNoHope when the index key is at hand and the same answer can be obtained by doing a quick key comparison. Update: Experiment did not work out. (Closed-Leaf check-in: 8301da31d0 user: drh tags: branch-3.28-in-early-out-fail)
16:31
An attempt to improve the performance of the IN-early-out optimization (see check-in [09fffbdf9f2f6ce3]) by avoiding unnecessary calls to the b-tree search algorithm in OP_IfNoHope when the index key is at hand and the same answer can be obtained by doing a quick key comparison. Update 2020-08-31: This experiment did not work out. A better approach is now on trunk. (check-in: e9d983c683 user: drh tags: in-early-out-fail)
2020-08-17
21:03
When doing an UPDATE or DELETE using a multi-column index where only a few of the earlier columns of the index are useful for the index lookup, postpone doing the main table seek until after all WHERE clause constraints have been evaluated, in case those constraints can be covered by unused later terms of the index, thus avoiding unnecessary main table seeks. (check-in: 0ecda43371 user: dan tags: branch-3.28)
2020-08-14
21:51
When doing an UPDATE or DELETE using a multi-column index where only a few of the earlier columns of the index are useful for the index lookup, postpone doing the main table seek until after all WHERE clause constraints have been evaluated, in case those constraints can be covered by unused later terms of the index, thus avoiding unnecessary main table seeks. (check-in: 7fee0b1075 user: drh tags: trunk)
2020-05-06
18:46
Provide the SQLITE_DEFAULT_LEGACY_ALTER_TABLE compile-time option. (check-in: b2325a6e1c user: drh tags: branch-3.28)

Changes to src/vdbe.c.
113
114
115
116
117
118
119
















































120
121
122
123
124
125
126
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







*/
#if defined(SQLITE_TEST) && !defined(SQLITE_UNTESTABLE)
# define UPDATE_MAX_BLOBSIZE(P)  updateMaxBlobsize(P)
#else
# define UPDATE_MAX_BLOBSIZE(P)
#endif


#ifdef SQLITE_DEBUG
/* This is a validation routine that occurs only inside of assert()
** statements.  Its purpose is to verify that the generated bytecode
** is correct.  It only runs on debugging builds.
**
** Verify that the pOp opcode is an OP_SeekGE or OP_SeekLE that is
** followed by a corresponding OP_IdxGT or OP_IdxLT, possibly with
** an intervening OP_SeekHit.  Return 1 if the constraint is true.
** Return 0 if something unexpected is seen.
*/
static int seekFollowedByPairedIdxCompare(VdbeOp *pOp){
  VdbeOp *pNext;

  /* Find the subsequent opcode.  We are allowed to skip over a single
  ** OP_SeekHit against the same cursor with a P2 value of 1.
  */
  pNext = pOp + 1;
  if( pNext->opcode==OP_SeekHit ){
    if( pNext->p2!=1 ) return 0;
    if( pNext->p1!=pOp->p1 ) return 0;
    pNext++;
  }

  /* This routine verifies that the opcodes are correct for a
  ** BTREE_SEEK_EQ lookup.  So the two opcodes involved must be either:
  **
  **  *   OP_SeekGE followed by OP_IdxGT
  **  *   OP_SeekLE followed by OP_IdxLT
  */
  if( pOp->opcode==OP_SeekGE ){
    if( pNext->opcode!=OP_IdxGT ) return 0;
  }else if( pOp->opcode==OP_SeekLE ){
    if( pNext->opcode!=OP_IdxLT ) return 0;
  }else{
    return 0;
  }

  /* The OP_SeekXX and OP_IdxXX must have the same arguments.
  */
  if( pOp->p1!=pNext->p1 ) return 0;
  if( pOp->p2!=pNext->p2 ) return 0;
  if( pOp->p3!=pNext->p3 ) return 0;
  if( pOp->p4.i!=pNext->p4.i ) return 0;
  return 1;
}
#endif /* SQLITE_DEBUG */

/*
** Invoke the VDBE coverage callback, if that callback is defined.  This
** feature is used for test suite validation only and does not appear an
** production builds.
**
** M is the type of branch.  I is the direction taken for this instance of
** the branch.
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012





4013
4014
4015

4016
4017
4018

4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4051
4052
4053
4054
4055
4056
4057



4058
4059
4060
4061
4062
4063
4064

4065



4066



4067
4068
4069
4070
4071
4072
4073







-
-
-
+
+
+
+
+


-
+
-
-
-
+
-
-
-







    } 
    rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res);
    pC->movetoTarget = iKey;  /* Used by OP_Delete */
    if( rc!=SQLITE_OK ){
      goto abort_due_to_error;
    }
  }else{
    /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and
    ** OP_SeekLE opcodes are allowed, and these must be immediately followed
    ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key.
    /* For a cursor with the OPFLAG_SEEKEQ/BTREE_SEEK_EQ hint, only the
    ** OP_SeekGE and OP_SeekLE opcodes are allowed, and these must be
    ** immediately followed by an OP_IdxGT or OP_IdxLT opcode, respectively,
    ** with the same key.  There might be a single OP_SeekHit opcode in
    ** between the OP_SeekXX and OP_IdxXX.
    */
    if( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ) ){
      eqOnly = 1;
      eqOnly = 1 + (pOp[1].opcode==OP_SeekHit);
      assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE );
      assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
      assert( pOp[1].p1==pOp[0].p1 );
      assert( seekFollowedByPairedIdxCompare(pOp) );
      assert( pOp[1].p2==pOp[0].p2 );
      assert( pOp[1].p3==pOp[0].p3 );
      assert( pOp[1].p4.i==pOp[0].p4.i );
    }

    nField = pOp->p4.i;
    assert( pOp->p4type==P4_INT32 );
    assert( nField>0 );
    r.pKeyInfo = pC->pKeyInfo;
    r.nField = (u16)nField;
4096
4097
4098
4099
4100
4101
4102
4103
4104


4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116


4117
4118
4119
4120
4121
4122
4123
4124


4125
4126
4127
4128
4129
4130
4131
4141
4142
4143
4144
4145
4146
4147


4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159


4160
4161
4162
4163
4164
4165
4166
4167


4168
4169
4170
4171
4172
4173
4174
4175
4176







-
-
+
+










-
-
+
+






-
-
+
+







  }
seek_not_found:
  assert( pOp->p2>0 );
  VdbeBranchTaken(res!=0,2);
  if( res ){
    goto jump_to_p2;
  }else if( eqOnly ){
    assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
    pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
    assert( pOp[eqOnly].opcode==OP_IdxLT || pOp[eqOnly].opcode==OP_IdxGT );
    pOp += eqOnly; /* Skip the OP_IdxLt or OP_IdxGT that follows */
  }
  break;
}

/* Opcode: SeekHit P1 P2 * * *
** Synopsis: seekHit=P2
**
** Set the seekHit flag on cursor P1 to the value in P2.
** The seekHit flag is used by the IfNoHope opcode.
**
** P1 must be a valid b-tree cursor.  P2 must be a boolean value,
** either 0 or 1.
** P1 must be a valid b-tree cursor.  P2 must be an integer
** between 0 and 3.
*/
case OP_SeekHit: {
  VdbeCursor *pC;
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );
  assert( pOp->p2==0 || pOp->p2==1 );
  pC->seekHit = pOp->p2 & 1;
  assert( pOp->p2>=0 && pOp->p2<=3 );
  pC->seekHit = pOp->p2 & 3;
  break;
}

/* Opcode: Found P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4202
4203
4204
4205
4206
4207
4208



























4209
4210
4211
4212
4213
4214
4215







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







**
** This operation leaves the cursor in a state where it cannot be
** advanced in either direction.  In other words, the Next and Prev
** opcodes do not work after this operation.
**
** See also: Found, NotExists, NoConflict, IfNoHope
*/
/* Opcode: IfNoHope P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** Register P3 is the first of P4 registers that form an unpacked
** record.
**
** Cursor P1 is on an index btree.  If the seekHit flag is set on P1, then
** this opcode is a no-op.  But if the seekHit flag of P1 is clear, then
** check to see if there is any entry in P1 that matches the
** prefix identified by P3 and P4.  If no entry matches the prefix,
** jump to P2.  Otherwise fall through.
**
** This opcode behaves like OP_NotFound if the seekHit
** flag is clear and it behaves like OP_Noop if the seekHit flag is set.
**
** This opcode is used in IN clause processing for a multi-column key.
** If an IN clause is attached to an element of the key other than the
** left-most element, and if there are no matches on the most recent
** seek over the whole key, then it might be that one of the key element
** to the left is prohibiting a match, and hence there is "no hope" of
** any match regardless of how many IN clause elements are checked.
** In such a case, we abandon the IN clause search early, using this
** opcode.  The opcode name comes from the fact that the
** jump is taken if there is "no hope" of achieving a match.
**
** See also: NotFound, SeekHit
*/
/* Opcode: NoConflict P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If
** P4>0 then register P3 is the first of P4 registers that form an unpacked
** record.
** 
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237

4238
4239
4240
4241
4242
4243
4244
4225
4226
4227
4228
4229
4230
4231








4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255







-
-
-
-
-
-
-
-
















+







**
** This operation leaves the cursor in a state where it cannot be
** advanced in either direction.  In other words, the Next and Prev
** opcodes do not work after this operation.
**
** See also: NotFound, Found, NotExists
*/
case OP_IfNoHope: {     /* jump, in3 */
  VdbeCursor *pC;
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );
  if( pC->seekHit ) break;
  /* Fall through into OP_NotFound */
}
case OP_NoConflict:     /* jump, in3 */
case OP_NotFound:       /* jump, in3 */
case OP_Found: {        /* jump, in3 */
  int alreadyExists;
  int takeJump;
  int ii;
  VdbeCursor *pC;
  int res;
  UnpackedRecord *pFree;
  UnpackedRecord *pIdxKey;
  UnpackedRecord r;

#ifdef SQLITE_TEST
  if( pOp->opcode!=OP_NoConflict ) sqlite3_found_count++;
#endif

vdbe_op_notfound:    /* OP_IfNoHope jumps here, sometimes */
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  assert( pOp->p4type==P4_INT32 );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );
#ifdef SQLITE_DEBUG
  pC->seekOp = pOp->opcode;
#endif
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548




5549
5550
5551
5552

5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568


5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585


5586
5587
5588
5589
5590
5591
5592
5593
5594
5595

































































5596
5597
5598
5599
5600
5601
5602
5549
5550
5551
5552
5553
5554
5555




5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579

5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597

5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681







-
-
-
-
+
+
+
+




+















-
+
+
















-
+
+










+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







** key that omits the PRIMARY KEY or ROWID.  Compare this key value against
** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or
** ROWID on the P1 index.
**
** If the P1 index entry is less than or equal to the key value then jump
** to P2. Otherwise fall through to the next instruction.
*/
case OP_IdxLE:          /* jump */
case OP_IdxGT:          /* jump */
case OP_IdxLT:          /* jump */
case OP_IdxGE:  {       /* jump */
case OP_IdxLE:          /* jump, group */
case OP_IdxGT:          /* jump, group */
case OP_IdxLT:          /* jump, group */
case OP_IdxGE:  {       /* jump, group */
  VdbeCursor *pC;
  int res;
  UnpackedRecord r;

vdbe_op_idxne:          /* Virtual OP_IdxNE opcode.  See OP_IfNoHope */
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );
  assert( pC->isOrdered );
  assert( pC->eCurType==CURTYPE_BTREE );
  assert( pC->uc.pCursor!=0);
  assert( pC->deferredMoveto==0 );
  assert( pOp->p5==0 || pOp->p5==1 );
  assert( pOp->p4type==P4_INT32 );
  r.pKeyInfo = pC->pKeyInfo;
  r.nField = (u16)pOp->p4.i;
  if( pOp->opcode<OP_IdxLT ){
    assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );
    r.default_rc = -1;
  }else{
    assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT );
    assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT
           || pOp->opcode==OP_IfNoHope );
    r.default_rc = 0;
  }
  r.aMem = &aMem[pOp->p3];
#ifdef SQLITE_DEBUG
  {
    int i;
    for(i=0; i<r.nField; i++){
      assert( memIsValid(&r.aMem[i]) );
      REGISTER_TRACE(pOp->p3+i, &aMem[pOp->p3+i]);
    }
  }
#endif
  res = 0;  /* Not needed.  Only used to silence a warning. */
  rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
  assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );
  if( (pOp->opcode&1)==(OP_IdxLT&1) ){
    assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT );
    assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT
             || pOp->opcode==OP_IfNoHope );
    res = -res;
  }else{
    assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxGT );
    res++;
  }
  VdbeBranchTaken(res>0,2);
  if( rc ) goto abort_due_to_error;
  if( res>0 ) goto jump_to_p2;
  break;
}

/* Opcode: IfNoHope P1 P2 P3 P4 *
** Synopsis: key=r[P3@P4]
**
** Register P3 is the first of P4 registers that form an unpacked
** record.  P1 is number of an index-btree cursor.  P2 is a jump
** destination.  So, in other words, the operands to this opcode
** are the same as the operands to OP_NotFound and OP_IdxGT.
**
** The behavior of this opcode depends on the current seekFlag setting.
** (See the OP_SeekHit.)
**
** <ul>
** <li> seekHit==0 &rarr;  OP_NotFound
** <li> seekHit==1 &rarr;  OP_IdxGT or OP_IdxLT
** <li> seekHit==2 &rarr;  OP_Noop
** </ul>
**
** Actually, when seekHit==1, this routine behaves as if it were an
** OP_IdxNE opcode.  It has all the same parameters as OP_IdxGT and 
** OP_IdxLT, but the jump is taken if the key is not equal to the index
** record, rather than if the key is greater than or less than the
** index record, respectively.
**
** This opcode is used in IN clause processing for a multi-column key.
** If an IN clause is attached to an element of the key other than the
** left-most element, and if there are no matches on the most recent
** seek over the whole key, then it might be that one of the key element
** to the left is prohibiting a match, and hence there is "no hope" of
** any match regardless of how many IN clause elements are checked.
** In such a case, we abandon the IN clause search early, using this
** opcode.  The opcode name comes from the fact that the
** jump is taken if there is "no hope" of achieving a match.
**
** This opcode is an optimization.  It can always behave as OP_Noop
** and the correct result will still be obtained, though perhaps not
** quite as quickly.
**
** See also: NotFound, SeekHit, IdxGT
*/
case OP_IfNoHope: {     /* jump, in3, group */
  VdbeCursor *pC;
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  assert( pC!=0 );
  if( pC->seekHit>=2 ){
    /* There has been one or more successful OP_IdxXX opcodes ("successful"
    ** in the sense that the jump was not taken because the key and index
    ** matched).  So a match is possible.  We do not want to abort.  Fall
    ** through to the next opcode without doing anything. */
    break;
  }else if( pC->seekHit==1 ){
    /* The initial OP_SeekXX opcode was successful (in that it found a
    ** candidate row) but all subsequent OP_IdxXX opcodes failed.  The
    ** index should have been left pointing at the candidate row.  In this
    ** case, this opcode works like a "OP_IdxNE" opcode - similar to
    ** OP_IdxGT but instead of jumping if the index entry is greater than
    ** the key, it jumps if the index entry is not equal to the key.
    */
    goto vdbe_op_idxne;
  }
  /* The initial OP_SeekXX opcode took its jump, meaning that it found
  ** no candidate rows.  Treat this opcode as if it were an OP_NotFound */
  goto vdbe_op_notfound;
}

/* Opcode: Destroy P1 P2 P3 * *
**
** Delete an entire database table or index whose root page in the database
** file is given by P1.
**
** The table being destroyed is in the main database file if P3==0.  If
Changes to src/vdbeInt.h.
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95







-
+







#ifdef SQLITE_DEBUG
  u8 seekOp;              /* Most recent seek operation on this cursor */
  u8 wrFlag;              /* The wrFlag argument to sqlite3BtreeCursor() */
#endif
  Bool isEphemeral:1;     /* True for an ephemeral table */
  Bool useRandomRowid:1;  /* Generate new record numbers semi-randomly */
  Bool isOrdered:1;       /* True if the table is not BTREE_UNORDERED */
  Bool seekHit:1;         /* See the OP_SeekHit and OP_IfNoHope opcodes */
  unsigned seekHit:2;     /* See the OP_SeekHit and OP_IfNoHope opcodes */
  Btree *pBtx;            /* Separate file holding temporary table */
  i64 seqCount;           /* Sequence counter */
  int *aAltMap;           /* Mapping from table to index column numbers */

  /* Cached OP_Column parse information is only valid if cacheStatus matches
  ** Vdbe.cacheCtr.  Vdbe.cacheCtr will never take on the value of
  ** CACHE_STALE (0) and so setting cacheStatus=CACHE_STALE guarantees that
Changes to src/wherecode.c.
1734
1735
1736
1737
1738
1739
1740



1741
1742
1743
1744
1745
1746
1747
1748
1749
1750

1751
1752
1753
1754
1755
1756
1757
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752

1753
1754
1755
1756
1757
1758
1759
1760







+
+
+









-
+







    sqlite3DbFree(db, zEndAff);

    /* Top of the loop body */
    pLevel->p2 = sqlite3VdbeCurrentAddr(v);

    /* Check if the index cursor is past the end of the range. */
    if( nConstraint ){
      if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
        sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
      }
      op = aEndOp[bRev*2 + endEq];
      sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);
      testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );
      testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );
      testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );
      testcase( op==OP_IdxLE );  VdbeCoverageIf(v, op==OP_IdxLE );
    }

    if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
      sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 1);
      sqlite3VdbeAddOp2(v, OP_SeekHit, iIdxCur, 2);
    }

    /* Seek the table cursor, if required */
    omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0 
           && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
    if( omitTable ){
      /* pIdx is a covering index.  No need to access the main table. */