Skip to content

Cache total_count for DuckLake-cached endpoints #242

Closed

Description

@jrosskopf

Found during the DuckDB 2.0 upgrade (#241).

On a DuckLake-cached endpoint the COUNT(*) for total_count costs about as much as the page query (7-17 ms on 2.0.1, mostly DuckLake per-query metadata). The count cannot change between refreshes.

Proposal: cache total_count keyed by rendered SQL + bound values + a per-endpoint refresh generation counter (bumped on every refresh), LRU-capped (~10k entries, ~2.5 MB). Exact between refreshes.

Measured prototype (real binary over HTTP, 2.0.1): +25% on an unfiltered 2M-row cached endpoint at 64 clients, +18-45% on filtered cached endpoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions