The first request is slow for Firebird

The first query executed on a large dataset in the Firebird database after launching our application is always very slow. Subsequent calls to the same query (this is a stored procedure) are accurate. I suppose this is due to the fact that something is being loaded into memory, but I could do with the explanation that there is something that can be done to get around this problem.

+4
source share
3 answers

If the stored procedure in the first request compiles the stored procedure, it also retrieves buffers and caches the result. In the second request, the procedure does not compile again (preached), and the results are instantaneous (the samples are also in memory for some operating systems, so there is no need for an io disk)

one way is to optimize sp or tables. What are they bigger? (number of records for each table)

one easy way to optimize this is to put a cron script that will run once a day / hour to prefill the caches so that you quickly get sp

+1
source

Maybe this is not about the request, but the connection time (delay) is long? There was such a problem with the [old] Firebird / Interbase engines.

0
source

You did not explain which version of Firebird you are using, but there is an error in version 2.50 (CORE 3227 - slow compilation of stored procedures), which may be the cause of your problem. More details: http://www.firebirdnews.org/?p=5282&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+FirebirdNews+%28Firebird+News%29

0
source

Source: https://habr.com/ru/post/1334893/


All Articles