Secondary index reverse sort

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Secondary index reverse sort

Lucas Cooper
I've seen that the results of secondary index queries are sorted on index values by default.
I was wondering if there's something I'm missing that would allow me to fetch those keys but reverse sorted.

I have indexes based on UNIX timestamps and I'd like to grab the most recent keys.
I'd like this query to be running on demand so I'd like to avoid MapReduce if at all possible.



_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Secondary index reverse sort

Russell Brown
Hi Lucas,

I'm sorry, as easy as it would have been to add with the latest changes, we just ran out of time.

It is something I'd love to add in future. Or maybe something a contributor could add? (Happy to advise / review.)

Many thanks

Russell

On 31 Jul 2013, at 02:04, Lucas Cooper <[hidden email]> wrote:

> I've seen that the results of secondary index queries are sorted on index values by default.
> I was wondering if there's something I'm missing that would allow me to fetch those keys but reverse sorted.
>
> I have indexes based on UNIX timestamps and I'd like to grab the most recent keys.
> I'd like this query to be running on demand so I'd like to avoid MapReduce if at all possible.
>
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Secondary index reverse sort

Lucas Cooper
I'm happy to wait, it isn't urgently needed as my project is still in development.

I'd contribute myself if I was confident at all programming in Erlang but I'm still just getting into declarative languages at the moment :)

On Wed, Jul 31, 2013 at 10:03 PM, Russell Brown <[hidden email]> wrote:
Hi Lucas,

I'm sorry, as easy as it would have been to add with the latest changes, we just ran out of time.

It is something I'd love to add in future. Or maybe something a contributor could add? (Happy to advise / review.)

Many thanks

Russell

On 31 Jul 2013, at 02:04, Lucas Cooper <[hidden email]> wrote:

> I've seen that the results of secondary index queries are sorted on index values by default.
> I was wondering if there's something I'm missing that would allow me to fetch those keys but reverse sorted.
>
> I have indexes based on UNIX timestamps and I'd like to grab the most recent keys.
> I'd like this query to be running on demand so I'd like to avoid MapReduce if at all possible.
>
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Secondary index reverse sort

Jon Meredith
As a workaround, you can always store (2^31 - timestamp) as an additional index and use that when you need to do the reverse retrieval.  Beware 2038.

Jon


On Wed, Jul 31, 2013 at 1:07 PM, Lucas Cooper <[hidden email]> wrote:
I'm happy to wait, it isn't urgently needed as my project is still in development.

I'd contribute myself if I was confident at all programming in Erlang but I'm still just getting into declarative languages at the moment :)


On Wed, Jul 31, 2013 at 10:03 PM, Russell Brown <[hidden email]> wrote:
Hi Lucas,

I'm sorry, as easy as it would have been to add with the latest changes, we just ran out of time.

It is something I'd love to add in future. Or maybe something a contributor could add? (Happy to advise / review.)

Many thanks

Russell

On 31 Jul 2013, at 02:04, Lucas Cooper <[hidden email]> wrote:

> I've seen that the results of secondary index queries are sorted on index values by default.
> I was wondering if there's something I'm missing that would allow me to fetch those keys but reverse sorted.
>
> I have indexes based on UNIX timestamps and I'd like to grab the most recent keys.
> I'd like this query to be running on demand so I'd like to avoid MapReduce if at all possible.
>
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




--
Jon Meredith
VP, Engineering
Basho Technologies, Inc.

_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Reply | Threaded
Open this post in threaded view
|

Re: Secondary index reverse sort

Lucas Cooper
That should work well in development for my application actually. Thanks for the tip!

On Wed, Jul 31, 2013 at 10:26 PM, Jon Meredith <[hidden email]> wrote:
As a workaround, you can always store (2^31 - timestamp) as an additional index and use that when you need to do the reverse retrieval.  Beware 2038.

Jon


On Wed, Jul 31, 2013 at 1:07 PM, Lucas Cooper <[hidden email]> wrote:
I'm happy to wait, it isn't urgently needed as my project is still in development.

I'd contribute myself if I was confident at all programming in Erlang but I'm still just getting into declarative languages at the moment :)


On Wed, Jul 31, 2013 at 10:03 PM, Russell Brown <[hidden email]> wrote:
Hi Lucas,

I'm sorry, as easy as it would have been to add with the latest changes, we just ran out of time.

It is something I'd love to add in future. Or maybe something a contributor could add? (Happy to advise / review.)

Many thanks

Russell

On 31 Jul 2013, at 02:04, Lucas Cooper <[hidden email]> wrote:

> I've seen that the results of secondary index queries are sorted on index values by default.
> I was wondering if there's something I'm missing that would allow me to fetch those keys but reverse sorted.
>
> I have indexes based on UNIX timestamps and I'd like to grab the most recent keys.
> I'd like this query to be running on demand so I'd like to avoid MapReduce if at all possible.
>
>
> _______________________________________________
> riak-users mailing list
> [hidden email]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com



_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com




--
Jon Meredith
VP, Engineering
Basho Technologies, Inc.


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com