Re: Index usage question

Поиск
Список
Период
Сортировка
От Mitch Vincent
Тема Re: Index usage question
Дата
Msg-id 00b801c13565$ca31b9b0$1e51000a@mitch
обсуждение исходный текст
Ответ на Index usage question  (Jefim Matskin <mjefim@sphera.com>)
Список pgsql-general
> When I execute the explain on a simple join query I see that the indices
are
> NOT used for
> the join:
>
> explain select tblAccountAvailablePlugins.nAcctPluginDirID,
> tblAccountPluginDir.nAcctPluginDirID FROM tblAccountAvailablePlugins,
> tblAccountPluginDir   WHERE
>
tblAccountPluginDir.nAcctPluginDirID=tblAccountAvailablePlugins.nAcctPluginD
> irID;
> NOTICE:  QUERY PLAN:
>
> Hash Join  (cost=21.45..640.50 rows=6530 width=8)
>   ->  Seq Scan on tblaccountavailableplugins  (cost=0.00..187.52
rows=10452
> width=4)
>   ->  Hash  (cost=18.76..18.76 rows=1076 width=4)
>         ->  Seq Scan on tblaccountplugindir  (cost=0.00..18.76 rows=1076
> width=4)
>
> EXPLAIN
>
> can anyone explain me what is wrong with my query?

If you haven't VACUUM ANALYZE 'd recently, do so to update the statistics on
your table(s)... The reason it's doing a sequential scan is that a seq scan
is (probably) better if that query really does return as many rows as it
thinks it does.. After you update the statistics, try again and see what the
query plan is then..

-Mitch


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

Предыдущее
От: E Kolve
Дата:
Сообщение: Re: many junction tables
Следующее
От: Einar Karttunen
Дата:
Сообщение: Re: Index usage question