Reputation: 11205
I have a connect by level query as part of a chain of CTEs. This runs fine until it hits the connect by level, which causes the query to time out.
The CTE above returns 250 rows, the maximum ldepth of the heirarchy will be somewhere around 13-14 levels.
Is there a limit to the number of levels deep the connect by level
query can return?
Upvotes: 0
Views: 1308
Reputation:
The number of levels is limited by the memory available at runtime. 13-14 levels is super-safe from that point of view.
If there are no other complications and the issue is just "too many levels", the memory limit is reached relatively quickly and you get an error message when that happens. If your query is running for a very long time, there must be other reasons.
The most likely suspect is an incomplete CONNECT BY clause, where you don't have enough conditions and too many rows are being generated AT EACH LEVEL. That can generate a very large number of rows at relatively low levels.
Upvotes: 2