I always wondered what's happening behind the scenes when I'm querying my DB through SQL Developer.
Independently of the size of the table, I will always get at most 50 rows by default. I'm allowed to scroll down on the results table, and apparently it will somehow lazy load the rest of the results.
Showing the first 50 results doesn't seem to vary with the size of the table (at least for a simple SELECT * FROM t
), so that leads me to believe that SQL Developer is enclosing my SELECT
statement s
with a SELECT * FROM s WHERE rownum <= 50
. If that's the case, as I imagine it to be, it's not being shown on the Explain Plan
tab.
How does SQL Developer then later lazily get the rest of the results if needed? Does it use some sort of offset? Will it always have to redo the query but instead of taking only rows with rownum <= 50
, will do it for rownum <= 100, 150
, etc? That would surely be inefficient. But unless it does it, then it risks fetching the wrong set of rows (as the table disposition of rows may have changed in-between!).
I'm also assuming that by default SQL Developer is only actually fetching from the server the minimum amount of data, ie, it's not actually fetching everything, although only showing some results. Is this the case?
Could anyone shed a bit of light on this issue?