Oracle Logbook

May 2, 2011


Filed under: Uncategorized — Helio Dias @ 8:00 pm

It´s a wonderful simple idea,

select * from (select cpf,valor from CM.TAB_DIRF order by 2 desc) where rownum=1

On the above query one might think that the ordering cost will become prohibitive

IT ISN`T thanks to COUNT STOPKEY Oracle is pretty clever to pick up just one value (as the outside filter is 1)

Then Oracle just check if the new values is higher or not than the previous one.

The bottom line is , there is NO ordering at all.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: