SELECT a AS a,
b AS b,
c AS c,
d AS d,
e AS e,
f AS f,
g AS g,
h AS h
FROM (
SELECT P.*,
ROW_NUMBER() OVER (PARTITION BY p.a, RANK_NM
ORDER BY P.ID DESC) RW_NUM
FROM (
SELECT T.a,
T.b,
T.c,
T.d,
T.e,
T.f,
T.g,
T.h,
T.ID
DENSE_RANK() over (PARTITION BY T.a
ORDER BY T.b, T.c, T.d
, T.e, T.f, T.g, T.h
DESC) RANK_NM
FROM TEST_TABLE T ) p) Y
WHERE RW_NUM = 1
I got this query for tuning from production team, I dont have access to production and other things, I have to give query to production guys to execute and they are expecting a miracle. Problem is TEST_TABLE contains 98 million records and this query is used in informatica and creating a huge cache. Is there any way query can be written in better way, just at looking at query. I know lot of things require and information is needed for tuning but this is all I got. :) Database is oracle 10 g.