💙 Supporting healthcare non-profits: Metadataloop is free for 6–12 months. Contact Us to get started.
Free Online Tool

SQL Index & Constraint Advisor

Paste a CREATE TABLE schema, get index recommendations in seconds.

Open the Index Advisor →

Overview

Most ORMs won't warn you when a foreign key has no index or a table has no primary key. MetaDataLoop's Index Advisor statically analyzes your CREATE TABLE schema and flags the structural patterns that reliably cause slow joins, slow deletes, and full table scans — no live database connection required.

What you get

✓ INCLUDED
Detects foreign key columns with no supporting index
✓ INCLUDED
Flags tables missing a primary key entirely
✓ INCLUDED
Suggests UNIQUE constraints on natural-key-looking columns (email, username, slug)
✓ INCLUDED
Flags commonly-filtered columns (status, created_at, deleted_at)
✓ INCLUDED
Suggests composite indexes for common FK + date filter/sort patterns
✓ INCLUDED
Emits ready-to-run CREATE INDEX statements

Type detection reference

Sample values and the dialect-native type they map to.

Sample valueInferred type
FK column, no indexCREATE INDEX (high priority)
Table with no PKAdd PRIMARY KEY (high priority)
email/username, no UNIQUECREATE UNIQUE INDEX (medium)
status/created_at columnsCREATE INDEX (medium)
FK + date column comboComposite CREATE INDEX (low)

Example

Input
CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  customer_id INT REFERENCES customers(id),
  status VARCHAR(20) NOT NULL,
  created_at TIMESTAMP NOT NULL
);
Output
CREATE INDEX idx_orders_customer_id ON "orders" ("customer_id");
CREATE INDEX idx_orders_status ON "orders" ("status");

Frequently asked questions

Does this connect to my live database?
No — it's a static analysis of the CREATE TABLE text you paste. Nothing connects to a live database.
Are the recommendations guaranteed correct?
They're heuristics based on common patterns, not query-plan analysis. Validate with EXPLAIN/EXPLAIN ANALYZE on your real workload before applying in production.

Try it now

No signup, no install — runs entirely in your browser.

Open the Index Advisor →

⚠ Confirm Delete