I am running out of memory when I am trying to read a huge list. This is the code that crashes the server
query = "SELECT * FROM huge_list ORDER BY id ASC";
statement = this.database.createStatement();
results = statement.executeQuery(query);
This is the error
Exception in thread "Thread-2" java.lang.OutOfMemoryError: Java heap space
the error points to the results line. Any advice on how to avoid that? Perhaps load the list using Limit? Could the size of the list cause an error?