oradbanj
oradbanj

Reputation: 563

Incorporate RESULT_CACHE function into a Query

I want to incorporate a RESULT_CACHE function into following query

  select 
         a,
         b
  from
      ( select x,y, row_number() over (partition by x ) rank from table )
  where
        rank = 1 

The reason being if the function is called for same value of X, it will get data from RESULT_CACHE and not hit the tables.

Upvotes: 1

Views: 43

Answers (1)

HereGoes
HereGoes

Reputation: 1320

As long as you have the the Result Cache configured the following hint should look to the Result Cache

select /*+ RESULT_CACHE */
     a,
     b
from
  ( select x,y, row_number() over (partition by x ) rank from table )
where
    rank = 1 

Upvotes: 1

Related Questions