Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > Re: Update Stat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 8876 of 9520
Post > Topic >>

Re: Update Statement and frequent commits

by Serge Rielau <srielau@[EMAIL PROTECTED] > May 11, 2008 at 09:56 PM

Michel Esber wrote:
> Ok .. I know I sent a bad example. Here´s another try:
> 
> update T set field = 'new_value' where (ID) in (select ID from T where
> field1='xyz'  and field2 = 'foo'  fetch first 1000 rows only)
> 
> However , the plan has two index scans. Is there any better solution
> with a single scan ?
> 
> The delete statement posted before has only one index scan ... Can I
> achieve the same with update ?
Yes. The trick is to use the select as the update target, just as the 
delete is.
UPDATE (SELECT ....) AS T SET ...

Cheers
Serge

-- 
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
 




 3 Posts in Topic:
Update Statement and frequent commits
Michel Esber <michel@[  2008-05-11 09:54:44 
Re: Update Statement and frequent commits
Michel Esber <michel@[  2008-05-11 18:12:30 
Re: Update Statement and frequent commits
Serge Rielau <srielau@  2008-05-11 21:56:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 20:47:39 CST 2008.