TurboDB Engine Documentation

Monitoring Table Usage

Previous  Top  Next


Because locks can have an impact on program performance and sometimes even prevent a program from working correctly (if there is a deadlock), you may sometimes want to monitor the various applications and users that access a given table. This can be done by looking into the *.net file of the table, which contains all necessary information.

TurboDB Viewer has a menu command Tools/Table Usage, which shows the table usage monitor.

clip0003

Another method to check the contents of the net file is the command line tool TdbLocks.exe, which is available for Linux and Windows in the download section of the dataweb homepage.

If you want to check the table usage programmatically, you can do that if you are working with the VCL components in Delphi using the TTdbTable.GetUsage method. (ADO.NET works with a disconnected data model and therefore does not care much about sessions using a table.)

No matter, how you look into the net file, the information found is always the same:

First there is the per-table information:

Session Count

Number of connections currently using that table

Update Count

Number of modifications to the table since the first connection to it has been opened

Lock Count

Number of sessions having acquired a read lock to that table. If the lock count is -1, that means one session has a write lock to the table

Wait Count

Number of sessions currently waiting to be assigned a lock

Upgrade Wait Count

Number of sessions being in possession of a read lock and waiting to receive a write lock

 

Then there is the per-session information:

Session Name

Human-readable name for a session for easier identification. The name can be defined programmatically with the database component or is chosen automatically to be ConnXXX, where XXX is some random number.

Session Id

Automatically determined unique identifier for the session

Editing Record

The record, the session is currently editing (if any)

Lock Count

Corresponds to the total lock count in the per-table information. Can obviously only take on the values -1, 0, 1.