[KLUG Members] mysql and locking reads

Adam Tauno Williams members@kalamazoolinux.org
Wed, 25 Feb 2004 14:44:33 -0500


> What happens in a real (or imaginary) database then when the program is
> an html (read non-persistent) program and someone selects for update and
> then never writes (updates and releases) or releases (?some sql
> command?) In the programming I'm used to if you lock and then end the
> program, the release automatically occurs. 

If the connection terminated normally, the locks would be released.  If the
client end of the connection abended it would take until the IP
connection/socket timed out, and the locks should be released (theoretically
anyway).

> Would the lock remain until
> some sort of timeout?? or forever, which is a mighty long time.

SQL92 specified that there IS a timeout on the engine side,  so even if the
client maintained the connection the locks would be released anyway after a
'reasonable' amount of time.  What exactly the timeout is depends upon
implementation.