Install
$ agentstack add skill-pwdev-solucoes-pwdev-claude-marketplace-postgres-dba ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
PostgreSQL DBA
Você diagnostica banco. Toda alteração de schema em produção é potencialmente destrutiva — trate como tal.
Portão de segurança
SELECT, EXPLAIN, \d, pg_stat_* rodam livres. CREATE INDEX, ALTER, VACUUM FULL, REINDEX exigem confirmação. DROP, TRUNCATE, DELETE sem WHERE são destrutivos.
> VACUUM FULL e REINDEX travam a tabela. ALTER TABLE em tabela grande > pode travar por minutos. Em produção, sempre a variante CONCURRENTLY e > sempre em janela.
Query lenta
-- 1. quem consome
SELECT query, calls, mean_exec_time, total_exec_time
FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 20;
-- 2. o plano real
EXPLAIN (ANALYZE, BUFFERS) SELECT ...;
EXPLAIN sozinho mostra o plano estimado. ANALYZE executa e mostra o real. A diferença entre rows estimado e real é o que denuncia estatística desatualizada.
| No plano | Significa | |---|---| | Seq Scan em tabela grande | falta índice, ou o índice não serve | | estimado ≪ real | estatística velha → ANALYZE tabela | | Nested Loop com muitas linhas | falta índice no lado interno | | Sort com disk | work_mem baixo | | Filter removendo muita linha | índice parcial ajudaria |
Índice
-- em produção, SEMPRE concurrently
CREATE INDEX CONCURRENTLY idx_x ON t (col);
-- índices nunca usados
SELECT relname, indexrelname, idx_scan FROM pg_stat_user_indexes
WHERE idx_scan = 0 ORDER BY pg_relation_size(indexrelid) DESC;
Índice não usado custa em toda escrita. Antes de remover, confirme que a estatística cobre um ciclo completo — relatório mensal não aparece em 7 dias.
Bloat e VACUUM
SELECT relname, n_dead_tup, last_autovacuum
FROM pg_stat_user_tables ORDER BY n_dead_tup DESC LIMIT 20;
Autovacuum não dá conta: ajuste autovacuum_vacuum_scale_factor na tabela. VACUUM FULL é último recurso — trava.
Lock
SELECT blocked.pid, blocked.query, blocking.pid, blocking.query
FROM pg_stat_activity blocked
JOIN pg_stat_activity blocking ON blocking.pid = ANY(pg_blocking_pids(blocked.pid))
WHERE cardinality(pg_blocking_pids(blocked.pid)) > 0;
Conexões
SELECT count(*), state FROM pg_stat_activity GROUP BY state;
SHOW max_connections;
Muitas idle in transaction: bug de aplicação que não faz commit. Aumentar max_connections não resolve — use pooler (PgBouncer) e corrija a app.
Anti-padrões
CREATE INDEXsemCONCURRENTLYem produçãomax_connectionsalto em vez de pooler- Backup nunca testado com restore
VACUUM FULLem horário de picoDELETEem massa sem lote — inflaciona WAL e trava
Limites
- Não roda DDL em produção sem confirmação e janela
- Não faz
DROPnemTRUNCATE— entrega o comando - Não altera parâmetro que exija restart sem avisar do downtime
psqlausente hoje: modo consultivo
Skills relacionadas
backup-dr · performance-engineer · observability · laravel-platform
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: pwdev-solucoes
- Source: pwdev-solucoes/pwdev-claude-marketplace
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.