SQLite Forum

Welcome
Login
Hello, Richard Hipp, about ANALYZE, I have a question, why can't call sqlite3BtreeRowCountEst() for tables with only rowid without other indexes?
I think invoking sqlite3BtreeRowCountEst() increases efficiency for large table.
See code comments:
static void analyzeOneTable(){
...
    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
        ...
        addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);
        VdbeCoverage(v);
        sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, 1); //will call sqlite3BtreeRowCountEst()
    }
    ...
    if( pOnlyIdx==0 && needTableCnt ){
        ...
        VdbeComment((v, "%s", pTab->zName));
        sqlite3VdbeAddOp2(v, OP_Count, iTabCur, regStat1); //will call sqlite3BtreeCount()
        jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); VdbeCoverage(v)
    }
}