Explain analyze on the select statement that is the basis for temp table data takes forever. I turned off enable_seqscan but it did not have an effect
From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Sriram Dandapani
Sent: Monday, April 17, 2006 11:37 AM
To: Pgsql-Performance (E-mail)
Subject: [PERFORM] creating of temporary table takes very long
create temporary table c_chkpfw_hr_tr_updates as
select * from c_chkpfw_hr_tr a
where exists(select 1 from chkpfw_tr_hr_dimension b
WHERE a.firstoccurrence = b.firstoccurrence
AND a.sentryid_id = b.sentryid_id
AND a.node_id = b.node_id
AND a.customerid_id = b.customerid_id
AND coalesce(a.interface_id,0) = coalesce(b.interface_id,0)
AND coalesce(a.source_id,0) = coalesce(b.source_id,0)
AND coalesce(a.destination_id,0) = coalesce(b.destination_id,0)
AND coalesce(a.sourceport_id,0) = coalesce(b.sourceport_id,0)
AND coalesce(a.destinationport_id,0) = coalesce(b.destinationport_id,0)
AND coalesce(a.inoutbound_id,0) = coalesce(b.inoutbound_id,0)
AND coalesce(a.action_id,0) = coalesce(b.action_id,0)
AND coalesce(a.protocol_id,0) = coalesce(b.protocol_id,0)
AND coalesce(a.service_id,0) = coalesce(b.service_id,0)
AND coalesce(a.sourcezone_id,0) = coalesce(b.sourcezone_id,0)
AND coalesce(a.destinationzone_id,0) = coalesce(b.destinationzone_id,0));
This takes forever (I have to cancel the statement each time)
c_chkpfw_hr_tr has about 20000 rows
chkpfw_tr_hr_dimension has 150K rows
c_chkpfw_hr_tr has same indexes as chkpfw_tr_hr_dimension
For such a small data set, this seems like a mystery. The only other alternative I have is to use cursors which are also very slow for row sets of 10- 15K or more.