Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Tom Lane
Aaron Turner writes: > I know the costs are just relative, but I assumed > cost=19229.08..29478.99 isn't 5 minutes of effort even on crappy > hardware. Very likely the bulk of the time is spent in the DELETE work proper, not in the query to find the rows to be deleted. In particular I wonder if

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Aaron Turner
On Tue, Jun 16, 2009 at 6:36 PM, Robert Haas wrote: > On Tue, Jun 16, 2009 at 9:23 PM, Aaron Turner wrote: >>  DELETE FROM muapp.pcap_store AS x >>        USING muapp.pcap_store AS a >>        LEFT JOIN muapp.pcap_store_log b ON a.pcap_storeid = >> b.pcap_storeid WHERE x.pcap_storeid = a.pcap_stor

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Aaron Turner
On Tue, Jun 16, 2009 at 6:36 PM, Robert Haas wrote: > On Tue, Jun 16, 2009 at 9:23 PM, Aaron Turner wrote: >>  DELETE FROM muapp.pcap_store AS x >>        USING muapp.pcap_store AS a >>        LEFT JOIN muapp.pcap_store_log b ON a.pcap_storeid = >> b.pcap_storeid WHERE x.pcap_storeid = a.pcap_stor

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Robert Haas
On Tue, Jun 16, 2009 at 9:23 PM, Aaron Turner wrote: > On Tue, Jun 16, 2009 at 5:30 PM, Robert Haas wrote: >> On Tue, Jun 16, 2009 at 7:39 PM, Aaron Turner wrote: >>> On Tue, Jun 16, 2009 at 2:37 PM, Alvaro >>> Herrera wrote: Aaron Turner escribió: > I'm trying to figure out how to optimiz

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Aaron Turner
On Tue, Jun 16, 2009 at 5:30 PM, Robert Haas wrote: > On Tue, Jun 16, 2009 at 7:39 PM, Aaron Turner wrote: >> On Tue, Jun 16, 2009 at 2:37 PM, Alvaro >> Herrera wrote: >>> Aaron Turner escribió: I'm trying to figure out how to optimize this query (yes, I ran vacuum/analyze): mu

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Robert Haas
On Tue, Jun 16, 2009 at 7:39 PM, Aaron Turner wrote: > On Tue, Jun 16, 2009 at 2:37 PM, Alvaro > Herrera wrote: >> Aaron Turner escribió: >>> I'm trying to figure out how to optimize this query (yes, I ran >>> vacuum/analyze): >>> >>> musecurity=# explain DELETE FROM muapp.pcap_store WHERE pcap_st

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Aaron Turner
On Tue, Jun 16, 2009 at 2:37 PM, Alvaro Herrera wrote: > Aaron Turner escribió: >> I'm trying to figure out how to optimize this query (yes, I ran >> vacuum/analyze): >> >> musecurity=# explain DELETE FROM muapp.pcap_store WHERE pcap_storeid >> NOT IN (SELECT pcap_storeid FROM muapp.pcap_store_log

Re: [PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Alvaro Herrera
Aaron Turner escribió: > I'm trying to figure out how to optimize this query (yes, I ran > vacuum/analyze): > > musecurity=# explain DELETE FROM muapp.pcap_store WHERE pcap_storeid > NOT IN (SELECT pcap_storeid FROM muapp.pcap_store_log); What PG version is this? -- Alvaro Herrera

[PERFORM] High cost of ... where ... not in (select ...)

2009-06-16 Thread Aaron Turner
I'm trying to figure out how to optimize this query (yes, I ran vacuum/analyze): musecurity=# explain DELETE FROM muapp.pcap_store WHERE pcap_storeid NOT IN (SELECT pcap_storeid FROM muapp.pcap_store_log); QUERY PLAN