From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Optimizing select count query which often takes over 10 seconds |
Date: | 2013-01-25 16:00:06 |
Message-ID: | 1359129606.24620.9.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 2013-01-25 at 16:13 +0100, Alexander Farber wrote:
> Hi -
>
> On Thu, Jan 24, 2013 at 8:12 PM, Guillaume Lelarge
> <guillaume(at)lelarge(dot)info> 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?
>
There's no change because you created an index on money alone, and that
change sure didn't give PostgreSQL a chance to do anything better. What
I told you before was to create an index on yw, and money, like this :
create index pref_money_yw_money_idx on pref_money(yw, money);
This should help you to change the plan and, I hope, get better
performances.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Gene Poole | 2013-01-25 16:21:01 | Where Can I Find... |
Previous Message | pamkiki | 2013-01-25 15:49:39 | Re: Temporary schemas |