Update:
Firstly, it doesn't seem to be the connection pooling or gargage collection. The query fails the first time it is run - I was wrong when I thought that it worked first, and then subsequent runs were failing. It just doesn't run. I have tried the connection pooling but no joy.
Secondly, it seems to be the format of the query. It comes out of LLBL like this:
SELECT
"PERFORMANCE_CACHE"."TARGET_ID" AS "Target_ID",
"PERFORMANCE_CACHE"."LASTRECACHE_DATE" AS "LastReCache_Date",
"PERFORMANCE_CACHE"."SITE_ID" AS "Site_ID",
"PERFORMANCE_CACHE"."GROUP_ID" AS "Group_ID",
"PERFORMANCE_CACHE"."CACHEVALUE" AS "CacheValue",
"PERFORMANCE_CACHE"."BANDINGZONE" AS "BandingZone",
"PERFORMANCE_CACHE"."DIRTYYN" AS "DirtyYN",
"PERFORMANCE_CACHE"."DATASTATUSFLAG" AS "DataStatusFlag"
FROM
"ENVOY"."PERFORMANCE_CACHE"
WHERE
(
( "PERFORMANCE_CACHE"."SITE_ID" IN
(
** LIST OF 220 SITE ID's **
) Or
"PERFORMANCE_CACHE"."GROUP_ID" IN
(
:Group_ID222,
:Group_ID223,
:Group_ID224
)
) And
"PERFORMANCE_CACHE"."TARGET_ID" IN
(
** LIST OF 20 OR SO TARGET ID's **
)
)
Now, I tried creating a new predicate - much simpler, but with more parameters. I create 600 ID's, and pass that into a CompateRange predicate, so the SQL is thus:
SELECT "PERFORMANCE_CACHE"."TARGET_ID" AS "Target_ID","PERFORMANCE_CACHE"."LASTRECACHE_DATE" AS "LastReCache_Date","PERFORMANCE_CACHE"."SITE_ID" AS "Site_ID","PERFORMANCE_CACHE"."GROUP_ID" AS "Group_ID","PERFORMANCE_CACHE"."CACHEVALUE" AS "CacheValue","PERFORMANCE_CACHE"."BANDINGZONE" AS "BandingZone","PERFORMANCE_CACHE"."DIRTYYN" AS "DirtyYN","PERFORMANCE_CACHE"."DATASTATUSFLAG" AS "DataStatusFlag" FROM "ENVOY"."PERFORMANCE_CACHE" WHERE ( "PERFORMANCE_CACHE"."SITE_ID" IN (:Site_ID1.....:Site_ID600))
Now, this one works fine!! So, it must be something to do with the way the sub-queries are combined in a way which makes oracle really inefficient!!!
I just need to figure out why!