database-performance — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited database-performance (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Any task involving slow queries, query optimization, index strategy, EXPLAIN plan analysis, partitioning, materialized views, or database profiling.
Key things to look for:
| Signal | Meaning | Action |
|---|---|---|
| Seq Scan on large table | Full table scan, no index used | Add appropriate index |
| Nested Loop with high rows | O(n*m) join strategy | Consider Hash Join, add index on join column |
| Actual rows >> Estimated rows | Stale statistics | Run ANALYZE on the table |
| Sort with external merge | Not enough work_mem | Increase work_mem or add index for ORDER BY |
| Filter removing most rows | Index not selective enough | Add more specific index or partial index |
Node types (best to worst for large tables):
B-tree (default, most common):
WHERE status = 'active'WHERE created_at > '2025-01-01'WHERE name LIKE 'foo%'ORDER BY created_at DESC(tenant_id, created_at) — order matters, left-to-right.GIN (Generalized Inverted Index):
WHERE data @> '{"key": "value"}'WHERE tags @> ARRAY['tag1']WHERE to_tsvector(body) @@ to_tsquery('search')Partial index (conditional):
CREATE INDEX idx_active_orders ON orders(created_at) WHERE status = 'active'Expression index:
CREATE INDEX idx_lower_email ON users(LOWER(email))Functions on indexed columns:
-- BAD: index on created_at is useless
WHERE EXTRACT(YEAR FROM created_at) = 2025
-- GOOD: rewrite as range
WHERE created_at >= '2025-01-01' AND created_at < '2026-01-01'OR conditions preventing index use:
-- BAD: may cause Seq Scan
WHERE status = 'active' OR status = 'pending'
-- GOOD: use IN
WHERE status IN ('active', 'pending')*SELECT when you need few columns:**
-- BAD: fetches all columns, prevents index-only scan
SELECT * FROM orders WHERE tenant_id = 'abc'
-- GOOD: select only needed columns
SELECT id, status, total FROM orders WHERE tenant_id = 'abc'Missing LIMIT on unbounded queries:
-- BAD: may return millions of rows
SELECT * FROM events WHERE type = 'click'
-- GOOD: always paginate
SELECT * FROM events WHERE type = 'click' ORDER BY id LIMIT 50When to use:
Implementation:
CREATE MATERIALIZED VIEW monthly_revenue AS
SELECT tenant_id, date_trunc('month', created_at) AS month, SUM(amount) AS total
FROM orders
WHERE status = 'completed'
GROUP BY tenant_id, month;
-- Refresh on schedule
REFRESH MATERIALIZED VIEW CONCURRENTLY monthly_revenue;Rules:
Range partitioning (time-series data):
CREATE TABLE events (
id BIGINT, tenant_id UUID, created_at TIMESTAMPTZ, data JSONB
) PARTITION BY RANGE (created_at);
CREATE TABLE events_2025_01 PARTITION OF events
FOR VALUES FROM ('2025-01-01') TO ('2025-02-01');Benefits:
Hash partitioning (even distribution):
Rules:
pg_stat_statements for query-level statistics.pg_stat_user_indexes — unused indexes waste write performance.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.