I have a very large table MY_TABLE
(100 million rows). I wish to select a sample of 5, say, records from this table.
What I can think of is getting 5 arbitrary primary keys as follows, this uses fast full scan as the explain plan shows:
select MY_PRIMARY_KEY_COLUMN from (select MY_PRIMARY_KEY_COLUMN, rownum as rn from MY_TABLE) where rn <=5
and then getting the records corresponding to these primary keys.
However this is still very very slow..
Can it be done more efficiently?