Subject | Slow join with mon$ tables |
---|---|
Author | Douglas Tosi |
Post date | 2009-02-19T13:46:32Z |
Hello,
I found two issues regarding the monitoring tables and a large amount
of statements.
The following tests were made on 64bit Vista using 64bit Firebird 2.1.2 RC1.
This database has 200 attachments. Each attachment has 1 transaction
and 50 statements allocated. That's a total of 10.000 statements
allocated on server.
1) While firebird sits idle, just holding all this attachments and
statements, it's consuming 871MB. If I run a simple select * from
mon$attachments, allocated memory rises to 1.247MB. When I commit,
memory is back at 871MB.
Is this normal? It's ~50% increase in memory for a very simple select.
Should I report to the tracker?
2) Joining mon$ tables with this number of statements is really slow.
For example:
select
mst.mon$timestamp time_started,
mst.mon$sql_text sql_text,
mios.mon$page_reads page_reads
from mon$statements mst
left join mon$io_stats mios
on mios.mon$stat_id = mst.mon$stat_id
and mios.mon$stat_group = 3
where mst.mon$attachment_id <> current_connection
uses this plan:
PLAN JOIN (MON$STATEMENTS NATURAL, MON$IO_STATS NATURAL)
and takes ~10s to execute. If I fetch all, it takes ~60s.
Anyway I can speed up such query? Besides joining them on the client?
Thanks,
--
Douglas Tosi
www.sinatica.com
I found two issues regarding the monitoring tables and a large amount
of statements.
The following tests were made on 64bit Vista using 64bit Firebird 2.1.2 RC1.
This database has 200 attachments. Each attachment has 1 transaction
and 50 statements allocated. That's a total of 10.000 statements
allocated on server.
1) While firebird sits idle, just holding all this attachments and
statements, it's consuming 871MB. If I run a simple select * from
mon$attachments, allocated memory rises to 1.247MB. When I commit,
memory is back at 871MB.
Is this normal? It's ~50% increase in memory for a very simple select.
Should I report to the tracker?
2) Joining mon$ tables with this number of statements is really slow.
For example:
select
mst.mon$timestamp time_started,
mst.mon$sql_text sql_text,
mios.mon$page_reads page_reads
from mon$statements mst
left join mon$io_stats mios
on mios.mon$stat_id = mst.mon$stat_id
and mios.mon$stat_group = 3
where mst.mon$attachment_id <> current_connection
uses this plan:
PLAN JOIN (MON$STATEMENTS NATURAL, MON$IO_STATS NATURAL)
and takes ~10s to execute. If I fetch all, it takes ~60s.
Anyway I can speed up such query? Besides joining them on the client?
Thanks,
--
Douglas Tosi
www.sinatica.com