I've found that the best trade-off in performance and memory for on-demand loading is to first run a query which retrieves all the id's of the items you want in the list and store the list in memory. Then you can use that to run a second query for full data using a where clause with "ID IN (...)". This is much faster than using LIMIT/OFFSET but has overhead of maintaining an array (or whatever) of ID's (find for a few thousand, millions could be problematic, but then again, a list with millions of records is problematic no matter how you do it).
HTH, Sam ------------------------------------------- Were Hiring! Seeking a passionate developer to join our team building products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -----Original Message----- From: Olaf Beckman Lapré [mailto:[EMAIL PROTECTED] Sent: Friday, September 28, 2007 3:48 PM To: sqlite-users@sqlite.org Subject: [sqlite] Seeking advice on On Demand Loading Hello, I'm looking for some advice on implementing 'On Demand Loading' in my program. Some GUI controls such as a Listview have a 'virtual mode' where the control only needs to be loaded with the items currently shown. The Listview will call a callback function where it indicates which items need to be loaded. BTW I'm using wxWidgets for my GUI library. My question centers on how to implement this using SQLite as I'm not really sure how to retrieve 'record numbers 445 to 456' using SQL statements efficiently. Any thoughts on this? Kind regards, Olaf ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------