If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Update Select and locking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-24-10, 05:58
harry1234 harry1234 is offline
Registered User
 
Join Date: Sep 2010
Posts: 2
Update Select and locking

Hello,

I have a question concering update statements and locks.

I executed a statement like that

Code:
update table set field = NVL((select field from othertable as cart where field= othertable.field and ....)," ")
What I got is a mail from our DB Admin, that says that I'm holding 4.798.581 locks and that I should avoid such large transactions because the transaction log will overflow and prevent other statements from being executed.

So my question:
Is there an implicit transaction created? I assumed that there will be one row locked, updated and then released again.

Can please anybody explain what was going on while executing this statement?

Thank you.


Harry
Reply With Quote
  #2 (permalink)  
Old 09-24-10, 15:40
InformixWilli InformixWilli is offline
Registered User
 
Join Date: Sep 2010
Location: Germany, Brunswick
Posts: 52
Which table had the locks? The "table", "othertable" or both?
Your DBA should know/find out this.

If you update a lot of rows and nobody else works with this table now, its better to lock the table in exclusive mode:
lock table tab1 in exclusive mode;

But that should not cause the problem...

Whats your isolation level?
Reply With Quote
  #3 (permalink)  
Old 10-05-10, 03:33
harry1234 harry1234 is offline
Registered User
 
Join Date: Sep 2010
Posts: 2
Sorry for the late answer, but I had my summerholiday .
I#m actually not quite sure what kind of locking they use. Our admin is out of office at the moment.

What I dont know, is if the query is somekind of "atomic". When I start the update, is there an transaction started? Will there be a rollback if one of the updates fails? I think no. But if not where do all the locks come from?

I thought one row is getting locked, updated and then the lock being released.

???
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On