Subject First Time the file open it is very slow....
Author pwatel
I will try to make this long story as short as possible.

I insert in a newly created (empty) Database about 25,000 records and the main table is has about 33 fields (the TITLES table below). I first deactivate indexes then reactivate them after the mass INSERT.I use local or embedded it is not a network traffic

The first time I load the data it takes an enormous amount of time. There after when I close (or reboot), and re-run the same application that file behaves as expected i.e. it selects the data in a reasonable amount of time. I have included a profiler data. I even made a test to avoid server cache
effect, to reboot the machine re-run it and load again with ok time.
1st time
22/07/2010 10:23:15 42,453 sec SQL Execute: SELECT T.* FROM TITLES T
2nd time (may be cache effect) but I close the application

2rd time (after a reboot)
22/07/2010 10:28:14 2,922 sec SQL Execute: SELECT T.* FROM TITLES T

And if I do a back up and restore
Prior the file is 39392Kb after it is 30912Kb and load in very little time
22/07/2010 10:48:58 1,640 sec SQL Execute: SELECT T.* FROM TITLES T


Usually the back up is very quick but there again on the first time it stoles and get stuck as well, when it writes that table the first time, but it works eventually.
If I repeat backup again it is very very fast.

Do you you have any idea what is going on or you could indicate me a forum where I can ask.

I have bee using Firebird for years and I have never seen such behavior

So I do not get it
1) Why there is with the same code and the same file a big select difference in time ONLY the first time ever to be used
2) Why after a backup/restore it is instant

It feels as if the database is "corrupted" for a while, sorts itself out & recover or regenerate its indexes and then all is fine and behaves normally from then on....

I am at a loss here please help or indicate me a forum

Thank you regards
Philippe Watel