Hi - On Thu, Jan 24, 2013 at 8:12 PM, Guillaume Lelarge <guillaume@xxxxxxxxxxxx> wrote: > You should better create an index on pref_money(yw, money). It could > help you get rid of the seqscan and sort operations. I've created an index with # create index pref_money_money_index on pref_money(money desc); and posted the new EXPLAIN output here: http://stackoverflow.com/questions/14498974/optimizing-select-count-query-which-often-takes-over-10-seconds But it doesn't seem to change much or am I too unexperienced to see the change? Thanks Alex -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general