Every database developer has been there: a query that ran in 1.2ms on your local laptop with 50 test rows suddenly takes 84ms in staging, and 1.8 seconds in production once your table hits 100,000 rows.
You open your SQL client, type EXPLAIN ANALYZE, and get back a tree of query plan nodes:
Seq Scan on orders (cost=0.00..1842.00 rows=20000 width=72) (actual time=0.042..84.210 rows=19850 loops=1)
Filter: (status = 'pending'::text)
Rows Removed by Filter: 80150
Planning Time: 0.18ms
Execution Time: 84.45msTo a senior DBA, the diagnosis is clear: Missing index on orders.status. But for product developers, identifying unindexed foreign keys, composite index opportunities, or sequential scan bottlenecks across dozens of microservices requires constant context switching.
With data-peek v0.28.0, we built a direct Bring-Your-Own-Harness (BYOH) integration with the official claude CLI binary.
#Why shell out to local claude -p CLI?
Most AI-enabled developer tools require you to paste API keys into desktop app settings or route your database queries through third-party SaaS proxy gateways. We wanted a design that preserves privacy and simplicity:
- Zero Token Storage: data-peek never stores, touches, or transmits your API keys.
- Local Authentication: Uses your existing local
claudeCLI authentication (claude -p --output-format json). - Typed Telemetry: By requesting
--output-format json,claude -preturns structured analysis that maps directly to UI components.
┌────────────────────────────────────────────────────────┐
│ data-peek UI │
└───────────────────────────┬────────────────────────────┘
│ EXPLAIN ANALYZE + Query
▼
┌────────────────────────────────────────────────────────┐
│ Local main process (Electron) │
└───────────────────────────┬────────────────────────────┘
│ Spawns `claude -p --output-format json`
▼
┌────────────────────────────────────────────────────────┐
│ Claude Code CLI (Local Terminal) │
└───────────────────────────┬────────────────────────────┘
│ Returns Structured JSON Recommendation
▼
┌────────────────────────────────────────────────────────┐
│ Floating Glass Drawer + 1-Click Fix Button │
└───────────────────────────┴────────────────────────────┘#1-Click "Apply Index & Re-run"
When you execute a query in data-peek, hitting Analyze (or clicking the yellow/red Performance Indicator badge) opens our glassmorphic AI Copilot drawer:
- Predicted Speedup Badge: E.g.
Predicted ~50x Speedup - Lock Safety Indicator:
CONCURRENTLY(No table locks required) - Generated DDL:
~/sqlsql
CREATE INDEX CONCURRENTLY idx_orders_status ON orders(status); - 1-Click Execution: Hitting
Apply Index & Re-runexecutes the DDL query live on your active database connection and instantly re-runs the performance telemetry.
#AI Schema Architecture Audits
We also expanded our Schema Intel diagnostic tab.
Clicking the new AI Architecture Audit button scans your active database connection's table structures, unindexed foreign keys, and column data types:
- AI Schema Health Score (e.g.
A-,B+) - Architectural Recommendations (missing FK indexes, timestamp precision optimizations, security alerts)
- 1-Click "Open Migration Tab": Opens the generated DDL migration script directly into a new SQL query editor tab for instant review and execution.
#Benchmark Results: 84.2ms ➔ 0.78ms
Testing against a PostgreSQL table of 100,000 orders:
| Metric | Before AI Fix | After 1-Click AI Fix | Improvement |
|---|---|---|---|
| Query Strategy | Sequential Scan | Index Seek (idx_orders_status) | Direct B-Tree Seek |
| Rows Filtered | 80,150 rows | 0 (Index Seek) | 100% reduction |
| Latency (p50) | 84.2 ms | 0.78 ms | 107x Faster |
#Upgrade to v0.28.0 Today
data-peek v0.28.0 is available now. Single-command install for macOS and Linux:
curl -fsSL https://install.cat/Rohithgilla12/data-peek | shOr view the open-source repository on GitHub.