🏠 Home
Benchmark Hub
📊 All Benchmarks 🦖 Dinosaur v1 🦖 Dinosaur v2 ✅ To-Do List Applications 🎨 Creative Free Pages 🎯 FSACB - Ultimate Showcase 🌍 Translation Benchmark
Models
🏆 Top 10 Models 🆓 Free Models 📋 All Models ⚙️ Kilo Code
Resources
💬 Prompts Library 📖 AI Glossary 🔗 Useful Links
hard

Advanced Query Optimization

#sql #database #optimization #performance

Analyze and optimize a highly inefficient SQL query for a large dataset.

Given a scenario with a table 'User_Activities' containing 50 million rows and columns (user_id, activity_type, timestamp, metadata), write an optimized query to find the top 10 users who performed the specific sequence of actions 'Login' -> 'View_Product' -> 'Purchase' within a 30-minute window at least 5 times in the last month. Explain your indexing strategy, join logic, and how you would handle window functions to optimize execution time. Additionally, provide the EXPLAIN ANALYZE output interpretation for your proposed solution.