Re: foreign key constraint, planner ignore index.

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: foreign key constraint, planner ignore index.
Дата
Msg-id 4768DFDF.3050904@archonet.com
обсуждение исходный текст
Ответ на foreign key constraint, planner ignore index.  (Andrew Nesheret <andrew@infinet.ru>)
Ответы Re: foreign key constraint, planner ignore index.  (Andrew Nesheret <andrew@infinet.ru>)
Список pgsql-general
Andrew Nesheret wrote:
>
> And if i'm execute same statement without access to nodes table planer
> chose to use index "fki_nodes"!!!
>
> explain analyze SELECT 1 FROM ONLY "public"."sf_ipv4traffic" x WHERE
> 2003 OPERATOR(pg_catalog.=) "node" FOR SHARE OF x;
>
>                                                         QUERY
> PLAN
>
----------------------------------------------------------------------------------------------------------------------------

>
> Index Scan using fki_nodes on sf_ipv4traffic x  (cost=0.00..9.65 rows=1
> width=6) (actual time=0.019..0.019 rows=0 loops=1)
>   Index Cond: (2003 = node)
> Total runtime: 0.089 ms
> (3 rows)


If you PREPARE .... then EXECUTE the same query, does it still use the
index? The only thing I can think of is that the trigger is planning the
query to work for any given value and you have a lot of rows with e.g.
node=2004.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Johan van Zyl
Дата:
Сообщение: to realise the dark side of Microsoft SQL Server...?
Следующее
От: Andrew Nesheret
Дата:
Сообщение: Re: foreign key constraint, planner ignore index.