Subject Re: [firebird-support] Explanation of entry in Monitoring Tables
Author Slalom
thank you.



----- Original Message ----
From: Helen Borrie <helebor@...>
To: firebird-support@yahoogroups.com
Sent: Monday, November 3, 2008 5:46:09 PM
Subject: Re: [firebird-support] Explanation of entry in Monitoring Tables


At 10:08 AM 4/11/2008, you wrote:
>I am seeing a record in the monitoring tables which looks suspicious
>and would like some explanation, if possible. The query I am issuing
>is:
>
>Select *
>from Mon$Statements ms
>join mon$attachments ma on (ma.mon$attachment_ id = ms.mon$Attachment_ ID)
>join mon$transactions mt on (mt.mon$attachment_ id =
>ms.mon$attachment_ ID)
>
>I am seeing a set of records with the same mon$attachment_ id with an
>SQL statement populated in Mon$SQL_Text, but the mon$transaction_ id is
>null and the mon$state is 0.
>
>Shouln't there be an associated transaction with this record or is this
>entry pointing to some other issue?

It's a prepared statement that no transaction is currently executing. It is just waiting until that attachment decides to execute it again.

If it's a parameterised statement that the application needs to run repeatedly with a variety of parameter assignments in the WHERE clause, then keeping it prepared is good -- recommended practice in general.

If the app is constructing static SQL each time it wants that set or operation, then keeping such a statement prepared after the commit or rollback is a pointless leakage of resources, although it's not interfering with transaction accounting. Smart native interfaces like IBO or Jaybird will usually clean up after such statements under most conditions; otherwise you will want to take care of the unprepare explicitly, especially if attachments are long-lasting or beyond your control.

./heLen



[Non-text portions of this message have been removed]