Fossil SCM

Update the built-in SQLite to the latest 3.14 alpha version, for testing.

drh 2016-07-28 14:07 trunk
Commit 84f55ef7f084995d60960524a4fbd43d80db57c9
2 files changed +91 -8 +1 -1
+91 -8
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -363,11 +363,11 @@
363363
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
364364
** [sqlite_version()] and [sqlite_source_id()].
365365
*/
366366
#define SQLITE_VERSION "3.14.0"
367367
#define SQLITE_VERSION_NUMBER 3014000
368
-#define SQLITE_SOURCE_ID "2016-07-25 12:10:25 d6f6c87c9c0acf609a9d5bea818bb7a5437109a1"
368
+#define SQLITE_SOURCE_ID "2016-07-28 12:52:30 6feff15cae8f0427be790355841d49c479c1c586"
369369
370370
/*
371371
** CAPI3REF: Run-Time Library Version Numbers
372372
** KEYWORDS: sqlite3_version, sqlite3_sourceid
373373
**
@@ -15834,10 +15834,11 @@
1583415834
int iCur; /* A cursor number */
1583515835
SrcList *pSrcList; /* FROM clause */
1583615836
struct SrcCount *pSrcCount; /* Counting column references */
1583715837
struct CCurHint *pCCurHint; /* Used by codeCursorHint() */
1583815838
int *aiCol; /* array of column indexes */
15839
+ struct IdxCover *pIdxCover; /* Check for index coverage */
1583915840
} u;
1584015841
};
1584115842
1584215843
/* Forward declarations */
1584315844
SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
@@ -16277,10 +16278,11 @@
1627716278
SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
1627816279
SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
1627916280
SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
1628016281
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
1628116282
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
16283
+SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
1628216284
SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*);
1628316285
SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);
1628416286
#ifndef SQLITE_OMIT_BUILTIN_TEST
1628516287
SQLITE_PRIVATE void sqlite3PrngSaveState(void);
1628616288
SQLITE_PRIVATE void sqlite3PrngRestoreState(void);
@@ -93355,10 +93357,65 @@
9335593357
){
9335693358
return 1;
9335793359
}
9335893360
return 0;
9335993361
}
93362
+
93363
+/*
93364
+** An instance of the following structure is used by the tree walker
93365
+** to determine if an expression can be evaluated by reference to the
93366
+** index only, without having to do a search for the corresponding
93367
+** table entry. The IdxCover.pIdx field is the index. IdxCover.iCur
93368
+** is the cursor for the table.
93369
+*/
93370
+struct IdxCover {
93371
+ Index *pIdx; /* The index to be tested for coverage */
93372
+ int iCur; /* Cursor number for the table corresponding to the index */
93373
+};
93374
+
93375
+/*
93376
+** Check to see if there are references to columns in table
93377
+** pWalker->u.pIdxCover->iCur can be satisfied using the index
93378
+** pWalker->u.pIdxCover->pIdx.
93379
+*/
93380
+static int exprIdxCover(Walker *pWalker, Expr *pExpr){
93381
+ if( pExpr->op==TK_COLUMN
93382
+ && pExpr->iTable==pWalker->u.pIdxCover->iCur
93383
+ && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0
93384
+ ){
93385
+ pWalker->eCode = 1;
93386
+ return WRC_Abort;
93387
+ }
93388
+ return WRC_Continue;
93389
+}
93390
+
93391
+/*
93392
+** Determine if an index pIdx on table with cursor iCur contains will
93393
+** the expression pExpr. Return true if the index does cover the
93394
+** expression and false if the pExpr expression references table columns
93395
+** that are not found in the index pIdx.
93396
+**
93397
+** An index covering an expression means that the expression can be
93398
+** evaluated using only the index and without having to lookup the
93399
+** corresponding table entry.
93400
+*/
93401
+SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(
93402
+ Expr *pExpr, /* The index to be tested */
93403
+ int iCur, /* The cursor number for the corresponding table */
93404
+ Index *pIdx /* The index that might be used for coverage */
93405
+){
93406
+ Walker w;
93407
+ struct IdxCover xcov;
93408
+ memset(&w, 0, sizeof(w));
93409
+ xcov.iCur = iCur;
93410
+ xcov.pIdx = pIdx;
93411
+ w.xExprCallback = exprIdxCover;
93412
+ w.u.pIdxCover = &xcov;
93413
+ sqlite3WalkExpr(&w, pExpr);
93414
+ return !w.eCode;
93415
+}
93416
+
9336093417
9336193418
/*
9336293419
** An instance of the following structure is used by the tree walker
9336393420
** to count references to table columns in the arguments of an
9336493421
** aggregate function, in order to implement the
@@ -121357,10 +121414,12 @@
121357121414
sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
121358121415
if( nKey ) db->nextPagesize = 0;
121359121416
}
121360121417
#endif
121361121418
121419
+ sqlite3BtreeSetCacheSize(pTemp, db->aDb[0].pSchema->cache_size);
121420
+ sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
121362121421
rc = execSql(db, pzErrMsg, "PRAGMA vacuum_db.synchronous=OFF");
121363121422
if( rc!=SQLITE_OK ) goto end_of_vacuum;
121364121423
121365121424
/* Begin a transaction and take an exclusive lock on the main database
121366121425
** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,
@@ -124633,10 +124692,11 @@
124633124692
zStartAff[nEq] = SQLITE_AFF_BLOB;
124634124693
}
124635124694
}
124636124695
nConstraint++;
124637124696
testcase( pRangeStart->wtFlags & TERM_VIRTUAL );
124697
+ bSeekPastNull = 0;
124638124698
}else if( bSeekPastNull ){
124639124699
sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
124640124700
nConstraint++;
124641124701
startEq = 0;
124642124702
start_constraints = 1;
@@ -129003,15 +129063,15 @@
129003129063
LogEst nIter;
129004129064
pNew->u.btree.nEq++;
129005129065
pNew->nSkip++;
129006129066
pNew->aLTerm[pNew->nLTerm++] = 0;
129007129067
pNew->wsFlags |= WHERE_SKIPSCAN;
129008
- nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
129068
+ nIter = pProbe->aiRowLogEst[saved_nEq]+1 - pProbe->aiRowLogEst[saved_nEq+1];
129009129069
pNew->nOut -= nIter;
129010129070
/* TUNING: Because uncertainties in the estimates for skip-scan queries,
129011129071
** add a 1.375 fudge factor to make skip-scan slightly less likely. */
129012
- nIter += 5;
129072
+ nIter += 4;
129013129073
whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
129014129074
pNew->nOut = saved_nOut;
129015129075
pNew->u.btree.nEq = saved_nEq;
129016129076
pNew->nSkip = saved_nSkip;
129017129077
pNew->wsFlags = saved_wsFlags;
@@ -129300,15 +129360,38 @@
129300129360
){
129301129361
pNew->iSortIdx = b ? iSortIdx : 0;
129302129362
129303129363
/* The cost of visiting the index rows is N*K, where K is
129304129364
** between 1.1 and 3.0, depending on the relative sizes of the
129305
- ** index and table rows. If this is a non-covering index scan,
129306
- ** also add the cost of visiting table rows (N*3.0). */
129365
+ ** index and table rows. */
129307129366
pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;
129308129367
if( m!=0 ){
129309
- pNew->rRun = sqlite3LogEstAdd(pNew->rRun, rSize+16);
129368
+ /* If this is a non-covering index scan, add in the cost of
129369
+ ** doing table lookups. The cost will be 3x the number of
129370
+ ** lookups. Take into account WHERE clause terms that can be
129371
+ ** satisfied using just the index, and that do not require a
129372
+ ** table lookup. */
129373
+ LogEst nLookup = rSize + 16; /* Base cost: N*3 */
129374
+ int ii;
129375
+ int iCur = pSrc->iCursor;
129376
+ WhereClause *pWC = &pWInfo->sWC;
129377
+ for(ii=0; ii<pWC->nTerm; ii++){
129378
+ WhereTerm *pTerm = &pWC->a[ii];
129379
+ if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){
129380
+ break;
129381
+ }
129382
+ /* pTerm can be evaluated using just the index. So reduce
129383
+ ** the expected number of table lookups accordingly */
129384
+ if( pTerm->truthProb<=0 ){
129385
+ nLookup += pTerm->truthProb;
129386
+ }else{
129387
+ nLookup--;
129388
+ if( pTerm->eOperator & (WO_EQ|WO_IS) ) nLookup -= 19;
129389
+ }
129390
+ }
129391
+
129392
+ pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup);
129310129393
}
129311129394
ApplyCostMultiplier(pNew->rRun, pTab->costMult);
129312129395
whereLoopOutputAdjust(pWC, pNew, rSize);
129313129396
rc = whereLoopInsert(pBuilder, pNew);
129314129397
pNew->nOut = rSize;
@@ -130474,11 +130557,11 @@
130474130557
pWInfo->nOBSat = pFrom->isOrdered;
130475130558
pWInfo->revMask = pFrom->revLoop;
130476130559
if( pWInfo->nOBSat<=0 ){
130477130560
pWInfo->nOBSat = 0;
130478130561
if( nLoop>0 ){
130479
- Bitmask m;
130562
+ Bitmask m = 0;
130480130563
int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,
130481130564
WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m);
130482130565
if( rc==pWInfo->pOrderBy->nExpr ){
130483130566
pWInfo->bOrderedInnerLoop = 1;
130484130567
pWInfo->revMask = m;
@@ -193812,11 +193895,11 @@
193812193895
int nArg, /* Number of args */
193813193896
sqlite3_value **apUnused /* Function arguments */
193814193897
){
193815193898
assert( nArg==0 );
193816193899
UNUSED_PARAM2(nArg, apUnused);
193817
- sqlite3_result_text(pCtx, "fts5: 2016-07-25 11:39:24 5f40e6ad599eea59a5adc3a11d6f7998872736b4", -1, SQLITE_TRANSIENT);
193900
+ sqlite3_result_text(pCtx, "fts5: 2016-07-26 10:46:21 483994a54dee3c7a3801e0e9d3c96fa9dbd8d2fd", -1, SQLITE_TRANSIENT);
193818193901
}
193819193902
193820193903
static int fts5Init(sqlite3 *db){
193821193904
static const sqlite3_module fts5Mod = {
193822193905
/* iVersion */ 2,
193823193906
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -363,11 +363,11 @@
363 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
364 ** [sqlite_version()] and [sqlite_source_id()].
365 */
366 #define SQLITE_VERSION "3.14.0"
367 #define SQLITE_VERSION_NUMBER 3014000
368 #define SQLITE_SOURCE_ID "2016-07-25 12:10:25 d6f6c87c9c0acf609a9d5bea818bb7a5437109a1"
369
370 /*
371 ** CAPI3REF: Run-Time Library Version Numbers
372 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
373 **
@@ -15834,10 +15834,11 @@
15834 int iCur; /* A cursor number */
15835 SrcList *pSrcList; /* FROM clause */
15836 struct SrcCount *pSrcCount; /* Counting column references */
15837 struct CCurHint *pCCurHint; /* Used by codeCursorHint() */
15838 int *aiCol; /* array of column indexes */
 
15839 } u;
15840 };
15841
15842 /* Forward declarations */
15843 SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
@@ -16277,10 +16278,11 @@
16277 SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
16278 SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
16279 SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
16280 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
16281 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
 
16282 SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*);
16283 SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);
16284 #ifndef SQLITE_OMIT_BUILTIN_TEST
16285 SQLITE_PRIVATE void sqlite3PrngSaveState(void);
16286 SQLITE_PRIVATE void sqlite3PrngRestoreState(void);
@@ -93355,10 +93357,65 @@
93355 ){
93356 return 1;
93357 }
93358 return 0;
93359 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93360
93361 /*
93362 ** An instance of the following structure is used by the tree walker
93363 ** to count references to table columns in the arguments of an
93364 ** aggregate function, in order to implement the
@@ -121357,10 +121414,12 @@
121357 sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
121358 if( nKey ) db->nextPagesize = 0;
121359 }
121360 #endif
121361
 
 
121362 rc = execSql(db, pzErrMsg, "PRAGMA vacuum_db.synchronous=OFF");
121363 if( rc!=SQLITE_OK ) goto end_of_vacuum;
121364
121365 /* Begin a transaction and take an exclusive lock on the main database
121366 ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,
@@ -124633,10 +124692,11 @@
124633 zStartAff[nEq] = SQLITE_AFF_BLOB;
124634 }
124635 }
124636 nConstraint++;
124637 testcase( pRangeStart->wtFlags & TERM_VIRTUAL );
 
124638 }else if( bSeekPastNull ){
124639 sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
124640 nConstraint++;
124641 startEq = 0;
124642 start_constraints = 1;
@@ -129003,15 +129063,15 @@
129003 LogEst nIter;
129004 pNew->u.btree.nEq++;
129005 pNew->nSkip++;
129006 pNew->aLTerm[pNew->nLTerm++] = 0;
129007 pNew->wsFlags |= WHERE_SKIPSCAN;
129008 nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];
129009 pNew->nOut -= nIter;
129010 /* TUNING: Because uncertainties in the estimates for skip-scan queries,
129011 ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
129012 nIter += 5;
129013 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
129014 pNew->nOut = saved_nOut;
129015 pNew->u.btree.nEq = saved_nEq;
129016 pNew->nSkip = saved_nSkip;
129017 pNew->wsFlags = saved_wsFlags;
@@ -129300,15 +129360,38 @@
129300 ){
129301 pNew->iSortIdx = b ? iSortIdx : 0;
129302
129303 /* The cost of visiting the index rows is N*K, where K is
129304 ** between 1.1 and 3.0, depending on the relative sizes of the
129305 ** index and table rows. If this is a non-covering index scan,
129306 ** also add the cost of visiting table rows (N*3.0). */
129307 pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;
129308 if( m!=0 ){
129309 pNew->rRun = sqlite3LogEstAdd(pNew->rRun, rSize+16);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129310 }
129311 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
129312 whereLoopOutputAdjust(pWC, pNew, rSize);
129313 rc = whereLoopInsert(pBuilder, pNew);
129314 pNew->nOut = rSize;
@@ -130474,11 +130557,11 @@
130474 pWInfo->nOBSat = pFrom->isOrdered;
130475 pWInfo->revMask = pFrom->revLoop;
130476 if( pWInfo->nOBSat<=0 ){
130477 pWInfo->nOBSat = 0;
130478 if( nLoop>0 ){
130479 Bitmask m;
130480 int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,
130481 WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m);
130482 if( rc==pWInfo->pOrderBy->nExpr ){
130483 pWInfo->bOrderedInnerLoop = 1;
130484 pWInfo->revMask = m;
@@ -193812,11 +193895,11 @@
193812 int nArg, /* Number of args */
193813 sqlite3_value **apUnused /* Function arguments */
193814 ){
193815 assert( nArg==0 );
193816 UNUSED_PARAM2(nArg, apUnused);
193817 sqlite3_result_text(pCtx, "fts5: 2016-07-25 11:39:24 5f40e6ad599eea59a5adc3a11d6f7998872736b4", -1, SQLITE_TRANSIENT);
193818 }
193819
193820 static int fts5Init(sqlite3 *db){
193821 static const sqlite3_module fts5Mod = {
193822 /* iVersion */ 2,
193823
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -363,11 +363,11 @@
363 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
364 ** [sqlite_version()] and [sqlite_source_id()].
365 */
366 #define SQLITE_VERSION "3.14.0"
367 #define SQLITE_VERSION_NUMBER 3014000
368 #define SQLITE_SOURCE_ID "2016-07-28 12:52:30 6feff15cae8f0427be790355841d49c479c1c586"
369
370 /*
371 ** CAPI3REF: Run-Time Library Version Numbers
372 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
373 **
@@ -15834,10 +15834,11 @@
15834 int iCur; /* A cursor number */
15835 SrcList *pSrcList; /* FROM clause */
15836 struct SrcCount *pSrcCount; /* Counting column references */
15837 struct CCurHint *pCCurHint; /* Used by codeCursorHint() */
15838 int *aiCol; /* array of column indexes */
15839 struct IdxCover *pIdxCover; /* Check for index coverage */
15840 } u;
15841 };
15842
15843 /* Forward declarations */
15844 SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
@@ -16277,10 +16278,11 @@
16278 SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
16279 SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
16280 SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
16281 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
16282 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
16283 SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
16284 SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*);
16285 SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);
16286 #ifndef SQLITE_OMIT_BUILTIN_TEST
16287 SQLITE_PRIVATE void sqlite3PrngSaveState(void);
16288 SQLITE_PRIVATE void sqlite3PrngRestoreState(void);
@@ -93355,10 +93357,65 @@
93357 ){
93358 return 1;
93359 }
93360 return 0;
93361 }
93362
93363 /*
93364 ** An instance of the following structure is used by the tree walker
93365 ** to determine if an expression can be evaluated by reference to the
93366 ** index only, without having to do a search for the corresponding
93367 ** table entry. The IdxCover.pIdx field is the index. IdxCover.iCur
93368 ** is the cursor for the table.
93369 */
93370 struct IdxCover {
93371 Index *pIdx; /* The index to be tested for coverage */
93372 int iCur; /* Cursor number for the table corresponding to the index */
93373 };
93374
93375 /*
93376 ** Check to see if there are references to columns in table
93377 ** pWalker->u.pIdxCover->iCur can be satisfied using the index
93378 ** pWalker->u.pIdxCover->pIdx.
93379 */
93380 static int exprIdxCover(Walker *pWalker, Expr *pExpr){
93381 if( pExpr->op==TK_COLUMN
93382 && pExpr->iTable==pWalker->u.pIdxCover->iCur
93383 && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0
93384 ){
93385 pWalker->eCode = 1;
93386 return WRC_Abort;
93387 }
93388 return WRC_Continue;
93389 }
93390
93391 /*
93392 ** Determine if an index pIdx on table with cursor iCur contains will
93393 ** the expression pExpr. Return true if the index does cover the
93394 ** expression and false if the pExpr expression references table columns
93395 ** that are not found in the index pIdx.
93396 **
93397 ** An index covering an expression means that the expression can be
93398 ** evaluated using only the index and without having to lookup the
93399 ** corresponding table entry.
93400 */
93401 SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(
93402 Expr *pExpr, /* The index to be tested */
93403 int iCur, /* The cursor number for the corresponding table */
93404 Index *pIdx /* The index that might be used for coverage */
93405 ){
93406 Walker w;
93407 struct IdxCover xcov;
93408 memset(&w, 0, sizeof(w));
93409 xcov.iCur = iCur;
93410 xcov.pIdx = pIdx;
93411 w.xExprCallback = exprIdxCover;
93412 w.u.pIdxCover = &xcov;
93413 sqlite3WalkExpr(&w, pExpr);
93414 return !w.eCode;
93415 }
93416
93417
93418 /*
93419 ** An instance of the following structure is used by the tree walker
93420 ** to count references to table columns in the arguments of an
93421 ** aggregate function, in order to implement the
@@ -121357,10 +121414,12 @@
121414 sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
121415 if( nKey ) db->nextPagesize = 0;
121416 }
121417 #endif
121418
121419 sqlite3BtreeSetCacheSize(pTemp, db->aDb[0].pSchema->cache_size);
121420 sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
121421 rc = execSql(db, pzErrMsg, "PRAGMA vacuum_db.synchronous=OFF");
121422 if( rc!=SQLITE_OK ) goto end_of_vacuum;
121423
121424 /* Begin a transaction and take an exclusive lock on the main database
121425 ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,
@@ -124633,10 +124692,11 @@
124692 zStartAff[nEq] = SQLITE_AFF_BLOB;
124693 }
124694 }
124695 nConstraint++;
124696 testcase( pRangeStart->wtFlags & TERM_VIRTUAL );
124697 bSeekPastNull = 0;
124698 }else if( bSeekPastNull ){
124699 sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
124700 nConstraint++;
124701 startEq = 0;
124702 start_constraints = 1;
@@ -129003,15 +129063,15 @@
129063 LogEst nIter;
129064 pNew->u.btree.nEq++;
129065 pNew->nSkip++;
129066 pNew->aLTerm[pNew->nLTerm++] = 0;
129067 pNew->wsFlags |= WHERE_SKIPSCAN;
129068 nIter = pProbe->aiRowLogEst[saved_nEq]+1 - pProbe->aiRowLogEst[saved_nEq+1];
129069 pNew->nOut -= nIter;
129070 /* TUNING: Because uncertainties in the estimates for skip-scan queries,
129071 ** add a 1.375 fudge factor to make skip-scan slightly less likely. */
129072 nIter += 4;
129073 whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);
129074 pNew->nOut = saved_nOut;
129075 pNew->u.btree.nEq = saved_nEq;
129076 pNew->nSkip = saved_nSkip;
129077 pNew->wsFlags = saved_wsFlags;
@@ -129300,15 +129360,38 @@
129360 ){
129361 pNew->iSortIdx = b ? iSortIdx : 0;
129362
129363 /* The cost of visiting the index rows is N*K, where K is
129364 ** between 1.1 and 3.0, depending on the relative sizes of the
129365 ** index and table rows. */
 
129366 pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;
129367 if( m!=0 ){
129368 /* If this is a non-covering index scan, add in the cost of
129369 ** doing table lookups. The cost will be 3x the number of
129370 ** lookups. Take into account WHERE clause terms that can be
129371 ** satisfied using just the index, and that do not require a
129372 ** table lookup. */
129373 LogEst nLookup = rSize + 16; /* Base cost: N*3 */
129374 int ii;
129375 int iCur = pSrc->iCursor;
129376 WhereClause *pWC = &pWInfo->sWC;
129377 for(ii=0; ii<pWC->nTerm; ii++){
129378 WhereTerm *pTerm = &pWC->a[ii];
129379 if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){
129380 break;
129381 }
129382 /* pTerm can be evaluated using just the index. So reduce
129383 ** the expected number of table lookups accordingly */
129384 if( pTerm->truthProb<=0 ){
129385 nLookup += pTerm->truthProb;
129386 }else{
129387 nLookup--;
129388 if( pTerm->eOperator & (WO_EQ|WO_IS) ) nLookup -= 19;
129389 }
129390 }
129391
129392 pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup);
129393 }
129394 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
129395 whereLoopOutputAdjust(pWC, pNew, rSize);
129396 rc = whereLoopInsert(pBuilder, pNew);
129397 pNew->nOut = rSize;
@@ -130474,11 +130557,11 @@
130557 pWInfo->nOBSat = pFrom->isOrdered;
130558 pWInfo->revMask = pFrom->revLoop;
130559 if( pWInfo->nOBSat<=0 ){
130560 pWInfo->nOBSat = 0;
130561 if( nLoop>0 ){
130562 Bitmask m = 0;
130563 int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,
130564 WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m);
130565 if( rc==pWInfo->pOrderBy->nExpr ){
130566 pWInfo->bOrderedInnerLoop = 1;
130567 pWInfo->revMask = m;
@@ -193812,11 +193895,11 @@
193895 int nArg, /* Number of args */
193896 sqlite3_value **apUnused /* Function arguments */
193897 ){
193898 assert( nArg==0 );
193899 UNUSED_PARAM2(nArg, apUnused);
193900 sqlite3_result_text(pCtx, "fts5: 2016-07-26 10:46:21 483994a54dee3c7a3801e0e9d3c96fa9dbd8d2fd", -1, SQLITE_TRANSIENT);
193901 }
193902
193903 static int fts5Init(sqlite3 *db){
193904 static const sqlite3_module fts5Mod = {
193905 /* iVersion */ 2,
193906
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -111,11 +111,11 @@
111111
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112112
** [sqlite_version()] and [sqlite_source_id()].
113113
*/
114114
#define SQLITE_VERSION "3.14.0"
115115
#define SQLITE_VERSION_NUMBER 3014000
116
-#define SQLITE_SOURCE_ID "2016-07-25 12:10:25 d6f6c87c9c0acf609a9d5bea818bb7a5437109a1"
116
+#define SQLITE_SOURCE_ID "2016-07-28 12:52:30 6feff15cae8f0427be790355841d49c479c1c586"
117117
118118
/*
119119
** CAPI3REF: Run-Time Library Version Numbers
120120
** KEYWORDS: sqlite3_version, sqlite3_sourceid
121121
**
122122
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -111,11 +111,11 @@
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.14.0"
115 #define SQLITE_VERSION_NUMBER 3014000
116 #define SQLITE_SOURCE_ID "2016-07-25 12:10:25 d6f6c87c9c0acf609a9d5bea818bb7a5437109a1"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
122
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -111,11 +111,11 @@
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.14.0"
115 #define SQLITE_VERSION_NUMBER 3014000
116 #define SQLITE_SOURCE_ID "2016-07-28 12:52:30 6feff15cae8f0427be790355841d49c479c1c586"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
122

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button