Subject Re: [Firebird-Architect] Stored Procedures, Index Statistics and Plans
Author Ann W. Harrison
Ian,


> When a database is created from script, the tables are typically
>empty when the stored procedures are created. At this time the
>statistics for all the indexes are the same (0).

Ideally, when a database is created from a script, the indexes will
be left inactive until the data is loaded. That makes the load
more efficient and ends up with good statistics.


> Does this mean that the optimal plan will never be selected until
>the both the index statistics are recalculated and the stored
>procedures are recompiled?

Procedures are compiled twice, once from PSQL to BLR and second
from BLR to an executable format. The plan is defined in the
second compilation, so it is created on first reference after
server startup.


> If this is the case, is there any way to automatically re-compile

Regards,


Ann