I execute following two queries on an oracle database:
select * from qsn join plc on plc.fk_qsn = qsn.id where rownum < 48507
which returns result in less than a second and with following execution plan
Image may be NSFW.
Clik here to view.
and
select * from qsn join plc on plc.fk_qsn = qsn.id where rownum < 48508
which takes more than 10 seconds to execute and uses following execution plan
Image may be NSFW.
Clik here to view.
Can anyone help me understand the reason why this strange behavior happens?