Tagged articles

Top-K Query

1 articles · Page 1 of 1
IT Services Circle
IT Services Circle
Nov 3, 2026 · Databases

MySQL Top 10 from 50M Rows: SQL Pitfalls, Pre-aggregation & Space-Saving Algorithm

This article walks through a big-tech interview question about finding top 10 hot items from 50M MySQL rows, revealing why naive SQL fails, how to clarify time windows and real-time needs, and explores solutions from pre-aggregated snapshots and partitioned parallel queries to the Space-Saving algorithm for approximate top-K with bounded memory.

Approximate AlgorithmsDatabase InternalsMySQL
0 likes · 14 min read
MySQL Top 10 from 50M Rows: SQL Pitfalls, Pre-aggregation & Space-Saving Algorithm