Quantcast
Viewing latest article 4
Browse Latest Browse All 717

Why query plan changes by number of rows

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.
enter image description here

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.
enter image description here

Can anyone help me understand the reason why this strange behavior happens?


Viewing latest article 4
Browse Latest Browse All 717

Trending Articles