What a fit report tells you

PgCache serves a query from its own copy of your data only when it can prove the answer is correct. The Fit Analyzer runs that same decision over a real trace of your workload and reports what it found, so you know the answer before you put anything in front of your database.

It reads a pg_stat_statements export, a PostgreSQL log, or a plain .sql file. The analysis runs in your browser as WebAssembly: no account, no upload, and no query text leaves the tab.

The four verdicts

Every statement lands in one of four buckets.

  • Cacheable. PgCache can serve this from the working set it keeps, tracking changes through PostgreSQL logical replication.
  • Forwarded to origin. PgCache passes the query straight through to your database. The report names the reason: a system catalog reference, a non-immutable function such as now(), an unsupported FROM clause.
  • Writes. These always go to your primary. PgCache follows them to keep cached rows in step.
  • Transaction and session commands. BEGIN, SET and similar. They pass through.

Why pg_stat_statements is the best input

A .sql file tells you which query shapes are cacheable. A pg_stat_statements export tells you which ones matter, because it carries call counts and total execution time alongside each shape.

The two answers are rarely the same. The sample workload on this page is 29% cacheable counted by statement, and 62% counted by database time, because the heavy reads are the cacheable ones. Only the second number predicts what you would actually offload. The report lets you switch between statements, calls and database time.

A PostgreSQL csvlog goes one step further: it preserves the order queries arrived in, which is what the hit-rate estimate needs.

What it will not tell you

The analyzer reasons about the SQL, not about your data or your security model. It cannot see Row-Level Security policies, which PgCache does not yet support, and it assumes a schema inferred from the queries themselves rather than a real one. Treat a strong result as a good reason to run a trial, not as a guarantee.

For traces too large for a browser tab, the pgcache-fit command line produces the same report.