SQL BenchMEASURED, NOT GUESSED

    ↑↓ to select, Enter to open, Esc to close

    sqlite3.Row is ~1.09× slower than tuple (default)

    Setting `row_factory=Row` makes fetching 20,000 rows ~9% slower — the cost of name-based access.

    Result

    Runsqlite3.Rowtuple (default)Ratio
    Run 127.69024.5691.13×
    Run 226.86625.3011.06×
    Run 326.68524.3991.09×

    Spread over 3 runs: sqlite3.Row CV 1.6% / tuple (default) CV 1.6% / Ratio CV 2.4%

    sqlite3.Row: 27.69mstuple (default): 24.57msRun1sqlite3.Row: 26.87mstuple (default): 25.30msRun2sqlite3.Row: 26.68mstuple (default): 24.40msRun3

    The statement

    con.row_factory = sqlite3.Row
    rows = con.execute('SELECT id,name,score FROM items LIMIT 20000').fetchall()
    rows = con.execute('SELECT id,name,score FROM items LIMIT 20000').fetchall()

    Conditions

    20,000 rows fetched with `fetchall()`, three columns.

    Where this number does not apply

    With few rows the difference is lost in noise.

    Reproduce

    cd bench && python sqbench.py --samples 9 --out ../data/run.json