On Wed, 16 Oct 2019 17:38:28 +0000, you wrote:

> 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.

Maybe Scrolling window queries?
 https://www.sqlite.org/rowvalue.html#scrolling_window_queries 

Or you may refer to replacing sqlite3_get_table(), which retrieves a whole
result set in a memory data structure, by a loop which retrieves row by row:

sqlite3_prepare()
loop while not SQLITE_DONE
        sqlite3_step()
        do-something-with-the-row

https://www.sqlite.org/c3ref/free_table.html
https://www.sqlite.org/c3ref/step.html

-- 
Regards,
Kees Nuyt

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

Reply via email to