Cache

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
[email protected]
Posts: 2
Joined: Wed 11 Feb 2015 14:28

Cache

Post by [email protected] » 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?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Cache

Post by azyk » Thu 12 Feb 2015 11:47

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.

[email protected]
Posts: 2
Joined: Wed 11 Feb 2015 14:28

Re: Cache

Post by [email protected] » 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.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Cache

Post by azyk » Tue 17 Feb 2015 12:09

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)?

Post Reply