4 ms·
I think you really don't want to keep a transaction > 5 hours open. > For our setup/task (just update few fields on a table) the process of probing different b
by chrisandchris 4y ago
I think you really don't want to keep a transaction > 5 hours open.
> For our setup/task (just update few fields on a table) the process of probing different batch sizes & Sidekiq thread numbers with couple of thousands/millions records took about 5 hours [...]
- jaggederest 4y agoI've seen transactions (pathologically) held open for weeks with no huge issues. Postgres is amazing. You're 100% right that you should not do it though. Also little things like if you have more than some very large number of transactions while one transaction is open, things start to break down.
- zzzeek 4y agoyou certainly dont want to autocommit every row at a time as depending on backend that will slow you down by a large margin. this rails feature that runs a bulk update/insert I would assume is certainly doing so within either a single tranasction, or a set of relatively few per-chunk transactions.
- chrisandchris 4y agoNo, you don't. You want to commit a set of statements that is a business transaction.