I have a SQL query going to an Informix DB, which initially takes up to three minutes to complete, regardless of the size of the data returned.
If I call the query again, even with completely different parameters, within the next 10 minutes, it completes within seconds.
It feels like the SQL is being compiled and cached, but I don't understand how one relatively simple query should take three minutes to compile and then only a few seconds to execute:
SELECT *
FROM internet:ref_referrals inner join internet:crvet_application on internet:ref_referrals.ref_reference=internet:crve t_application.referral_no
WHERE date(ref_enter_date) between '2007/01/01' and '2007/01/30'
The problem does not seem to appear on any other queries. ANY ideas would be greatly appreciated.