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

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: Optimizing select count query which often takes over 10 seconds
Дата
Msg-id 1359129606.24620.9.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: Optimizing select count query which often takes over 10 seconds  (Alexander Farber <alexander.farber@gmail.com>)
Список 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@lelarge.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



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


В списке pgsql-general по дате отправления:

Предыдущее
От: Alexander Farber
Дата:
Сообщение: Re: Optimizing select count query which often takes over 10 seconds
Следующее
От: Gene Poole
Дата:
Сообщение: Where Can I Find...