postgres-optimization
Skill2.7k starsChanged 10 months agoApache-2.0View on GitHub
PostgreSQL optimization including indexes, query plans, partitioning, JSONB operations, and connection pooling
1 other project uses a version of this.
Trending
Less talk lately.thin dataabout the whole repository
Most recently taken up by
- valentinesamuel/claude-skillsword for word, first seen Apr 19, 2026
Who's talking about rohitg00/awesome-claude-code-toolkit
- sudosubin/agents.nix“agent-skills.github.rohitg00.awesome-claude-code-toolkit: init at 0.5.0”GitHub · Oct 1, 2026
- uizze/uizze“docs: track Claude Code Toolkit distribution PR”GitHub · Aug 18, 2026
- hslee16/Archy“chore(distribution): submit archy to awesome-mcp-servers and awesome-claude-code-toolkit”GitHub · Jul 25, 2026
- Nexcyfr/nexcy-site“Vague 1D : workflows et templates internes Claude Code core”GitHub · Jun 11, 2026
- taeyeon-Kim/claude-starter-kit“감사 리포트 2026-04-14 (2차): Warning 0건, Info 4건 — Phase 3.8 첫 실행”GitHub · Apr 14, 2026
The biggest 5 of 7 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 7
Talked about on GitHub (7 times).
On GitHub · 7
- Oct 1, 2026agent-skills.github.rohitg00.awesome-claude-code-toolkit: init at 0.5.0 — sudosubin/agents.nix0 reactions
- Aug 18, 2026docs: track Claude Code Toolkit distribution PR — uizze/uizze0 reactions
- Jul 25, 2026chore(distribution): submit archy to awesome-mcp-servers and awesome-claude-code-toolkit — hslee16/Archy0 reactions · 4 comments
- Jun 11, 2026Vague 1D : workflows et templates internes Claude Code core — Nexcyfr/nexcy-site0 reactions · 1 comment
- Apr 14, 2026감사 리포트 2026-04-14 (2차): Warning 0건, Info 4건 — Phase 3.8 첫 실행 — taeyeon-Kim/claude-starter-kit0 reactions
2 more on GitHub
- Apr 13, 2026Audit candidate: rohitg00/awesome-claude-code-toolkit — xiaolai/nlpm0 reactions · 5 comments
- Apr 6, 2026Audit candidate: rohitg00/awesome-claude-code-toolkit — xiaolai/nlpm0 reactions · 2 comments
Other versions1 project uses a version of this.
Word for word · 1
- valentinesamuel/claude-skills★ 1100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- rules/agents.mdAGENTS.md
- accessibility-wcagSkill
- agentkit-seoSkill
- api-design-patternsSkill
- authentication-patternsSkill
- aws-cloud-patternsSkill
- ci-cd-pipelinesSkill
- claude-memory-kitSkill
- continuous-learningSkill
- database-optimizationSkill
- data-engineeringSkill
- deep-diveSkill
- devops-automationSkill
- django-patternsSkill
- docker-best-practicesSkill
- frontend-excellenceSkill
- git-advancedSkill
- golang-idiomsSkill
- graphql-designSkill
- kubernetes-operationsSkill
- llm-integrationSkill
- manage-skillsSkill
- mcp-developmentSkill
- microservices-designSkill
- mobile-developmentSkill
- monitoring-observabilitySkill
- nextjs-masterySkill
- performance-optimizationSkill
- prompt-engineeringSkill
- python-best-practicesSkill
- react-patternsSkill
- redis-patternsSkill
- rust-systemsSkill
- security-hardeningSkill
- springboot-patternsSkill
- styleseedSkill
- tdd-masterySkill
- testing-strategiesSkill
- typescript-advancedSkill
- websocket-realtimeSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 111
Use transaction-level pooling for web applications.
- Very specific: line 133
Not using EXPLAIN ANALYZE to verify index usage
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PostgreSQL Optimization
Index Strategies
-- B-tree index for equality and range queries (default)
CREATE INDEX idx_orders_customer_id ON orders (customer_id);
-- Composite index (column order matters: equality columns first, range last)
CREATE INDEX idx_orders_status_created ON orders (status, created_at DESC);
-- Partial index (smaller, faster for filtered queries)
CREATE INDEX idx_orders_pending ON orders (created_at)
WHERE status = 'pending';
-- Covering index (avoids table lookup entirely)
CREATE INDEX idx_users_email_name ON users (email) INCLUDE (name, avatar_url);
-- GIN index for JSONB containment queries
CREATE INDEX idx_products_metadata ON products USING GIN (metadata);
-- GiST index for full-text search
CREATE INDEX idx_articles_search ON articles USING GiST (
to_tsvector('english', title || ' ' || body)
);
-- Concurrent index creation (no table lock)
CREATE INDEX CONCURRENTLY idx_large_table_col ON large_table (col);Reading Query Plans
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT o.id, o.total, u.name
FROM orders o
JOIN users u ON o.user_id = u.id
WHERE o.status = 'shipped'
AND o.created_at > NOW() - INTERVAL '30 days'
ORDER BY o.created_at DESC
LIMIT 20;Key things to look for in the plan:
Seq Scanon large tables indicates a missing indexNested Loopwith high row estimates suggests missing join indexSortwithoutIndex Scanmeans the sort is happening in memory/diskBuffers: shared hitvsshared readshows cache efficiency
Partitioning
CREATE TABLE events (
id BIGINT GENERATED ALWAYS AS IDENTITY,
event_type TEXT NOT NULL,
payload JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
) PARTITION BY RANGE (created_at);
CREATE TABLE events_2024_q1 PARTITION OF events
FOR VALUES FROM ('2024-01-01') TO ('2024-04-01');
CREATE TABLE events_2024_q2 PARTITION OF events
FOR VALUES FROM ('2024-04-01') TO ('2024-07-01');
-- Index on each partition (inherited automatically in PG 11+)
CREATE INDEX ON events (created_at, event_type);Partition tables with more than 10M rows when queries consistently filter on the partition key.
JSONB Operations
-- Query nested JSONB fields
SELECT * FROM products
WHERE metadata @> '{"category": "electronics"}'
AND (metadata ->> 'price')::numeric < 500;
-- Update nested JSONB
UPDATE products
SET metadata = jsonb_set(metadata, '{stock}', to_jsonb(stock - 1))
WHERE id = 'abc';
-- Aggregate JSONB arrays
SELECT id, jsonb_array_elements_text(metadata -> 'tags') AS tag
FROM products
WHERE metadata ? 'tags';Connection Pooling
# pgbouncer.ini
[databases]
app = host=localhost port=5432 dbname=app
[pgbouncer]
pool_mode = transaction
max_client_conn = 1000
default_pool_size = 25
min_pool_size = 5
reserve_pool_size = 5
server_idle_timeout = 300Use transaction-level pooling for web applications. Session-level pooling for apps that use prepared statements or temp tables.
Common Tuning Parameters
-- Check for slow queries
SELECT query, calls, mean_exec_time, total_exec_time
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 10;
-- Find unused indexes
SELECT indexrelname, idx_scan, pg_size_pretty(pg_relation_size(indexrelid))
FROM pg_stat_user_indexes
WHERE idx_scan = 0
ORDER BY pg_relation_size(indexrelid) DESC;Anti-Patterns
- Creating indexes on every column instead of analyzing actual query patterns
- Using
SELECT *when only a few columns are needed - Not using
EXPLAIN ANALYZEto verify index usage - Storing large blobs in JSONB when a separate table with proper types is better
- Missing connection pooling (each connection uses ~10MB of server memory)
- Running
VACUUM FULLduring peak hours (locks the entire table)
Checklist
- Indexes match actual query patterns (check
pg_stat_statements) - Composite indexes ordered: equality, then sort, then range columns
EXPLAIN ANALYZErun on all critical queries- Partial indexes used for frequently filtered subsets
- Connection pooler (PgBouncer/pgcat) in front of PostgreSQL
- Table partitioning considered for tables over 10M rows
- Unused indexes identified and dropped
pg_stat_statementsenabled for query performance monitoring
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

