Exclusive-Locks

mayur_kovle

New Member
Is there any utility by which I can check for the number of active exclusive-locks whilw carrying out any transactions.
Also is it possible to check that which lock is currently applied on which table.
 
You need ProTop!

From the Record Locks help:

This screen shows information about record locks. BE CAREFUL!!! it can be very slow on a large production system and there may be a performance impact on users from running this screen! This is probably most useful in development environments.

Code:
Record Locks
  Usr Name              Recid Duration Table                Type    Chain Flags
----- ------------ ---------- -------- -------------------- ---- -------- -----
  393 tom            25830872 00:00:00 order                REC      1206 S
  929 jami           25830873 00:00:00 order                REC      1207 S
 1401 julia          25830874 00:00:00 order                REC      1208 S
 1414 peter          25830871 00:00:00 order                REC      1205 S
 4153 emily             61829 00:00:00 holiday              REC      2368 S
 4686 tiger           6058307 00:00:00 warehouse            REC      4932 X   L
 4686 granite        20560335 00:00:00 inventory            REC      6222 X   L
 4686 tucker         20625600 00:00:00 inventory            REC      1675 X   L
 4153 lauria            61829 00:00:20 control              REC      2368 S
  393 carol          25830872 00:00:20 order                REC      1206 S
 1401 don            25830874 00:00:20 order                REC      1208 S
  929 tom            25830873 00:00:20 order                REC      1207 S
 1414 mike           25830871 00:00:20 order                REC      1205 S
  431 tim            31297274 00:00:00 order-line           REC      2522 X   L
  431 steph          31297275 00:00:00 order-line           REC      2523 X   L
  431 steve          48376277 00:00:00 employee             REC      7405 X
  431 stacey         30982808 00:00:00 order-line           REC      7192 X   L
  431 tom                   0 00:00:00 order-line           TAB     10495 IX  L
  431 tucker         30982814 00:00:00 order-line           REC      7198 X   L
  323 tiger          48376523 00:00:00 employee             REC      7651 S
 
Do you have any idea why a for each _lock takes so much time. (-L 51200 and still it puts the cpu at nearly 50% and takes like 5 minutes to complete).

I can read in the same time much much more records on non vst tables....

Regards,

casper.
 
_Lock has always been a problem. You need to be very careful with that VST.

The correct code is:
Code:
for each _lock [b]WHILE[/b] _lock-recid <> ?:
  /* do something */
end.

I believe that the reasons for it being slow have to do with the lock table being a very dynamic entity -- rapid changes mean that a lot of synchronization has to go on behind the scenes.
 
Wow, that makes a major improvement. (I had 1 lock in my testenvironment, is now retrieved in 100 ms).

But why would the while construction be so much faster then a where construction?

There is no apparant reason for it when I look into the XREF output.


Tx,

Casper
 
There are no indexes on VSTs. Internally the _Lock VST is a linked list rather than an ordered collection. The WHILE just says that as soon as you find an unknown recid you're done.

It is possible to have a FOR EACH WHERE that never completes on _Lock. I'm guessing that that is because new entries can get added faster than you can process them with 4gl...
 
Would a preselect work on this?

That's an interesting idea.

I sort of doubt it though -- the WHILE "works" because it, essentially, turns the FOR EACH into a do loop with a FIND NEXT and an exit clause. I have a feeling that PRESELECT isn't going to be any different than FOR EACH.

But feel free to test it and let us know!
 
Back
Top