Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | More optimizations to sqlite3BtreeMovetoUnpacked(). But there are failures in TH3. Committing this intermediate state to facilitate bisecting. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | btree-optimization |
Files: | files | file ages | folders |
SHA1: |
f80497be446f84d2000e454e32d71788 |
User & Date: | drh 2013-11-25 15:01:38.218 |
Context
2013-11-25
| ||
16:23 | Arrange for sqlite3BtreeMovetoUnpacked() to always leave the cursor cell parse cache invalidated. This fixes issues with previous check-ins on this branch and also runs faster. (check-in: a74675607f user: drh tags: btree-optimization) | |
15:01 | More optimizations to sqlite3BtreeMovetoUnpacked(). But there are failures in TH3. Committing this intermediate state to facilitate bisecting. (check-in: f80497be44 user: drh tags: btree-optimization) | |
14:10 | More improvements to sqlite3BtreeMovetoUnpacked() performance. (check-in: 8868069823 user: drh tags: btree-optimization) | |
Changes
Changes to src/btree.c.
︙ | ︙ | |||
4658 4659 4660 4661 4662 4663 4664 | ** would have already detected db corruption. Similarly, pPage must ** be the right kind (index or table) of b-tree page. Otherwise ** a moveToChild() or moveToRoot() call would have detected corruption. */ assert( pPage->nCell>0 ); assert( pPage->intKey==(pIdxKey==0) ); lwr = 0; upr = pPage->nCell-1; | | | > > > > > > > > < < < < < < < < < < | 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 | ** would have already detected db corruption. Similarly, pPage must ** be the right kind (index or table) of b-tree page. Otherwise ** a moveToChild() or moveToRoot() call would have detected corruption. */ assert( pPage->nCell>0 ); assert( pPage->intKey==(pIdxKey==0) ); lwr = 0; upr = pPage->nCell-1; idx = biasRight ? upr : upr/2; pCur->aiIdx[pCur->iPage] = (u16)idx; pCur->info.nSize = 0; if( pPage->intKey ){ for(;;){ i64 nCellKey; pCell = findCell(pPage, idx) + pPage->childPtrSize; if( pPage->hasData ){ u32 dummy; pCell += getVarint32(pCell, dummy); } getVarint(pCell, (u64*)&nCellKey); if( nCellKey<intKey ){ lwr = idx+1; if( lwr>upr ){ c = -1; break; } }else if( nCellKey>intKey ){ upr = idx-1; if( lwr>upr ){ c = +1; break; } }else{ assert( nCellKey==intKey ); pCur->validNKey = 1; pCur->info.nKey = nCellKey; pCur->aiIdx[pCur->iPage] = (u16)idx; if( !pPage->leaf ){ lwr = idx; c = 0; break; }else{ *pRes = 0; rc = SQLITE_OK; goto moveto_finish; } } idx = (lwr+upr)/2; } }else{ for(;;){ int nCell; pCell = findCell(pPage, idx) + pPage->childPtrSize; |
︙ | ︙ | |||
4748 4749 4750 4751 4752 4753 4754 | if( rc ){ sqlite3_free(pCellKey); goto moveto_finish; } c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); sqlite3_free(pCellKey); } | > > > > > | < < < < < < > | 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 | if( rc ){ sqlite3_free(pCellKey); goto moveto_finish; } c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); sqlite3_free(pCellKey); } if( c<0 ){ lwr = idx+1; }else if( c>0 ){ upr = idx-1; }else{ assert( c==0 ); *pRes = 0; rc = SQLITE_OK; pCur->aiIdx[pCur->iPage] = (u16)idx; goto moveto_finish; } if( lwr>upr ){ break; } idx = (lwr+upr)/2; } } assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) ); assert( pPage->isInit ); if( pPage->leaf ){ assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell ); pCur->aiIdx[pCur->iPage] = (u16)idx; *pRes = c; rc = SQLITE_OK; goto moveto_finish; }else if( lwr>=pPage->nCell ){ chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]); }else{ chldPg = get4byte(findCell(pPage, lwr)); |
︙ | ︙ |