creating of temporary table takes very long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux