Re: Is it faster if I use UPDATE WHERE CURRENT OF clause
Posted in 1996
>From: Appala.Naidu@KSNCABP03.SNSGATE.sprint.com >Date: Wed, 18 Dec 1996 21:55:00 -0500 >X-Informix-List-Id: <list.12443> > >If I declare a cursor <cname> for update and subsequently use update WHERE >CURRENT OF <cname>, will I get a much improvement in performance ? It is somewhat faster, though whether it is significant is open to some debate. It may depend on circumstances. If you don't use UPDATE WHERE CURRENT then you have to specify some unique way of identifying the row you wish to update (the primary key, presumably), and the engine has to search for that row from scratch. This is usually slower, especially if the table is big. > Or is it only guarantees a lock ? The lock is guaranteed not by the UPDATE statement but by the fact that the cursor was opened FOR UPDATE. (MODE ANSI databases always open cursors FOR UPDATE, even when the FOR UPDATE is not added). The fact that you acquire a lock on the row when it is fetched reduces the chance of you getting a locking error when you do the UPDATE. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>