Subject Re: [ib-support] Re: Slow first 'Query'
Author Paul Beach
Phil,

> Would it load the triggers into memory if the triggers were not going to
be
> used (e.g. a SELECT)?

Yes, information about tables is looked up and cached when the relation is
first referenced by a request. When the request is compiled
MET_lookup_relation() in met.e is called for each table reference to check
that the table exists. If the table is not found in the list of cached
tables for the current database, it gets looked up.
If found MET_relation is called to allocate a table block that saves the
metadata information for that table. Then MET_scan_relation is called to
obtain a significant amount of otable information, including all the trigger
code.

> I think you might be onto some thing here. If the first query I do is to
a
> table that has no triggers, it returns as expected, but the first time I
do a
> 'select' that includes one or more tables that have triggers (even if they
> are just before insert ones), the big delay returns.
>
> > Now - does InterBase load all of the Trigger and SP code into memory on
> > first connect with SuperServer, so it can be shared and re-used later.
If
> > it does - that's the answer.

Checked the code, it seems to work as above Classic or SuperServer, there
doesn't seem to any difference (except thread handling) - when the table is
referenced all the tigger information is loaded. Only plus would be that
this would happen less often in SuperServer as the metadata cache should be
shared across users.

Regards
Paul Beach
Main Tel (UK):+44 (0) 1844 354465
Mobile: (UK): +44 (0) 7764 188603
http://www.ibphoenix.com