Request demo
V Valk
← Back to home

Detection Rules

Valk comes with battle-tested rules for common PostgreSQL performance issues. Each rule is fully configurable — tune thresholds to match your workload, not the other way around.

Slow Query Detection

critical

Finds queries that consistently take too long. Valk tracks execution times across your workload and flags queries that exceed your acceptable threshold — especially those called frequently.

You can configure
Minimum execution time — Only flag queries slower than this (e.g., 500ms, 1 second)
Minimum call count — Ignore rare queries, focus on frequently-run ones
Time window — Look at the last hour, day, or week
Simulation eligible — Valk can suggest and validate index improvements

Inefficient Query Detection

critical

Catches queries that do too much work for too little return — like scanning millions of rows to return just a handful. These often indicate a missing index or a query that needs rewriting.

You can configure
Rows scanned vs. returned ratio — Flag when reading 1000x more than returning
Weighting factors — Prioritize by time impact, I/O, or frequency
Simulation eligible

Unused Index Detection

warning

Identifies indexes that haven't been used in weeks or months. These waste disk space and slow down every INSERT, UPDATE, and DELETE. Dropping them is often free performance.

You can configure
Days without use — Flag after 7, 14, or 30+ days of zero scans
Minimum index size — Ignore tiny indexes, focus on the big ones
Recommendation: DROP INDEX (Valk automatically excludes primary keys and unique constraints)

Vacuum Needed Detection

warning

Spots tables with too many dead tuples — rows that have been deleted or updated but not yet cleaned up. High dead tuple ratios cause bloat and slow down sequential scans.

You can configure
Dead tuple threshold — Flag when dead tuples exceed 5%, 10%, or more
Minimum table size — Only check tables above a certain size
Max time since last vacuum — Alert if too long since maintenance
Recommendation: VACUUM ANALYZE

Rapid Table Growth Detection

warning

Tracks tables that are growing unusually fast — a sign of missing data retention, runaway logging, or a feature that's inserting more than expected.

You can configure
Growth percentage — Alert if table grows by 50%, 100%, etc. in a period
Absolute growth — Alert if table grows by more than X GB
Recommendation: Investigate data retention, consider partitioning

Index Type Mismatch Detection

info

Finds B-tree indexes on columns with very few distinct values — like booleans or status enums. These indexes are often wasteful and could be replaced with partial indexes or removed entirely.

Recommendation: Consider partial index or remove if unused

Multi-level configuration

Every threshold can be overridden at different levels. Higher specificity wins automatically.

Global defaults

Base thresholds that apply to everything by default.

Per-rule overrides

Adjust thresholds for specific rule types across all tables.

Per-table overrides

Set different thresholds for high-traffic or critical tables.

Per-query overrides

Fine-tune individual queries that need special treatment.

See these rules in action

We'll show you what Valk would detect in your database.

Request a demo