I’ve got a query which has a WITH statement for a subquery at the top, and I’m then running a couple of CONNECT BYs on the subquery. The subquery can contain tens of thousands of rows, and there’s no limit to the depth of the CONNECT BY hierarchy. Currently, this query takes upwards of 30 seconds; is it possible to specify indexes to put on the temporary table created for the factored subquery to speed up the CONNECT BYs, or speed it up another way?
Share
There is no way to do it right in the query:
Oracledoes not supportEager Spool.You can temporarily store your resultset in an indexed temporary table and issue the
CONNECT BYquery against it.However, for the unsargable equality conditions in the query, the
CONNECT BYusually builds a hash table which is in most cases even better than an index.Could you please post your query here?