Results 1 to 3 of 3

Thread: Locking

  1. #1
    Join Date
    May 2007
    Location
    somewhere in dbforums
    Posts
    221

    Unanswered: 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

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •