Alex Rivera | Logout

How to efficiently remove all rows from a table in DB2

Asked 2010-09-01T09:11:12.277
10

I have a table that has something like half a million rows and I'd like to remove all rows.

If I do simple delete from tbl, the transaction log fills up. I don't care about transactions this case, I do not want to rollback in any case. I could delete rows in many transactions, but are there any better ways to this?

How to efficiently remove all rows from a table in DB2? Can I disable the transactions for this command somehow or is there special commands to do this (like truncate in MySQL)?

After I have deleted the rows, I will repopulate the database with similar amount of new data.

Edit
Report

1 Answer

17

It seems that following command works in newer versions of DB2.

TRUNCATE TABLE someschema.sometable IMMEDIATE  
answered 2010-09-01T12:31:46.647

Your Answer