Re: Delete query takes exorbitant amount of time

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, Karim A Nassar <Karim(dot)Nassar(at)NAU(dot)EDU>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Delete query takes exorbitant amount of time
Date: 2005-03-29 15:31:50
Message-ID: 22527.1112110310@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> If action is NO ACTION or RESTRICT then
> we need to SELECT at most 1 row that matches the criteria
> which means we can use LIMIT 1

> If action is CASCADE, SET NULL, SET DEFAULT then
> we need to UPDATE or DELETE all rows that match the criteria
> which means we musnt use LIMIT and need to use FOR UPDATE

Huh? UPDATE/DELETE don't use FOR UPDATE. I think you have failed
to break down the cases sufficiently. In particular it matters which
side of the RI constraint you are working from ...

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Simon Riggs 2005-03-29 16:01:27 Re: Delete query takes exorbitant amount of time
Previous Message Simon Riggs 2005-03-29 15:24:40 Re: Delete query takes exorbitant amount of time