What language/library are you using?

In Python for example there's .fetchone() to get just the next result row, 
.fetchmany(n) to get the next n rows, or .fetchall() to go get them all.

In general though at its core SQLite will get and return one row at a time. 
Though if there's grouping or sorting it may have to collect a whole bunch of 
underlying rows first while it's doing the aggregation or before it can sort 
them, and only then once they're sorted will it be able to give you the first 
row, or the next one, etc. So in the worst case, even if you're saying "give me 
just the first one" you might have to have the whole result in memory to find 
out which one is "first".



-----Original Message-----
From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> On Behalf Of 
Randall Smith
Sent: Wednesday, October 16, 2019 1:38 PM
To: sqlite-users@mailinglists.sqlite.org
Cc: Randall Smith <rsm...@qti.qualcomm.com>
Subject: [sqlite] Getting "chunked" output from a large SELECT operation.

I'm having a situation where the results of a large SELECT operation are 
apparently too big to fit in memory.

Obviously I could jerry-rig something to work around this, but I have a vague 
recollection that SQLite provides a nice way to get the results of a query in 
"chunks" so that the memory demands can be reduced as much as needed by going 
back to the well a (potentially large) number of times.

Am I remembering this right?  Can anyone refresh my memory on how to do it if 
so?

Randall.

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to