Thanks. I have fixed the problem. And now the query can run in 4 mins for 1.5 million records in TABLE1 and 0.5 million records in TABLE2. The solution is I created a function that gets all event_id from TABLE2 then travel through each event_id and do the update for TABLE1. This removes the side
effects of using IN predicate. Also I have 1. set FILLFACTOR = 70 2. remove trigger and index before the function, create index based on event_id 3. add trigger and index back after run function. Regards, Haiming From: BladeOfLight16 [mailto:bladeoflight16@xxxxxxxxx]
I don't believe you can use JOIN explicitly in this situation because it's an UPDATE, but I believe you can accomplish the same effect with FROM and WHERE. On Sun, Jul 14, 2013 at 7:03 AM, Vincenzo Romano <vincenzo.romano@xxxxxxxxxxx> wrote: 2013/7/14 Haiming Zhang <Haiming.Zhang@xxxxxxxxxxxxxx>: > Hi All, A JOIN would solve your speed problem. If you are not an authorised recipient of this e-mail, please contact me at Redflex immediately by return phone call or by email. In this case, you should not read, print, retransmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments are confidential and may contain privileged information and/or copyright material of Redflex or third parties. You should only retransmit, distribute or commercialise the material if you are authorised to do so. This notice should not be removed. |