DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Truncating tables - slow

  1. #1
    Join Date
    Sep 2000
    Location
    VA
    Posts
    343

    I am trying to truncate all the tables in my database before doing an import. There are like around 150 tables and I have a procedure to do it which fetches each tablename and then executes a DELETE statement.
    But it has been like an hour since I started the process and it still is executing( I think so..) But it never used to take this much time. Can anyone think of a reason for this?

    Shiva.

  2. #2
    Join Date
    Nov 2000
    Posts
    344
    Delete Statements are slow because they can be rolled back.

    Use TRUNCATE TABLE ...; It is much faster.

    To use this command in a stored procedure you will have to use execute immediate, like this :

    execute immedate('truncate table mytable');

    -John

  3. #3
    Join Date
    May 2001
    Location
    California
    Posts
    11
    Try
    truncate table ...

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