apache / apache/couchdb

Support arbitrary result sorting in views and/or mango

Open
#1,511 1 comment 0 reactions 0 assignees View on GitHub
discussion enhancement mango roadmap viewserver
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

@davisp:
> We have sorting. Though I'm assuming you mean sorting any result set based on some selected field. This makes me squeamish for similar reasons to JOINS in that the resource usage is unbounded and also involves a significant increase in complexity vs what I'm not sure would lead to equivalent gains in usefulness.
>
>For reference, this is from the MongoDB docs on sorting limits [1]:
>
>"If MongoDB cannot use an index to get documents in the requested sort order, the combined size of all documents in the sort operation, plus a small overhead, must be less than 32 megabytes."
>
>So basically, a query will work until it suddenly doesn't if your data set happens to exceed 32MiB. Obviously you wouldn't want to just not cap the memory usage here as a bad query could OOM your server. And I swear that value used to be 4MiB and has since been bumped because I assume people kept getting angry that their queries would seem to randomly failed after their app had been used a while.
>
>[1] https://docs.mongodb.com/manual/reference/limits/#Sort-Operations

Contributor guide

Open the contributing guide

Research direction

Start by reading the views and Mango query entry points and the linked discussion about sorting limits. The issue needs a concrete design and acceptance criteria for arbitrary result sorting, including bounded resource usage; done should be a decided, implementable behavior rather than an open-ended capability.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.