Re: Query Plan - Index Scan & Seq Scan

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Query Plan - Index Scan & Seq Scan
Дата
Msg-id 1115913086.22291.1.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Re: Query Plan - Index Scan & Seq Scan  (Prasanth <dbadmin@nqadmin.com>)
Ответы Re: Query Plan - Index Scan & Seq Scan  (Prasanth <dbadmin@nqadmin.com>)
Список pgsql-admin
On Thu, 2005-05-12 at 10:51, Prasanth wrote:
> I agree with you.
>
> But I have the where conditions on the tables I was expecting the planner to
> user index scan but it went for seq scan.
>
> I did a little testing using what you said.
>
> Below are the results.
>
> SELECT a.id FROM a,b WHERE a.id = b.id AND a.code >2 AND b.account_id = 16221;
>
> Total runtime: 18194.936 ms
>
> Then I set the seqscan off and ran the same query.
>
> Total runtime: 27.554 ms

Good!  This tells us two things, 1:  Your database can use the indexes
(sometimes indexes can't be used for various reasons, which are quickly
disappearing by the way.) and 2:  Your database is making the wrong
choice about when to use a seq scan versus an index.

What does the explain analyze output from that query say about row
estimates versus actual rows returned?

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

Предыдущее
От: Prasanth
Дата:
Сообщение: Re: Query Plan - Index Scan & Seq Scan
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Query Plan - Index Scan & Seq Scan