Hi people,
What are the recommended ways to do transactions in web applications?
Right now I have persistent database connections, but currently they are
shared by multiple sessions. So I make sure that database level
transactions are closed after each page/http request.
In theory I could tie database connections to sessions, but then if I have
1000 outstanding (not necessarily active) sessions that would mean 1000
database connections, and 1000 postgres backend processes right? Ouch!
Because of this it looks like I may actually have to do application level
transactions instead of being able to rely solely on database level
transactions.
Am I missing something? Are there better/good alternatives?
Would it be possible to "name" transactions and continue them from other
database connections? Sounds impractical tho- what happens if two
connections try to continue a transaction at overlapping times :) (user
opens up multiple browsers from one page).
Cheerio,
Link.