0

I have a large sqlite database (> 6M records). I use an asynctask to read in background to make UI responsive.

I am trying to read records in chunks (3000 records) so I do not have memory allocation problem. However, the cursor reads the whole result in one shot, which causes app to hang.

Is there away to make cursor read query result sequentially from DB (like .NET SqlDataReader)? Or, I am only set to use select with LIMIT clause (which creates overhead)?

Thanks.

alsaleem
  • 23
  • 3
  • So your app is trying to show 6M records on the screen? How big is that screen? – CL. Nov 04 '14 at 08:18
  • no. this is for pattern matching on stored DB. Pattern matching is a non-UI task. – alsaleem Nov 04 '14 at 15:40
  • Notes : Open cursor takes 8 sec. Also, as fetching going deeper, it becomes slower (40 msec to 2 minutes @900K). Is cursor resetting itself? (reading 3000-record patches, with open cursor, no re-query). – alsaleem Nov 04 '14 at 15:52
  • Using OFFSET is slow for large values (because all previous rows must be computed before they are skipped). Show the actual query. – CL. Nov 04 '14 at 17:49

0 Answers0