Oracle SQL ROWNUM < 10 VS MySQL LIMIT 10 performance on huge view [duplicate]

This question already has an answer here:

I am trying to query an Oracle SQL view set by a client to get a few sample records.

This view is so huge that SQL Developer gets hung up when I click on its name on the views list to try to display its records.

Client says I should put a where clause to limit the number of records.

The thing is I don’t even know what to put in this where clause to get just a few sample records.

In MySQL I would just do SELECT * FROM huge_view LIMIT 10 (why it works is explained here: http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/)

The Oracle equivalent SELECT * FROM huge_view WHERE ROWNUM < 10 does not work like that, so the query still hungs up and no results.

Is there any way I can get a few random samples from this view without knowing anything about it?


Source: oracle

Leave a Reply