Opened 6 years ago
Closed 6 years ago
#29620 closed Uncategorized (needsinfo)
Document possible performance benefits from transactions
Reported by: | WGH | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currrently, the documentation says:
Open transactions have a performance cost for your database server. To minimize this overhead, keep your transactions as short as possible. This is especially important if you’re using atomic() in long-running processes, outside of Django’s request / response cycle.
I think it's misleading, as it sounds like transactions are always bad from performance perspective, and autocommit mode is better. While in fact batching DB operations in transactions can have serious speedup, especially when inserting massive amounts of rows. (of course it may have impact on concurrency, but there ain't no such thing as a free lunch)
I'm not sure whether to accept this or not: if the doc-change was good then, sure, yes, great. Otherwise it may just confuse the matter.
I don't think the advice it wrong for the bulk of common cases.
Are you up for making the patch yourself? If so perhaps you could draft something up and open a PR so we can assess whether it makes sense?
I'll close this as
needsinfo
pending that. Please re-open as/when you can expand.Thanks!