databaseManager.getDataSetByQuery

I use databaseManager.getDataSetByQuery to execute a query. On the initial use of this command the query is really slow. After the initial use the query is very quick. This is odd because it’s only happens when I use sql to get data from db to create a new foundset. Is there a way to refresh or update the sql connection before executing this command. I have tried a manual “Select 1” query in code and have tried refreshing records from db before executing. This query should execute very quickly as it does after the initial one. Is servoy caching the query?

Thanks

lhale:
I use databaseManager.getDataSetByQuery to execute a query. On the initial use of this command the query is really slow. After the initial use the query is very quick. This is odd because it’s only happens when I use sql to get data from db to create a new foundset. Is there a way to refresh or update the sql connection before executing this command. I have tried a manual “Select 1” query in code and have tried refreshing records from db before executing. This query should execute very quickly as it does after the initial one. Is servoy caching the query?

Thanks

databaseManager.getDataSetByQuery does not cache stuff; can you try to execute the query from an external tool and see how it behaves ? Maybe the db engine caches the query. Also, maybe indexes can be improved.

I actually run this twice getting data for two foundsets in my method. Each time I run this set of queries it is for different data. I think we might be able to rule out mysql caching the query.

Showing rows 0 - 22 (23 total, Query took 0.0017 sec)
Showing rows 0 - 10 (11 total, Query took 0.0022 sec)

If the user chooses to execute these queries for other data after the initial query I get performance similar to mysql perfomance. As long as the client stays open this query runs great after the initial run.
However, if i close the client then the query is slow for the first run.

How much time it takes at the initial run ? Which is the initial query ?

The initial queries I should say run in about 30 seconds. I run a method that runs two sql queries. The first time this method is executed it takes a lot longer. Then after the method has been ran once, it runs with the times above. The times above are the results of each query within the method when ran directly on the backend. These queries always run fast when ran through the backend at any time.
Something within the Jconnector or servoy is my guess.

lhale:
The initial queries I should say run in about 30 seconds. I run a method that runs two sql queries. The first time this method is executed it takes a lot longer. Then after the method has been ran once, it runs with the times above. The times above are the results of each query within the method when ran directly on the backend. These queries always run fast when ran through the backend at any time.
Something within the Jconnector or servoy is my guess.

30 seconds is a very large amount; you can add a case with a sample to our support system and we’ll have a look.