couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack chrispoo <jackchris...@gmail.com>
Subject Re: How to get only a field in a document
Date Sun, 11 Dec 2011 05:36:09 GMT
Thanks Paul, initially I tried using a view. But it didn't work out quite
well.

The detailed use case is: I have several million documents, each with
several hundred fields, and each field is about 1kb. In some situation I
only need to get field1 from a range of documents, say doc_k ~ doc_(k+m),
if the server can return only filed1 to me I believe this can save a lot of
network transmission and processing on the client side. So I started with a
view which emits doc.field1 for each document, and queried the view with
startkey=doc_k&limit=m to do the range query. But indexing the view took
really long time - several hours, and even after the indexing, querying the
view didn't save time compared to getting entire documents from the CouchDB
server.

I'm using BigCouch clusters, and the database is partitioned on 6 servers.
Does this affect the view performance?

I'm wondering if there's a more efficient way than view to do the task.

Thanks,

On Sat, Dec 10, 2011 at 9:57 AM, Paul Davis <paul.joseph.davis@gmail.com>wrote:

> Or a view if it's the same field for lots of docs.
>
>
>
> On Dec 9, 2011, at 8:05 PM, Jim Klo <jim.klo@sri.com> wrote:
>
> > if you know the document ID that you're after, then a show function can
> handle what you're asking without a view:
> >
> > http://guide.couchdb.org/draft/show.html
> >
> >
> > Jim Klo
> > Senior Software Engineer
> > Center for Software Engineering
> > SRI International
> >
> >
> >
> >
> > On Dec 9, 2011, at 4:10 PM, jack chrispoo wrote:
> >
> >> Hi all,
> >>
> >> I am new to CouchDB and I have a question about getting data in
> documents.
> >> I have documents like below:
> >>
> >> {
> >>  "field1":"value1",
> >>  "field2":"value2",
> >>  ....
> >> }
> >>
> >> The documents have a lot of fields and in one case I only want to get
> >> field1 from the documents. I'm wondering if there is a way to avoid
> getting
> >> the entire document from CouchDB server because this involves a lot of
> >> unnecessary data transmission over the network? I tried creating a view
> >> which emits (doc._id,{"field1": doc.fleid1}), but indexing the view
> takes
> >> really long, and it doesn't seem to improve the performance. So I'm
> curious
> >> if there is an easier way to get only a field out of a document.
> >>
> >> Thanks
> >>
> >> jack
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message