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 last published in December 2005

Dig Deeper on Oracle and SQL

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close