I have very limited knowledge of database in general. I am flummoxed by how exactly JDBC(Presto) works - so in my program, I have something like
ResultSet rs = statement.execute(sqlcommand);
while (rs.next()) {...}
the execute
part takes a few seconds but rs.next()
takes forever and usually times out without being able to return even 1 record. I used to think that execute
executes the query and fetches the result, but now it looks to me that the actually result won't be computed until rs.next()
Anyone here with a good understanding of how exactly JDBC works? And is there a way to optimize rs.next()
so it will at least return something during a reasonable time frame?