Q

COMMIT after deleting X records

I would like to know if there is an automatic way or command to do a COMMIT after deleting X records. If I have 1 million records to delete, what is the best way to delete and keep good perfomance?

I would like to know if there is an automatic way or command to do a COMMIT after deleting X records (i.e., DELETE

FROM CUSTOMERS AND COMMIT ON {number}?) If I have 1 million records to delete, what is the best way to delete and keep good perfomance? Thank you.

I don't think there's anything like what you're suggesting. But perhaps you don't need to DELETE. If you need to log the deletes (you know, in case something goes wrong and you need to roll back from the log), fine, but if you just want the table emptied, take a look in your database manual for the TRUNCATE TABLE command. It is extremely fast, because it removes all rows without logging. I don't know whether every database system has this command, but SQL Server, MySQL, and Oracle do.

This was first published in December 2005

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close