Sql Query is taking long time to execute.
I am running below query on my database and this will take more than 2 minute to show it’s result.
Query
SELECT ' '||ROWNUM||'. '||Value
FROM (SELECT TableSpace_Name||' used '||COUNT(*)||' times' AS Value
FROM All_Tables
WHERE TableSpace_Name IS NOT NULL
AND TableSpace_Name NOT IN ('SYSAUX','SYSTEM','USERS')
GROUP BY TableSpace_Name
ORDER BY TableSpace_Name);
I want to improve response time of above query. Any clue much appreciated.
Thanks in advance.