How to get FK to use new index without restarting the database

От: Eric Comeau
Тема: How to get FK to use new index without restarting the database
Дата: ,
Msg-id: iecvmj$1j93$1@news.hub.org
(см: обсуждение, исходный текст)
Ответы: Re: How to get FK to use new index without restarting the database  (Jayadevan M)
Re: How to get FK to use new index without restarting the database  (Richard Huxton)
Re: How to get FK to use new index without restarting the database  (Tom Lane)
Список: pgsql-performance

Скрыть дерево обсуждения

How to get FK to use new index without restarting the database  (Eric Comeau, )
 Re: How to get FK to use new index without restarting the database  (Jayadevan M, )
  Re: How to get FK to use new index without restarting the database  (Eric Comeau, )
 Re: How to get FK to use new index without restarting the database  (Richard Huxton, )
 Re: How to get FK to use new index without restarting the database  (Tom Lane, )
  Re: How to get FK to use new index without restarting the database  (Eric Comeau, )
  Re: How to get FK to use new index without restarting the database  ("Eric Comeau", )

Is there a way force the db to re-evaluate its execution plan for a FK
without bouncing the DB?

  PostgreSQL 8.1.17

In our latest release our developers have implemented some new foreign
keys but forgot to create indexes on these keys.

The problem surfaced at one of our client installs where a maintenance
DELETE query was running for over 24 hrs. We have since then identified
the missing indexes and have sent the client a script to create them,
but in our testing we could not been able to get postgres to use the new
index for the FK cascade delete without bouncing the database.

Here is an example of an added fk but missing index....

ALTER TABLE scheduled_job_arg ADD CONSTRAINT sjr_scheduled_job_id_fk
   FOREIGN KEY (scheduled_job_id) REFERENCES scheduled_job (id)
      ON UPDATE CASCADE ON DELETE CASCADE;

Thanks in Advance,
Eric




В списке pgsql-performance по дате сообщения:

От: Tom Lane
Дата:
Сообщение: Re: How to get FK to use new index without restarting the database
От: Mladen Gogala
Дата:
Сообщение: Re: Index Bloat - how to tell?