Retrieve the ith document (in fast) [IOS]

Does it query once on every scroll? I would guess that even that would be too slow. You want to fetch a range of rows, like 100 at a time, and only query when the scroll range goes past that.

Actually the (your) implementation is quite fast. The simulator (Mac Book Pro with 2.4 GHz) is very fast up to 1000 entries in the DB. First (short) stutters are noticeable with 2000++ entries. I will test some real devices in a few days. But normally they tend to be faster as the simulator (depending on the devices of course).

I can find ways around this “bottleneck” but it’s always a question between memory consumption and speed (as you mentioned).

Two years ago I used directly an sqlite database (in a first prototype of this project). Then I used sqlite queries with an “offset”. The “offset” approach was very speedy (imho even speedier than keys) and in particular it’s way easier to implement a ,e.g., uitableviewcontroller with an offset instead of keys.

Is the couchbase “skip” using an sqlite “offset”? Because compared to the keys in couchbase it’s (unfortunately) way slower.

It does use OFFSET, but the underlying SQL query is probably more complex than what you were using.