If you want to quickly empty the table in MySQL, you can use the truncate command.
Truncate is able to quickly and easily erase data without any differences.
The syntax for using truncate in MySQL is
TRUNCATE table [table Name];
The Truncate feature is also available in Salesforce. However, just providing a button does not provide any code and the way the API calls truncate.
So the right scenario should only be used to quickly erase temporary data or test data. After all, it takes a lot of time to delete all of the data, whether using batch or Dataloader.
If you want to see the Truncate button in Salesforce, you need to agree to the following conditions, refer to the official documentation:
- Profile, administrative Permissions, Customize application-True
- User Interface, Setup, Enable Custom Object Truncate-True
Then on the detailed screen of the custom object, you can see the Truncate button next to the Edit,delete button appears.
However, it is not possible for any object to be truncate in any case, as the following requirements refer to the official documentation:
- Cannot be master-detail by another object, or in the master position in a.
- Cannot be referenced by the report snapshot.
- You cannot have a custom field that is either index or external ID.
- The skinny table cannot be opened. (Something about skinny table will be written in another article).
Why this is a limitation, obviously, is related to the truncate action in Salesforce.
In Salesforce, although the TRUNCATE function is similar to MySQL, it is used to empty the data in the table, but it causes the ID prefix of the custom object to change. All functions that refer to this custom object through the three-bit ID prefix will be invalidated. If Apex/vf/button has a logic that directly uses the 3-bit ID prefix for judgment, it will be affected.
Beyond that, the other thing with MySQL is that if there is a self-increment field. After MySQL is truncate, the counter for the self-increment field is reset. and Salesforce doesn't. Yes, although the ID has changed, the number of self-increment fields will not return to the starting value.
Overseas Sync Address: Https://wp.me/p3i9xe-bG
Salesforce empties the database with truncate