Re: LONG delete with LOTS of FK's

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Larry Rosenman <ler(at)lerctr(dot)org>
Cc: sthomas(at)optionshouse(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: LONG delete with LOTS of FK's
Date: 2013-05-01 22:45:22
Message-ID: 5911.1367448322@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Larry Rosenman <ler(at)lerctr(dot)org> writes:
> On 2013-05-01 10:23, Shaun Thomas wrote:
>> Wow. I really hope every single one of those tables has an index on
>> the listed column, and it's the same datatype (bigint). Otherwise,
>> this is going to take a long, long time.

> Yes, all of them have at least one index that has account_id as the
> first column (we use that to
> separate tenants in a multi-tenant app).

> I still wonder if there is a way to see where it is :(

You could try EXPLAIN ANALYZE on a cut-down query that just deletes
a few hundred or thousand rows. That would help identify whether
there's a particular table that's causing the bottleneck.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-05-01 22:56:38 Re: zLinux Load Testing Experience
Previous Message Tom Lane 2013-05-01 22:41:40 Re: tstzrange with ... 'infinity'] + upper_inf() using 9.2.4