Hi,
we're wondering would it be possible to implement customized prefetch query generation?
Currently there are two flavors:
1) a sub query when the number of items is higher than the ParameterisedPrefetchPathThreshold
2) WHERE IN (: p1 ,: p2 ,: p3 ... ) when the number of items is below ParameterisedPrefetchPathThreshold
What we'd like to do is limit the number of variations because of memory usage on the database.
One way would be to 'stretch' the number of to a specific number of items, lets say: 50, even we only have 10 ... and add a between clause when the items are ordered
e.g.
SELECT id, column1, column2
FROM db_owner.my_table mt
WHERE mt.id BETWEEN :p1 AND :p5
AND mt.id IN (p1, p2, p3, p4, p5, p6, p6, p6, p6, p6, p6, p6, p6, p6, p6, p6, p6 ... etc)
Another way would be to use a table valued function:
SELECT id, column1, column2
FROM db_owner.my_table mt
WHERE mt.id BETWEEN :p1 AND :p5
AND mt.id IN TABLE(db_owner.idtable(:p1))
In our case performance is less of a concern than memory usage on the dbms.
Would it be possible to use a custom implementation for prefetching?