Search Postgresql Archives

Re: Optimizing select count query which often takes over 10 seconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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?
> 

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



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux