Page 1 of 1

Cache

Posted: Wed 11 Feb 2015 14:35
I have a postgresql database and I am accessing it with delphi xe7 and unidac.
When I run an sql in the application the first time it takes a long time (3x longer than it did using odbc and bde).

The second time it is very fast. I was told this has to do the sql being in the cache already. I can't tell my users to run it 2x for it to be faster, any suggestions? What can be done to increase the sql response the first time before it is in the cache?

Re: Cache

Posted: Thu 12 Feb 2015 11:47
by azyk
To find the origin of such behavior, do the following. Using the standard tools, for example pgAdmin, execute repeatedly the SQL query, that is executed slowly for the first time in the application, and fast - for subsequent times. At this, use the credentials of one and the same user for pgAdmin and the application.

If the described behavior is reproduced only when using UniDAC, please create a simple sample to reproduce the problem (including scripts for creating and filling in the test tables), and send it to andreyz*devart*com for investigation.

If the issue is reproduced for both UniDAC and pgAdmin, the reason may be on the PostgreSQL side. In this case, you should refer to the PostgreSQL documentation or forward the question to PostgreSQL developers.

Re: Cache

Posted: Tue 17 Feb 2015 09:28
Thank you for your reply. This is also reproduceable in Postgresql but there it takes less than 66 miliseconds the first time and the second time 61miliseconds.
In Unidac it takes 9 seconds the first time and then 2 seconds the second time.

Re: Cache

Posted: Tue 17 Feb 2015 12:09
by azyk
Could you compose a small sample reproducing such behavior and send it to my email andreyz*devart*com for investigation (including scripts for creating and filling in the test tables)?