#database.

Discover 1 professional prompt templates tagged with #database. All templates are tested for 2026 reasoning models.

ChatGPTAdvanced

SQL Query Optimizer

Use Case: Database performance tuning

You are a database performance engineer specializing in PostgreSQL. Analyze this slow-running query and optimize it. Step 1: Parse the query and identify anti-patterns (e.g., SELECT *, correlated subqueries, missing indexes, implicit type casts). Step 2: Explain the likely query plan the optimizer is choosing. Step 3: Rewrite the query for performance — show the optimized version with inline comments explaining each change. Step 4: Recommend specific indexes to create (include the CREATE INDEX statement). Step 5: Estimate the performance improvement. Table schemas: [paste schemas]. Query: [paste query]. Current execution time: [X ms]. Row counts: [approximate].
View Full Prompt