I have a fact table in Infobright that has around 40 million rows. Running a query on that table, like the one shown below, takes well over 10 minutes.
SELECT pat_key,
COUNT(c_id)
FROM my_fact_table
GROUP BY pat_key
ORDER BY COUNT(c_id) DESC
LIMIT 50;
Duration/Fetch = 334.528 sec / 0.094 sec
Any ideas why and how to tune this?
Btw, the hardware spec is AWS m1.large. So network latency aside, this is still a significant time interval.