| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Herouth Maoz <herouth(at)unicell(dot)co(dot)il> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Lengthy deletion |
| Date: | 2011-11-29 09:10:03 |
| Message-ID: | 11988.1322557803@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Herouth Maoz <herouth(at)unicell(dot)co(dot)il> writes:
> On 29/11/2011, at 09:13, Tom Lane wrote:
>> Yup, that's a clue all right. I'll bet a nickel that you don't
>> have an index on the foreign key's referencing column (ie,
>> sent_messages.subscription_id). That means each delete in
>> the referenced table has to seqscan the referencing table to
>> see if the delete would result in an FK violation.
> Makes sense. But shouldn't that be figured into the EXPLAIN plan?
If you run EXPLAIN ANALYZE, on a reasonably recent release, you'll see
the foreign-key trigger eating a lot of time. Plain EXPLAIN doesn't
show triggers because it has no idea how much time they'll take.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Albe Laurenz | 2011-11-29 09:34:30 | Re: odbc_fdw |
| Previous Message | Herouth Maoz | 2011-11-29 08:51:46 | Re: Lengthy deletion |