JulesVerne
JulesVerne

Reputation: 53

The first DB call is much slower

First call at morning takes 15 seconds,

FOR EACH ... NO-LOCK:

END.

the second call takes only 1,5 seconds. What causes this delay? What can I log to identify it?

Even when I restart the DB I can't reproduce the behaviour of the first call. (In complex queries I measure difference of 15 minutes to 2 seconds)

Upvotes: 0

Views: 237

Answers (1)

Mike Fechner
Mike Fechner

Reputation: 7192

The most likely cause for this will be caching. There are two caches in place:

  • The -B buffer pool of the database which caches database blocks in memory. It is a typical observation, that once this cache is warmed up after a restart of the DB server queries are executing much faster. Of course this all depends on the size of your DB and the size of the -B buffer pool. Relatively small databases may fit into a relatively large -B buffer pool in large parts
  • The OS disk cache will also play it's part in your observation

Upvotes: 2

Related Questions