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 > DB2 > Locking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-12-08, 06:18
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
Locking

I have a query which goes something like

select * from FINAL TABLE (insert into table A values (default,b,c))

Basically i want to select the inserted query (the table A has some autogenerated identity columns which i need to select)
Taking into consideration concurrent users in the system, i needed to know

1. Will this query run fine in a concurrent user scenario
2. If Step 1 is true, does the query obtain a table level lock or a row level lock on table A.
__________________
IBM Certified Database Associate, DB2 9 for LUW
Reply With Quote
  #2 (permalink)  
Old 11-13-08, 00:53
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
The query you have posted will take an exclusive lock on the row that is inserted, and will work fine for multiple concurrent users. If you have a lot of other queries trying to select data from the table at the same time without benefit of an index (i.e., they will use a table scan), then you might want to consider this setting to reduce contention even further:

db2set DB2_SKIPINSERTED=ON
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 11-13-08, 01:20
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
Thanks, that was helpful, and that introduced me to DB2_SKIPINSERTED... time to go and do further research...
__________________
IBM Certified Database Associate, DB2 9 for LUW
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