I have the following connect by query which takes approximately 50 to 60 seconds for a record count of 500 in my_table_name.
Can any one of you please suggest a better way of writing this query to improve the performance.
SELECT DISTINCT REGEXP_SUBSTR(STD_DEP,'[^,]+', 1, LEVEL) AS DEP_STD_ID
FROM my_table_name
WHERE std_id = 242
CONNECT BY REGEXP_SUBSTR(STD_DEP,'[^,]+', 1, LEVEL) IS NOT NULL;
In the above query: STD_DEP is a comma separated field which will have all the dependant std_id's.