> On May 25, 2017, at 10:00 PM, Wout Mertens <wout.mert...@gmail.com> wrote: > > I would like to make it partially asynchronous, still doing most of the > work on the main thread, but waiting in a helper thread. I was thinking > that the longest delays will be from disk access, so sqlite_step().
SQLite has a cache, so accessing recently-used pages of the database doesn’t hit the disk at all. (Unless the OS is low on memory and parts of the cache have been paged out…) And the OS has a disk cache, so even if SQLite has to hit the filesystem, that request might be nearly instantaneous if the page is cached by the OS. If actual disk access is required, the time can vary wildly — it depends on on how many other I/O requests by other processes are in the queue, what type of disk it is, how far the head has to seek if it’s a hard disk… What I’m saying is that it’s pretty hard to predict. In the worst case I’ve seen queries that normally take a millisecond last for several seconds, when the OS is heavily bogged down with I/O. —Jens _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users