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.

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

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: