From: | Eric Comeau <ecomeau(at)signiant(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | How to get FK to use new index without restarting the database |
Date: | 2010-12-16 12:12:03 |
Message-ID: | iecvmj$1j93$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2010-12-16 12:14:32 | Re: performance libpq vs JDBC |
Previous Message | Divakar Singh | 2010-12-16 09:48:36 | Re: performance libpq vs JDBC |