On Tue, Oct 9, 2012 at 10:40 AM, James Gilliam <
jimgi...@gmail.com> wrote:
> The main point I am making is offsets are useless because reading all
> records from 0 to offset costs the same as reading a a record from +offset.
> If GAE didn't charge for the records being skipped, it would be useful to
> use offsets. I suspect the only reason they charge for skipping records is
> because they cannot locate the nth record without reading them all. This
> suggests a defect in their design that has nothing to do with entity
> database.
This is a defect in pretty much all database designs. What do you
think MySQL does when you specify an offset? It runs the query and
walks through the result set until it has skipped N results. It's
only fast in MySQL if you have all the necessary indexes in RAM; GAE
is designed for very large datasets so you can't make this assumption.
This is one quirk of GAE; it's not very convenient for small
datasets. But your app won't suddenly collapse under load when the
index grows beyond an arbitrary point.
You could make an argument that GAE offsets should be small ops
instead of read ops. But you can easily make this happen yourself -
issue a keys-only query and batch get the results. Performance of
keys-only + batch-get is fairly similar to normal query performance.
Jeff