Is there any way to optimize this query in postgres (version 14)? I have an index on entry_date and have tried to index entry_date::date but it did not seem to matter either.
SELECT
user_name,
extract(year from entry_date) as year,
extract(month from entry_date) as month,
extract(day from entry_date) as day,
extract(hour from entry_date) as hour,
extract(minute from entry_date) as minute,
count(*) as cnt
FROM pdq.q_1
WHERE
entry_date > current_timestamp - interval '10' day
GROUP BY
user_name,
year,
month,
day,
hour,
minute
Here is the explain analyze plan