Re: Help on locking - while flying blind
Posted in 1997
Fuzzy wrote:
>
> Hi people,
>
> The marvels of modern technology have enabled me to get my Informix
> CD, and set it up, all while waiting for the shipping people to
> actually send the manuals.
>
> I have a problem with locks, that is almost certainly covered in said
> manuals, but that I really need to rectify this century (and I'm
> assuming the manuals won't arrive until the next!)
>
> I can't see any system tables that show current locks. I've got an
> app where several people are attempting inserts, and they are banking
> up on lock contention, but I can't actually see where!
>
> Any help on how to view current locks in Informix will be much
> appreciated.
You can look at locks using the onstat (tbstat for 5.0x) utility.
Onstat -k reports locks, the owner column is then looked up in the
onstat -u report under the the address column from this report. Get thesessid corresponding to the owner address and run onstat -g ses <sessid>
(for 5.0x the tbstat -u reports pid rather than sessid and a
ps -fp <pid> will show both the sqlturbo process its parent is your
application which owns the lock). The onstat -g ses report shows the
current and last SQL, the userid, pid, and much other info. You can
then
use ps -fp <pid> to find the application (7.xx has no sqlturbo process
so
the pid here is your app).
I suspect that your tables were created with the default locking level,
page level locking. Try "alter table <mytable> lock mode (row);" on
any table which may experience contention problems. This will reduce
lock contention. Another feature to try is to "set lock mode to wait
<nseconds>;" in your applications so that instantaneous locks do not
block you users.
Art S. Kagel