My measurements table has about 5 million rows and an index on created_at. A query with WHERE YEAR(created_at) = 2025 AND device_id = 17 still takes several seconds, and the execution plan shows a full table scan.
I would like to understand what an index really is internally, why the database ignores mine here, and how to decide which columns to index.




