I'm using Java JDBC connecting to a database to execute the query.
The query executes and it fetches million rows from the database. If I store this million rows in my array it causes memory issues. How can I limit the number of rows being fetched.
I'm using Java JDBC connecting to a database to execute the query.
The query executes and it fetches million rows from the database. If I store this million rows in my array it causes memory issues. How can I limit the number of rows being fetched.
IF it is SQL - which it doesn't say, but I'm going to assume (reflex, I saw *dbc) - then there'll be a limit clause, EVEN Microsoft SQL (which is a laughable thing indeed) has a LIMIT clause.
For example (WHATEVER) LIMIT 5
means only 5 rows will be output (or updated, or deleted, as limits may be used there).
(WHATEVER) LIMIT 5,10
means 10 rows from the 5th row, so 6 to 15 if your rows start at 1.