🏠 Home
Benchmark
📊 Tutti i benchmark 🦖 Dinosauro v1 🦖 Dinosauro v2 ✅ App To-Do List 🎨 Pagine libere creative 🎯 FSACB - Ultimate Showcase 🌍 Benchmark traduzione
Modelli
🏆 Top 10 modelli 🆓 Modelli gratuiti 📋 Tutti i modelli ⚙️ Kilo Code
Risorse
💬 Libreria di prompt 📖 Glossario IA 🔗 Link utili
advanced

SQL Query Refactoring

#sql #database #optimization

Optimize a poorly written SQL query and explain the execution plan changes.

You are a Database Performance Expert. I have a slow-running PostgreSQL query that performs a nested loop join on two large tables (Users and Orders) and filters by a non-indexed column on the Users table. Rewrite this query to maximize performance. Provide the rewritten SQL, and explain the specific changes in the execution plan (e.g., switching from a Nested Loop to a Hash Join or Merge Join). Suggest the specific indexes that should be created to support this query and explain the trade-offs of maintaining those indexes during write-heavy operations.