list_keys listing all keys

Brad Fitzpatrick brad at danga.com
Mon Nov 20 07:54:01 UTC 2006


Not efficient on the database.  Those offsets kill you.


On Sun, 19 Nov 2006, Arthur Bebak wrote:

> Brad Fitzpatrick wrote:
> > Really what we need is a:
> >
> >    list_keys after=&limit=1000
> >
> > Which means "return up to 1000 keys with key after ''".
> >
> > Then we get to "foo" as the 1000th item in the response, and client can
> > re-issue:
> >
> >    list_keys after=foo&limit=1000
> >
> > And so on.
> >
> > And prefix can still live as an additional filter, in addition to after=.
> >
> > Care to write a patch?
>
> Actually, what I think you really want is something which works like
> an SQL select query. Specify a limit and an offset. This lets you do
> things like paginated displays of keys with a minimum of fuss.
>
> So for example, to list the first 1000 keys:
>
> list_keys limit=1000 [offset=0]
>
> The offset is optional and assumed to be equal to 0 if not given
>
> To list the next 1000 keys:
>
> list_keys limit=1000 offset=1001
>
> And so on. The command can be easily mapped to an SQL select query
> without the awkward "after" syntax - well, at least I think it's
> awkward.
>
> If you want to be fancy you can also specify sort order, based
> on things like key characters or creation date. Just an easy extension
> to the SQL query.
>
> --
> Arthur Bebak
> abebak at fabrikinc.com
>
>


More information about the mogilefs mailing list