Subject Re: [firebird-support] Slow join with mon$ tables
Author Dmitry Yemanov
Douglas Tosi wrote:
>
> 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.

What do you mean by "allocated memory"? Physical or virtual one?
What size is file <host>.mon in the FB root directory?

> Is this normal? It's ~50% increase in memory for a very simple select.
> Should I report to the tracker?

Your very simple select creates a monitoring snapshot for 10K objects
which is preserved until a transaction ends. But anyway, it shouldn't be
the physical memory, so it's unlikely to be a real problem.

> 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.

Could you please check the latest snapshot and tell us whether there's a
difference?


Dmitry