Your database, attended to.
Gold Lapel is a self-optimizing Postgres proxy that analyzes your queries, creates the right indexes and materialized views, and rewrites slow queries on the fly. No code changes required.
Finds the queries costing you time
Gold Lapel watches your traffic and identifies the queries that are dragging down performance — sequential scans, missing indexes, redundant joins. No instrumentation needed.
Creates the right optimizations automatically
It builds materialized views and indexes tailored to your actual workload. Not generic rules — specific optimizations for the queries you actually run.
Rewrites queries transparently
Your application sends the same SQL it always has. Gold Lapel rewrites queries on the fly to use the optimizations it created. Your code never changes.
162ms → 3ms
SELECT u.name, COUNT(o.id) as order_count,
SUM(o.total) as lifetime_value
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2024-01-01'
GROUP BY u.name
ORDER BY lifetime_value DESC
LIMIT 50; 162msSELECT name, order_count, lifetime_value
FROM mv_user_lifetime_value
WHERE created_at > '2024-01-01'
ORDER BY lifetime_value DESC
LIMIT 50; 3msWhat Gold Lapel handles
Expensive JOINs
Multi-table joins that take seconds, served in milliseconds from pre-joined materialized views. No code changes.
SELECT * FROM orders
JOIN users ON …
JOIN products ON …Missing Indexes
Slow filters and sorts, fixed automatically with the right index for your actual query patterns — B-tree, composite, partial, or expression.
SELECT * FROM events
WHERE status = 'active'
AND created_at > …Heavy GROUP BY
Dashboard queries that recompute on every request, served instantly from pre-aggregated materialized views.
SELECT region,
SUM(total)
FROM orders
GROUP BY regionSlow Subqueries
Correlated subqueries that re-execute per row, replaced with instant lookups from pre-computed views.
SELECT * FROM users
WHERE id IN (
SELECT user_id
FROM orders …
)%LIKE% Search
Wildcard text search — fast, without Elasticsearch. Automatic trigram indexes make %LIKE% queries use index scans instead of sequential scans.
SELECT * FROM products
WHERE name
LIKE '%widget%'Expensive CTEs
Reporting queries that rebuild the same data every time, with the heavy lifting pre-computed into a materialized view.
WITH monthly AS (
SELECT …
FROM orders
GROUP BY month
)
SELECT * FROM monthly …Get started in two minutes
pip install goldlapel import goldlapel
url = goldlapel.start("postgresql://user:pass@mycompany.com/mydb", {
"mode": "butler",
"pool_size": 50,
# 40+ options — see goldlapel.config_keys()
})
# Use url with asyncpg, psycopg, SQLAlchemy — any Postgres driver
conn = await asyncpg.connect(url) Pricing
One product. Every feature. Two ways to buy.
14-day free trial — full features, no license key needed.
Every feature, every plan.
SQL Optimization
- Automatic materialized views for repetitive JOINs, GROUP BY, aggregations, subqueries, and CTEs
- Automatic indexes — B-tree, covering, trigram GIN (fast %LIKE% without Elasticsearch), expression, and partial
- Transparent query rewriting — queries read from matviews without client changes
- Smart consolidation — one wide matview serves multiple overlapping patterns
- N+1 query detection with batch query suggestions
- Deep pagination rewriting (high OFFSET to keyset pagination)
- Shadow verification — tests matview correctness before routing traffic
Caching
- Prepared statement cache (per-connection LRU)
- In-memory result cache with automatic write-through invalidation
- Redis sidecar cache (optional, non-blocking)
- Query coalescing — identical in-flight queries share a single result
Connection Management
- Connection pooling (session or transaction mode)
- Automatic read replica routing with read-after-write protection
- Automatic failover to standby with health probes and recovery
- TLS/SSL (client-facing and upstream)
- Idle connection timeout — serverless-friendly (Neon, Aurora Serverless)
Observability
- Live web dashboard with real-time metrics
- "Show Your Work" audit timeline — every decision logged with reasoning
- CLI tools: status, matviews, indexes, audit, config
- Comprehensive counters across all strategies
Safety
- Bellhop mode — observation-only kill switch, flip without redeployment
- Shadow mode — verifies correctness before routing
- Read-after-write protection for replica routing
- Table exclusion list and per-query skip annotation
- Row-Level Security (RLS) policy preservation
Configuration
- TOML config with goldlapel init generator
- Hot-reload — change settings without restarting
- Per-strategy enable/disable toggles
- CLI flags, environment variables, or config file
Deployment
- Single binary — Linux, macOS, Windows
- Docker image (multi-arch)
- Language wrappers: Python, Node, Ruby, Java, PHP, Go, .NET
- Framework plugins: Django, Rails, Spring Boot, Laravel
- ORM plugins: Prisma, SQLAlchemy, Drizzle
- Self-update: goldlapel update