Re: Question about Foreign key constraint causes "costly

Поиск
Список
Период
Сортировка
От Matt Miller
Тема Re: Question about Foreign key constraint causes "costly
Дата
Msg-id 1124808813.4403.15.camel@dbamm01-linux
обсуждение исходный текст
Ответ на Question about Foreign key constraint causes "costly sequential scans"?  (Emi Lu <emilu@cs.concordia.ca>)
Ответы Re: Question about Foreign key constraint causes "costly  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
On Tue, 2005-08-23 at 10:30 -0400, Emi Lu wrote:
> I'd like to setup foreign key constraint for A.col3, as the following:
> CONSTRAINT Aclo3_fk FOREIGN KEY (col3) REFERENCES B(colB1)
>
> But I got a warning msg from postgresql as:
>
>    foreign key constraint "Aclo3_fk" will require costly sequential
> scans

Index the foreign key:

    create index a_col3_ix on a (col3);

and then drop an recreate the foreign key and see if the warning is
still there.

As a rule I index foreign keys.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Question about Foreign key constraint causes "costly sequential scans"?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Question about Foreign key constraint causes "costly sequential scans"?