web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Best way to delete large amount of records from the table

(0) ShareShare
ReportReport
Posted on by 6,478

Hello,

We have a regular table which will be used as a 'tmp' table.

After some processes it will hold around / more than 1m records.

At each new run records should be removed from the table.

Which approach would be best to develop? Just a "delete_from" statement, or we should connect with sql directly and pass the string with Truncate keyword?

Or any other options??

Thanks and regards

I have the same question (0)
  • Martin Dráb Profile Picture
    237,959 Most Valuable Professional on at

    First of all, think carefully whether your design will work in multi-user environment. For example, I could delete all the data while you're using it.

    delete_from is fine if it doesn't roll back to one-by-one processing. That happens when there is business logic involved, such as code in delete() method, or delete actions or database logging. If there are delete actions or code to maintain data consistency, skipping such logic would lead to data corruption. Therefore you should try to design your solution so you can safely delete the records without extra steps.

    Using database log or alerts on such a table probably doesn't make a good sense, but you can explicitly skip them to be sure that any incorrect setup doesn't harm performance.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans