Catch Query Issues Before Production

Automated database performance analysis. Find N+1 queries, missing indexes, and slow patterns in seconds.

Django, FastAPI, SQLAlchemy. Free and open source. Works with PostgreSQL, MySQL, SQLite.

  • N+1 DetectionIdentify inefficient loop patterns
  • Missing IndexesFind unindexed columns
  • Cost AnalysisEstimate database infrastructure ROI
  • AI SuggestionsSpecific fixes with confidence scores

What QueryShield Detects

Automated analysis of your database queries to surface performance problems before they hit production.

  • N+1 queries (loops accessing foreign keys inefficiently)
  • Missing indexes on WHERE clause columns
  • SELECT * queries on large tables
  • Complex JOINs (3+ tables) without optimization hints
  • Sequential table scans instead of index lookups
  • Expensive SORT operations without indexes

Features

🔍

Automatic Detection

Runs during tests. Zero config. Analyzes all queries in real-time.

🤖

AI Root Cause Analysis

Get specific explanations and fix suggestions with confidence scores.

💰

Cost Estimation

See estimated database infrastructure costs and ROI of fixes.

Multi-Framework

Works with Django, FastAPI, SQLAlchemy. Any Python web framework.

📊

Production Monitoring

Optional middleware to sample and monitor real-world queries with 1% overhead.

📖

EXPLAIN Plan Analysis

Parses database execution plans to surface expensive operations.

Quick Start

Get running in 2 minutes.

Step 1: Install the CLI

pip install queryshield

Step 2: Choose Your Framework

Django

pip install queryshield-probe
Add to your settings.py:
INSTALLED_APPS = [ 'queryshield_probe', # ... your apps ]
Then run tests as normal: python manage.py test

FastAPI/SQLAlchemy

pip install queryshield-sqlalchemy
Use in your tests:
from queryshield_sqlalchemy import QueryShieldProbe probe = QueryShieldProbe(session) # ... run your test queries ... report = probe.finalize()

Production Monitoring (Optional)

pip install queryshield-monitoring
Add middleware:
from queryshield_monitoring import QueryShieldMiddleware app.add_middleware( QueryShieldMiddleware, api_key="optional-saas-api-key", sample_rate=0.01, # 1% of queries slow_query_threshold_ms=500 )

Sample Report

QueryShield generates detailed JSON reports with actionable insights.

{ "total_queries": 523, "problems": [ { "type": "N+1", "sql": "SELECT * FROM books WHERE author_id = ?", "count": 15, "root_cause": "Loop accessing foreign key without prefetch", "suggestion": "Use select_related() or prefetch_related() to batch load related objects", "confidence": 95, "estimated_improvement": "15x faster", "estimated_monthly_cost": 150 }, { "type": "MISSING_INDEX", "sql": "SELECT * FROM users WHERE email = ?", "root_cause": "Email column has no index", "suggestion": "Add index: CREATE INDEX idx_users_email ON users(email)", "confidence": 92, "estimated_improvement": "100x faster", "estimated_monthly_cost": 2100 } ], "estimated_monthly_cost": 3250, "recommended_fixes": [ "Add select_related('author') to QuerySet", "Create index on users(email)", "Review complex JOIN in reports view" ] }

Pro Early Access

We are building paid features for teams that need deeper visibility and automation. Leave your email if you want early access and discounts.

Planned Pro Features

  • Hosted dashboard with history and trends
  • Performance regression detection on PRs (GitHub Checks)
  • Alerting (Slack, email, webhooks, PagerDuty)
  • Cost analytics and ROI calculator
  • Team roles (RBAC) and API key management
  • On‑premise/self‑hosted option

Join the Waitlist

No spam. We will only email about Pro availability and discounts.

Ready to optimize your database?

Free. Open source. Works with any Python framework.