I really don't understand promises about waits in case of concurrent data access.
All manuals operate by term lock. No one explains that lock probably causes SQL clients waiting for lock acquisition on the server side (and it can take seconds / minutes / infinity)?
Are there cases when locks don't cause waits? I can imagine:
- probably
READ UNCOMMITTED
in some situations, like there are no DDL? - error is reported without waiting...
- no one waits but first who does
commit
wins, other fail on theircommit
I reviewed JDBC API: it mentions literally:
SQLTimeoutException - when the driver has determined that the timeout value that was specified by the setQueryTimeout method has been exceeded and has at least attempted to cancel the currently running Statement`
According to the docs timeout is detected on the client side. Widely used client API doesn't have influence on server side timeouts (including caused by locks). Probably you can set some proprietary connection properties to influence DB behavior.
I see some proprietary SQL extensions, like:
- https://learn.microsoft.com/en-us/sql/t-sql/statements/set-lock-timeout-transact-sql
SET LOCK_TIMEOUT timeout_period
- https://www.postgresql.org/docs/13/runtime-config-client.html
set lock_timeout ms
&set statement_timeout ms
For me DB waits due to locks is such a grey area. Does a lock mean a wait?