First Time a SELECT execute it is very slow....
Posted: Thu 22 Jul 2010 09:07
Hello
I will try to make this long story as short as possible.
I insert in a newly created (empty) Firebird 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.
The first time I load the data it takes an enormous amount of time. There after when I close 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 your 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
Complete
22/07/2010 10:23:15 42,453 SQL Execute: SELECT T.* FROM TITLES T
2nd time (may be cache effect) but I close the application
Complete
22/07/2010 10:25:51 1,172 SQL Execute: SELECT T.* FROM TITLES T
3rd time (after a reboot)
Complete
22/07/2010 10:28:14 2,922 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
Complete
22/07/2010 10:48:58 1,640 SQL Execute: SELECT T.* FROM TITLES T
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
3) How is there 9 meg of difference in before and after the backup/restore and what can I do to eliminate it:
- I do not perform any deletion
- I use auto update may be I should stay away from it and because of commit retaining o r how can I set it to commit period.
It feels as if the database is "corrupted" for a while, sorts itself out recover and then all is fine and behaves normally from then on....
I am at a loss here please help
Thank you regards
Philippe Watel
I will try to make this long story as short as possible.
I insert in a newly created (empty) Firebird 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.
The first time I load the data it takes an enormous amount of time. There after when I close 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 your 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
Complete
22/07/2010 10:23:15 42,453 SQL Execute: SELECT T.* FROM TITLES T
2nd time (may be cache effect) but I close the application
Complete
22/07/2010 10:25:51 1,172 SQL Execute: SELECT T.* FROM TITLES T
3rd time (after a reboot)
Complete
22/07/2010 10:28:14 2,922 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
Complete
22/07/2010 10:48:58 1,640 SQL Execute: SELECT T.* FROM TITLES T
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
3) How is there 9 meg of difference in before and after the backup/restore and what can I do to eliminate it:
- I do not perform any deletion
- I use auto update may be I should stay away from it and because of commit retaining o r how can I set it to commit period.
It feels as if the database is "corrupted" for a while, sorts itself out recover and then all is fine and behaves normally from then on....
I am at a loss here please help
Thank you regards
Philippe Watel