diff options
author | drh <drh@noemail.net> | 2013-11-06 19:59:23 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-11-06 19:59:23 +0000 |
commit | 2ec2fb22691de00e3da209a77bfac13c446a9cd4 (patch) | |
tree | 830583df7f15ab65a14718994973e1113622f551 /src/analyze.c | |
parent | 93889d9335b48edb943424331269b1d47a0c70ab (diff) | |
download | sqlite-2ec2fb22691de00e3da209a77bfac13c446a9cd4.tar.gz sqlite-2ec2fb22691de00e3da209a77bfac13c446a9cd4.zip |
Reference count the KeyInfo object. Cache a copy of an appropriate KeyInfo
for each index in the Index object, and reuse that one copy as much as possible.
FossilOrigin-Name: defd5205a7cc3543cdd18f906f568e943b8b3a2c
Diffstat (limited to 'src/analyze.c')
-rw-r--r-- | src/analyze.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/analyze.c b/src/analyze.c index 5ed9078c0..f1094f79f 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -988,7 +988,6 @@ static void analyzeOneTable( for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int nCol; /* Number of columns indexed by pIdx */ - KeyInfo *pKey; /* KeyInfo structure for pIdx */ int *aGotoChng; /* Array of jump instruction addresses */ int addrRewind; /* Address of "OP_Rewind iIdxCur" */ int addrGotoChng0; /* Address of "Goto addr_chng_0" */ @@ -1001,7 +1000,6 @@ static void analyzeOneTable( nCol = pIdx->nKeyCol; aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*(nCol+1)); if( aGotoChng==0 ) continue; - pKey = sqlite3IndexKeyinfo(pParse, pIdx); /* Populate the register containing the index name. */ if( pIdx->autoIndex==2 && !HasRowid(pTab) ){ @@ -1052,7 +1050,7 @@ static void analyzeOneTable( /* Open a read-only cursor on the index being analyzed. */ assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb); - sqlite3VdbeChangeP4(v, -1, (char*)pKey, P4_KEYINFO_HANDOFF); + sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "%s", pIdx->zName)); /* Invoke the stat_init() function. The arguments are: |