Re: LONG delete with LOTS of FK's

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: LONG delete with LOTS of FK's
Дата
Msg-id 4873.1368195293@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: LONG delete with LOTS of FK's  (Larry Rosenman <ler@lerctr.org>)
Ответы Re: LONG delete with LOTS of FK's  (Larry Rosenman <ler@lerctr.org>)
Список pgsql-general
Larry Rosenman <ler@lerctr.org> writes:
> Any ideas on how to figure out if we ARE getting seqscan check plans,
> and better fix it?

Try an EXPLAIN ANALYZE VERBOSE on something that just deletes one row,
and wait however long it takes.  The printout should show how much time
is taken in the implementation trigger for each foreign key.  That will
at least nail down which table(s) are causing problems.

A different line of thought is that the EXPLAIN I suggested in
<25119.1367507317@sss.pgh.pa.us> isn't an entirely accurate
representation of what a foreign-key checking query is like, because the
check queries are parameterized.  You might need to do this instead:

prepare foo(referenced_column_data_type) as
  select 1 from <referencing_table> where referencing_column = $1;
explain execute foo(sample_value);

and verify you get a cheap plan for each referencing table.

            regards, tom lane


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

Предыдущее
От: Matt Brock
Дата:
Сообщение: Deploying PostgreSQL on CentOS with SSD and Hardware RAID
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Deploying PostgreSQL on CentOS with SSD and Hardware RAID