Hi,
I'm still a little confused.

If I execute this scenario (using FlameRobin and WI-T3.0.0.31369 Firebird 
3.0 Beta 1):

- start transaction
- execute query 1: SELECT * FROM Table1
- execute query 2: SELECT * FROM Table2
- execute query 3: SELECT * FROM Table3
- execute query 4: SELECT * FROM mon$statements WHERE mon$attachment_id = 
CURRENT_CONNECTION

then query 4 will return two rows from mon$statements, one for query 1 (with 
mon$state = 0) and one for query 4 (with mon$state = 1), but I'm interested 
in the entry in mon$statements for query 3, i.e. the last regular query.
How can I achieve this?

Thanks,
Robert

-----Original message/Oorspronkelijk bericht----- 
From: Dmitry Yemanov
Sent: Saturday, March 14, 2015 1:53 PM
To: For discussion among Firebird Developers
Subject: Re: [Firebird-devel] Retrieving plan using new mon$explained_plan 
field (FB3 beta )

14.03.2015 15:38, Robbert-Jan wrote:
>
> I’m trying to retrieve the explain plan of the last prepared query,
> using the mon$explained_plan field, introduced in FB3 beta.
> I used:
> SELECT mon$explained_plan FROM mon$statements WHERE mon$transaction_id =
> CURRENT_TRANSACTION

Wrong. You should use WHERE mon$attachment_id = CURRENT_CONNECTION instead.

The mon$transaction_id gets assigned when the query starts to execute,
i.e. it containts NULL for a just prepared query.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to