Oosterhout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, November 30, 2004 10:38 AM
Subject: Re: [GENERAL] delete with index scan
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Have you considered a join?
delete from t1 where pkey = t2.pkey;
Also, it appears you never ANALYZEd t2, maybe that would help?
On Tue, Nov 30, 2004 at 04:55:58AM -0500, [EMAIL PROTECTED] wrote:
> I have a table t1 with a primary key column pkey, and a table t2, with a
> primary key column pkey
I have a table t1 with a primary key column pkey, and a table t2, with a
primary key column pkey. Is there a way to make the following delete use the
indexes?
delete from t1 where pkey in (select pkey from t2);
NOTICE: QUERY PLAN:
Seq Scan on t1 (cost=0.00..6616238.99 rows=660239 width=6)
S