I have the following query:
select count(*) as aggregate from users where date(created_at) < '2024-04-01';
It returns 2337355
which is a correct number. But it takes over 1.5
secs to be executed. Any idea how can I make it more optimal and faster?
Noted that I have an idex on users(created_at, type)
.
Also tried removing date()
function like where created_at < '2024-04-01';
but still slow.