Re: From Simple to Complex

Поиск
Список
Период
Сортировка
От Alessandro Gagliardi
Тема Re: From Simple to Complex
Дата
Msg-id CAAB3BB+8-7CQi+CmbFBsUZ1RRkKPvCnr4aPW6s48i1fC-ZKb6g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: From Simple to Complex  (Scott Marlowe <scott.marlowe@gmail.com>)
Ответы Re: From Simple to Complex  (Scott Marlowe <scott.marlowe@gmail.com>)
Re: From Simple to Complex  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-performance
LIMIT 65536; Total query runtime: 14846 ms. - http://explain.depesz.com/s/I3E
LIMIT 69632: Total query runtime: 80141 ms. - http://explain.depesz.com/s/9hp

So it looks like when the limit crosses a certain threshold (somewhere north of 2^16), Postgres decides to do a Seq Scan instead of an Index Scan. 
I've already lowered random_page_cost to 2. Maybe I should lower it to 1.5? Actually 60K should be plenty for my purposes anyway.

On Wed, Feb 1, 2012 at 10:35 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
On Wed, Feb 1, 2012 at 11:19 AM, Alessandro Gagliardi
<alessandro@path.com> wrote:
> Interestingly, increasing the limit does not seem to increase the runtime in
> a linear fashion. When I run it with a limit of 60000 I get a runtime
> of 14991 ms. But if I run it with a limit of 70000 I get a runtime of 77744
> ms. I assume that that's because I'm hitting a memory limit and paging out.
> Is that right?

Hard to say.  more likely your query plan changes at that point.  Run
the queries with "explain analyze" in front of them to find out.

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

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: From Simple to Complex
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: From Simple to Complex