DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: lock during insert

  1. #1
    Join Date
    May 2000
    Location
    Alex, Egypt
    Posts
    41

    lock during insert

    we have a process, which is launched in 32 sessions in parallel, doing parralel insert in couple of tables, during processing I found that there is locks between these processes, specially while inserting in one of the tables.
    I had to recreate the tables being used in the inserts.
    Storage parametres of the table currently are :
    initrans=32
    freelists=32
    pctfree=20
    pctused=40

    and for indexes
    initrans=64
    freelists=64
    pctfree=20

    this table has a primary key but it's generated by a sequence, and it's not referenced by any other table.

    I even tried to launch the process on 16 session only instead of 32, but we still get the same locks.
    I can't find any reason for this lock, It's not row level lock, and it shouldn't be block level lock since the parameters seems to be correct.
    Amir Magdy

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    If you have an index on your sequenced column then it's likely to be the source of your locking problem.

    If this is so, then rebuild the index using the REVERSE keyword to modify it to avoid this problem.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Originally posted by slimdave
    If this is so, then rebuild the index using the REVERSE keyword to modify it to avoid this problem.
    Will that really help?
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  4. #4
    Join Date
    May 2000
    Location
    Alex, Egypt
    Posts
    41
    Can you please explain why a reverse index may solve the problem?

    anyway, I tried it and didn't work
    Amir Magdy

  5. #5
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    The idea is that although you are inserting in the table, you will be updating the index. If the index is on a sequence, then there is a good chance that all the updates will hit the same "leaf" of the index (e.g. 123456, 123457, 123458 are stored together) causing contention. The reverse values 854321, 754321, 654321 are more likely to go into different blocks.

  6. #6
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Its more or like load balancing.. but the Q is will it help in reducing Locking Issues? .. -- NO i guess
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  7. #7
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    If 32 processes are trying to update the same "leaf" there will be contention over the locks.

  8. #8
    Join Date
    May 2003
    Location
    Pretoria, Rep of South Africa
    Posts
    191
    which is launched in 32 sessions in parallel, doing parralel insert in couple of tables, during processing

    Have you checked the values of the parallel init. parameters.
    This could be your problem?
    Able was I ere I saw Elba

  9. #9
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Dapi :

    Well well.. Original Poster said .. "I found that there is locks between these processes" -- Which is not clear as to what he means here.. ( i assumed it to be lockwaits, if so then its basically some design probs )

    In this regard i mentioned "Will that really help (--Reverse Keys )"

    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  10. #10
    Join Date
    May 2000
    Location
    Alex, Egypt
    Posts
    41
    it's not because of the index.
    I dropped the index, but the problem still presist,

    the strange part is that at the begning processes insert records without any problem but after 30,000 record, we start detecting locks, and performance goes down.
    Amir Magdy

Posting Permissions

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


Click Here to Expand Forum to Full Width