Re: Why is query selecting sequential?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Why is query selecting sequential?
Дата
Msg-id 200402061351.39084.josh@agliodbs.com
обсуждение исходный текст
Ответ на Why is query selecting sequential?  (Karl Denninger <karl@Denninger.Net>)
Ответы Re: Why is query selecting sequential?  (Karl Denninger <karl@denninger.net>)
Список pgsql-performance
Karl,

>          SubPlan
>            ->  Seq Scan on forumlog  (cost=0.00..1.18 rows=1 width=8)
>                  Filter: ((login = '%s'::text) AND (forum = '%s'::text) AND
(number = $0))

> Why is the subplan using a sequential scan?  At minimum the index on the
> post number ("forumlog_number") should be used, no?  What would be even
> better would be a set of indices that allow at least two (or even all three)
> of the keys in the inside SELECT to be used.

It's using a seq scan because you have only 1 row in the table.     Don't
bother testing performance before your database is populated.

PostgreSQL doesn't just use an index because it's there; it uses and index
because it's faster than not using one.

If there is more than one row in the table, then:
1) run ANALYZE forumlog;
2) Send us the EXPLAIN ANALYZE, not just the explain for the query.

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


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

Предыдущее
От: Karl Denninger
Дата:
Сообщение: Why is query selecting sequential?
Следующее
От: Karl Denninger
Дата:
Сообщение: Re: Why is query selecting sequential?