Because the query results are not cached only the RAW tables are. The query is rerun every time it is requested.
What is the group by clause accomplishing??? The sorting and hash Aggregate is eating up all the time
So this should mean that having say a 5 mb table in memory doing such query above takes 2 secs in memory ?
Assuming that, we probably have really slow memory :)
Besides , the query makes less sense to me , but I dont write the queries (yet) simply looking at the server side . So do you suggest to tune the queries or shall I rather look for other monitoring tools ? cheers, Peter
Thats a really tiny table it should be processed in sub milliseconds something else is going on. The actual time in the explain of the query states 288 millisecond not the 2533.734 you state from above.
You have not told us the version of PG or the OS its running on.