You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
why gorm perform single create, update, delete operations in transactions by default ? a single sql really need transactions?
are there any specific differences between transactions of a single sql? mysql execute single sql as a implicit transaction
The document you expected this should be explained
Expected answer
The text was updated successfully, but these errors were encountered:
According to the GORM documentation, write (create/update/delete) operations run inside a transaction by default to ensure data consistency. However, you can disable this behavior during initialization if it is not required. Doing so may improve performance by about 30% or more.
Explicit transactions can still be useful in certain situations, even if you disable GORM's default behavior. For example, transactions can help to ensure data integrity by allowing you to roll back changes if something goes wrong during an operation. They can also help with concurrency issues by ensuring that multiple concurrent operations don't interfere with each other.
thanks,i know what you say,but i want to konw why write (create/update/delete) operations run inside a transaction,that can ensure db data consistency。 if don't do it, the db data may will be inconsistent ?? if possible,please for example...
Gorm provides logic-level APIs, such as CreateInBatches, which need to ensure consistency, and users need to choose whether to enable things according to their own needs.
Your Question
why gorm perform single create, update, delete operations in transactions by default ? a single sql really need transactions?
are there any specific differences between transactions of a single sql? mysql execute single sql as a implicit transaction
The document you expected this should be explained
Expected answer
The text was updated successfully, but these errors were encountered: