DELETE
- [Specification] LIMIT cannot be used in the DELETE statement. The WHERE condition should be used to specify the target row to be deleted.
- [Specification] Multi-table deletion is not supported.
Multi-table deletion indicates that multiple tables are deleted in a single SQL statement.
- [Rule] The DELETE statement must contain the WHERE clause to avoid full table scan.
- [Rule] Do not use ORDER BY or GROUP BY in the DELETE statement to avoid unnecessary sorting.
- [Rule] Use TRUNCATE instead of DELETE to clear a table.
TRUNCATE creates a new physical file and physically deletes the original file when the transaction ends to clear the disk space. However, the DELETE statement marks data in the table and does not clear the disk space until the VACUUM FULL phase.
- [Recommendation] If DELETE is executed on a table that has a primary key or index, the WHERE condition must be used together with the primary key or index to improve execution efficiency.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot