Skip to content

Attribute SQLite database size by object and page usage #4888

Description

@Widthdom

Summary

A 583 MB DB reports roughly 42 MB free and about 193 MB logical object size, leaving hundreds of MB unattributed without table/index/page/WAL breakdown.

Audit IDs: O-23. Reproduced with locally built cdidx v1.40.3 at 404db09489c305f17d94f37026e00564d3ac527a.

Existing issue relationship

Follow-up adjacent to closed #4338's maintenance diagnostics.

Expected behavior and PR scope

Provide bounded, machine-readable page attribution for tables, indexes, free/reclaimable pages, WAL, and overhead, with a clear unavailable fallback. Keep this diagnostic/read-only.

Implementation guide for Codex 5.6 sol xhigh

  • Use SQLite dbstat/page pragmas where supported and define units/rounding explicitly.
  • Separate main DB, WAL/SHM, freelist, allocated object pages, internal/overflow, and unexplained residual.
  • Apply redaction and byte limits; aggregate/top-N rather than dumping every page.
  • Cover empty/small/large DBs, WAL mode, dbstat unavailable, corruption/read-only, and Windows file sizing.
  • Add focused regression/contract tests, run the full net8.0 and net9.0 suite, and add the required bilingual changelog.d/unreleased/ fragment.

Acceptance criteria

  • Reported categories reconcile to file/allocation totals within documented bounds.
  • Unavailability is explicit, not zero.
  • No diagnostic mutates the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codeenhancementNew feature or requestperformance

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions