Catalog Db Performance catalog-db-performance
Run the catalog query performance battery against a database replica and compare to the previous baseline.
Use it when making changes to catalog database queries, indexes, or schema.
- Our test
- 7/10✓ Verified
- tested Dec 6, 2026
- GitHub stars
- 35k
- backstage/backstage
- Added by
- 0
- members
- Updated
- Dec 6
- commit 0c84baf
- Content
- 1 file
- no scripts · 4 KB
- License
- Apache 2.0
- free to use
What our test found
The skill gives a concrete, repeatable benchmarking and baseline-update workflow, but depends on project files and leaves secure credential handling underspecified.
Limits spotted
- Requires project-specific battery files that are not included in the skill.
- Does not explain how to provide credentials securely or how authentication is configured.
- Does not specify safeguards for confirming the target is a replica before executing queries.
name: catalog-db-performance description: Run the catalog query performance battery against a database replica and compare to the previous baseline. Use when making changes to catalog database queries, indexes, or schema.
Catalog Database Performance Battery
Run the query performance battery defined in plugins/catalog-backend/src/tests/performance/query-battery/queries.md and compare the results to the baseline in plugins/catalog-backend/src/tests/performance/query-battery/baseline.md and the full representative plans in plugins/catalog-backend/src/tests/performance/query-battery/plans.md, with exact machine-diffable output in plugins/catalog-backend/src/tests/performance/query-battery/plans.json.
Steps
- Ask the user for database connection details (host, port, user, database name). These are environment-specific and not stored in the repo.
- Read the battery from
queries.md. For each scenario, the preferred method is to run the TypeScript method call shown (e.g.,catalog.queryEntities(...)) and capture the query plan. If that isn't practical, run the reference SQL directly withEXPLAIN (ANALYZE, BUFFERS)viapsql.
- Read the previous baseline from
baseline.md, its readable full plans fromplans.md, and its exact plan output fromplans.json.
- Run each scenario (21 total), with and without permissions and with several claim lists as described in
queries.md. For each one, record:
- Execution time
- Planning time
- Plan shape (top-level nodes and index names)
- Anti-patterns detected (check against the scenario's list AND the global anti-patterns at the bottom of
queries.md) - Buffer stats
- Compare to baseline. Flag:
- Execution time regressions >50%
- Plan shape changes (different index, new Sort/Seq Scan nodes)
- New anti-patterns that weren't in the previous run
- Note: catalog size differences affect absolute timings. Focus on plan shape changes and proportional regressions.
- Update `baseline.md` with the new results,
plans.mdwith one readable representativeEXPLAIN (ANALYZE, BUFFERS)output per scenario, andplans.jsonwith the exact final measured plans. Keep the same format. Add a comparison section at the bottom noting significant changes in execution time, estimates, plan choices, and buffer work.
- Report a summary to the user: which scenarios improved, which regressed, and whether any global anti-patterns were detected.
Slim profile
slim-profile.md in the battery folder describes a faster run that skips work based on stated assumptions, for example that short $in lists compile to the same SQL as before. Use it only after checking each assumption against the code under test, and list in the report which cuts were applied and why. If the change under test affects anything a cut relies on, such as the $in list threshold or the rule that decides how long lists are matched, run the full battery for the affected cases, and if asked to use the slim profile anyway, explain which cuts the change invalidates.
When to run
- Before and after changes to catalog database queries
- Before and after adding/removing/modifying indexes
- Before and after schema migrations
- Periodically to establish fresh baselines
Important
- Do NOT store database connection details in the repo
- Use a 30-second timeout per query
- Some queries use placeholder entity refs that may not exist in the target database — 0 rows returned is fine, the plan shape is what matters