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

Thread: DELETE takes too long

  1. #1
    Join Date
    Jun 2001
    Posts
    243
    I'm trying to DELETE FROM owner.table_name; about 60000 records from one table and it's taking forever. Is there any way that I can speed this up?
    What can I check to see if there are anything wrong with this performance? This is on Oracle 817 and Solaris 8.

  2. #2
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    look at the explain plan of your delete query...
    some questions : how many lines in your table ? are your stats up-to-date if you're using cbo ? are you deleting with a where clause involving an indexed column ?

  3. #3
    Join Date
    Jun 2001
    Posts
    243
    how do I check the explain plan?
    what do you mean by how many lines in table?
    table is anaylized this morning
    I think I'm using CBO, not sure.
    I'm running this command:
    SQL> delete from owner.table_name;

    no where clause or indexes used for this delete statement.

    sorry if I sound like stupid..but....it's better to learn and ask if I don't know rather than just being quiet.

  4. #4
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    if you just wish to delete the whole content of your table, you can truncate your table (truncate table ...), it will be much faster, but be cautious since you won't be able to rollback the truncate.

    PS : to see the optimizer mode :

    select value
    from v$parameter
    where name = 'optimizer_mode';


  5. #5
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Also check if an unindexed foreign key constraint is referencing the table. This might lower the speed significantly.
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  6. #6
    Join Date
    May 2002
    Location
    USA
    Posts
    462

    Wink

    try setting nologging for a table and indexes which u are deleteing and try deleting records from the table . this will stop data entering into redo logs .

    this may improve your operation .
    siva prakash
    DBA

  7. #7
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Originally posted by prakashs43
    try setting nologging for a table and indexes which u are deleteing and try deleting records from the table . this will stop data entering into redo logs .

    this may improve your operation .
    No. NOLOGGING works only for some special statements. Never for DELETE.
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  8. #8
    Join Date
    Jun 2001
    Posts
    243
    TRUNCATE cannot be an option here. I have 6 FK and non of them are indexed.....I guess this is the big performance degradation?!? How do I index on my FK?

  9. #9
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    I think (I guess) you could disable these FKs and try TRUNCATE.
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  10. #10
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    ales is correct.

    Look here for one of jmodic's rants about NOLOGGING

    http://www.dbasupport.com/forums/sho...9&pagenumber=2

    As others have noted...

    - Check for un-indexed FKs to this table or ones with ON DELETE clauses

    - Check for DELETE triggers on this table

    - Check how this table is stored. Is it all on one physical disk? Is the PCTFREE set way to high, so that it takes up far more room than necessary... those types of things

    - If you don't mind the inability to rollback the DELETE, use TRUNCATE instead.

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

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