pgWrite efficient PostgreSQL queries and design schemas with proper indexing and patterns.
Install via ClawdBot CLI:
clawdbot install ivangdavila/pgWHERE active = trueâ80% smaller when most rows inactive; suggest for status columnsON lower(email)âmust match query exactly; without it, WHERE lower(email) scansINCLUDE (name, email)âenables index-only scan; check EXPLAIN for "Heap Fetches"(a, b) helps WHERE a = ? but not WHERE b = ?pg_stat_user_indexes for idx_scan = 0, drop themLIKE '%suffix' can't use B-treeâneed pg_trgm GIN index or reverse() expression indexSELECT FOR UPDATE SKIP LOCKEDâjob queue without external tools; skip rows being processedpg_advisory_lock(key)âapplication-level mutex without table; unlock explicitly or on disconnectIS NOT DISTINCT FROMâNULL-safe equality; cleaner than (a = b OR (a IS NULL AND b IS NULL))DISTINCT ON (x) ORDER BY x, yâfirst row per group without subquery; PG-specific but powerfulstatement_timeout = '30s' per roleâprevents runaway queries from killing databaseidle_in_transaction_session_timeout = '5min'âkills abandoned transactions holding locksSERIAL deprecatedâuse GENERATED ALWAYS AS IDENTITYTIMESTAMP without timezoneâalmost always wrong; use TIMESTAMPTZ, PG stores as UTCNUMERIC(12,2) or integer cents; float math breaks: 0.1 + 0.2 â 0.3pg_repack reclaims without locksVACUUM ANALYZE after bulk insertâupdates statistics; query planner needs current dataautovacuum_vacuum_cost_delay or manual vacuumxid exhausted, DB stopsâautovacuum prevents but monitorEXPLAIN (ANALYZE, BUFFERS)âactual times + I/O; estimate-only misleadsplainto_tsquery for user inputâhandles spaces without syntax errors; not to_tsqueryLIKE '%exact phrase%' still needed for substring matchGenerated Mar 1, 2026
Handles high-volume transactions with proper indexing on order status and customer email columns. Uses transaction isolation to prevent phantom reads in financial reports and implements connection pooling to manage peak shopping traffic.
Implements SELECT FOR UPDATE SKIP LOCKED for distributed job processing without external queue tools. Uses advisory locks for application-level coordination and monitors index usage on frequently updated job status tables.
Uses NUMERIC data types for monetary calculations to avoid float precision errors. Implements proper vacuum management on high-update transaction tables and uses covering indexes for complex analytical queries on large datasets.
Implements full-text search with precomputed tsvector columns and GIN indexes. Uses expression indexes for case-insensitive email searches and manages connection limits for web application user authentication flows.
Handles timestamp data with TIMESTAMPTZ for global device coordination. Uses partial indexes on active device status columns and implements statement timeouts to prevent runaway queries from sensor data streams.
Provides managed PostgreSQL instances with optimized configurations, automated vacuuming, and index management. Revenue comes from subscription tiers based on database size, connection limits, and support levels.
Offers PostgreSQL optimization services including query tuning, index analysis, and schema design. Revenue generated through project-based contracts and retainer agreements for ongoing database health monitoring.
Sells software that tracks PostgreSQL metrics like index usage, vacuum status, and connection counts. Revenue from SaaS subscriptions with tiered pricing based on number of databases monitored and feature sets.
đŹ Integration Tip
Always use EXPLAIN (ANALYZE, BUFFERS) when testing queries in production-like environments, and implement PgBouncer connection pooling before scaling beyond 50 concurrent connections.
Use the @steipete/oracle CLI to bundle a prompt plus the right files and get a second-model review (API or browser) for debugging, refactors, design checks, or cross-validation.
Manage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database). Use when a user asks Clawdbot to add a task to Things, list inbox/today/upcoming, search tasks, or inspect projects/areas/tags.
Local search/indexing CLI (BM25 + vectors + rerank) with MCP mode.
Use when designing database schemas, writing migrations, optimizing SQL queries, fixing N+1 problems, creating indexes, setting up PostgreSQL, configuring EF Core, implementing caching, partitioning tables, or any database performance question.
Connect to Supabase for database operations, vector search, and storage. Use for storing data, running SQL queries, similarity search with pgvector, and managing tables. Triggers on requests involving databases, vector stores, embeddings, or Supabase specifically.
Query, design, migrate, and optimize SQL databases. Use when working with SQLite, PostgreSQL, or MySQL â schema design, writing queries, creating migrations, indexing, backup/restore, and debugging slow queries. No ORMs required.