🏠 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

High-Volume SQL Query Optimization

#sql #performance #database #optimization

Optimize a complex SQL query for a dataset with billions of rows.

Given a PostgreSQL schema with tables 'events' (10 billion rows), 'users' (50 million rows), and 'products' (1 million rows), optimize the following hypothetical slow query: 'SELECT u.name, COUNT(e.id) FROM users u JOIN events e ON u.id = e.user_id WHERE e.timestamp > NOW() - INTERVAL '1 year' GROUP BY u.name HAVING COUNT(e.id) > 1000'. Explain your indexing strategy, potential partitioning approach, and rewrite the query if necessary to minimize execution time and resource consumption.