SkipDefaultTransaction
set to false
GO-W1004GORM performs write (create/update/delete) operations inside a transaction to ensure data
consistency. Consider disabling it during initialization if it is not required, and it'd
gain about 30%+ performance improvement after setting SkipDefaultTransaction
to true
.
Please note that toggling the SkipDefaultTransaction
from false
to true
might lead
to performance gains but can introduce bugs because, in some cases, ensuring data consistency
might be preferred.
_ = &gorm.Config{SkipDefaultTransaction: false}
_ = &gorm.Config{SkipDefaultTransaction: true}