You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Gabriel Farrell <gs...@gmail.com> on 2011/02/21 18:44:45 UTC

Server-side union and intersection of views

On Sun, Feb 20, 2011 at 8:57 PM, Steve Midgley <sc...@misuse.org> wrote:
> Hi,
>
> I'm new on this list - hopefully this post is relevant. I'd like to
> ask a bit more about this question of querying multiple views. I come
> from a postgres background, and if I were to solve this problem in
> postgres, I'd just index each of the two fields holding the data and
> let the SQL engine "intersect" the two fields' indices when I select
> against them. Something I'd take for granted on that platform (of
> course the trade-off being lack of flexibility in the indices).
>
> So it seems like it'd be a really handy feature to be able to
> intersect two views together (i.e. take the two view b-trees merge
> them and find all id's that have duplicates). Once you have the
> intersection, you could process this view/b-tree with a list function
> or something?
>
> Is there no way to do this on the server side with couch? Seems like
> arbitrary merge/intersection of views would permit just about anything
> that SQL servers can do with similar performance (and a whole lot more
> flexibility)?

Good question. I imagine that functionality would add complexity to
CouchDB that the devs might not want. I'm sure it's come up before,
though. Maybe someone who's been with the project longer can comment?