[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-02-01 Thread 一首诗
Thanks a lot! I tried pg_top and found locks been hold by "idle transaction", and then I found that I forgot to close a session! On Jan 30, 9:43 am, Gunnlaugur Briem wrote: > Another quick way of troubleshooting hangs is the tool pg_top, in > which you might see a process in the state “Idle in

[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-01-30 Thread 一首诗
Your advice sound reasonable. That means I have check the transaction **before** the hanged commit, maybe I forgot to commit or close a session at that time. On Jan 31, 7:55 am, Gunnlaugur Briem wrote: > You probably don't have to add locks in your code. The database system > takes locks on beha

[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-01-30 Thread Gunnlaugur Briem
You probably don't have to add locks in your code. The database system takes locks on behalf of your code (in operations initiated by your code) as necessary to ensure transactional consistency. That's one of the benefits of an RDBMS. What you do have to do is to make sure that those database lock

[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-01-29 Thread 一首诗
Yeah, there might be another transaction modifying the same data (actually the same line of data in database). But I didn't expect that might cause problem before! Oh, if that's true, then I have to add some lock in my code to avoid that. That's a big problem. On Jan 29, 10:13 pm, Alex Brasetvi

[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-01-29 Thread Gunnlaugur Briem
Another quick way of troubleshooting hangs is the tool pg_top, in which you might see a process in the state “Idle in transaction”. This state means that some database operations have been performed in a transaction on that connection but the transaction has not yet been committed. Those database