You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Adam Christian <ad...@gmail.com> on 2010/05/26 02:53:09 UTC

View performance issue

Hello everyone,

I have a "conf" db with the following documents:

(env)(db) [17:38] sauce $curl localhost:5984/conf/_all_docs
{"total_rows":8,"offset":0,"rows":[
{"id":"_design/amis","key":"_design/amis","value":{"rev":"1-d210474cd70114aa12a9a0a45e5d0f20"}},
{"id":"_design/takos","key":"_design/takos","value":{"rev":"1-e35bbf33d4b29a86eb60fafbab7aa42c"}},
{"id":"ami-a5b559cc","key":"ami-a5b559cc","value":{"rev":"1-5f08c036a73967cb6b72fd0e580a4b84"}},
{"id":"ami-a9e90fc0","key":"ami-a9e90fc0","value":{"rev":"1-3f3a5d33f3db78c971ceade5c6a2b960"}},
{"id":"ami-cf608da6","key":"ami-cf608da6","value":{"rev":"1-9c8c728402e151e0ad39e67909fd6af9"}},
{"id":"ami-db608db2","key":"ami-db608db2","value":{"rev":"1-5d5683582b4c513536c0a05fe4d494a0"}},
{"id":"ami-dd608db4","key":"ami-dd608db4","value":{"rev":"1-7187ff6b10fad61c79ed2c0cbf64b374"}},
{"id":"expediter","key":"expediter","value":{"rev":"1-9b56984574a38d0c69e33abb055ea3e6"}}
]}

There's a view called "amis/active" which says:
curl localhost:5984/conf/_design/amis | jsonpretty
{
   "_rev": "1-d210474cd70114aa12a9a0a45e5d0f20",
   "_id": "_design/amis",
   "language": "javascript",
   "filters": {},
   "views": {
       "active": {
           "map": "function(doc)\n{\n  if ((doc.doc_type ==
\"ChefAMI\" || doc.doc_type == \"AMI\") && doc.active) {\n
emit(doc._id, doc);\n  }\n}"
       }
   }
}


However when I run the view:
   curl localhost:5984/conf/_design/amis/_view/active

It just hangs and "beam.smp" takes 10-14% CPU.

CouchDB 0.11, Ubuntu 10.4

Any ideas would be greatly appreciated!

Adam Christian

Re: View performance issue

Posted by J Chris Anderson <jc...@gmail.com>.
On May 25, 2010, at 5:53 PM, Adam Christian wrote:

> Hello everyone,
> 
> I have a "conf" db with the following documents:
> 
> (env)(db) [17:38] sauce $curl localhost:5984/conf/_all_docs
> {"total_rows":8,"offset":0,"rows":[
> {"id":"_design/amis","key":"_design/amis","value":{"rev":"1-d210474cd70114aa12a9a0a45e5d0f20"}},
> {"id":"_design/takos","key":"_design/takos","value":{"rev":"1-e35bbf33d4b29a86eb60fafbab7aa42c"}},
> {"id":"ami-a5b559cc","key":"ami-a5b559cc","value":{"rev":"1-5f08c036a73967cb6b72fd0e580a4b84"}},
> {"id":"ami-a9e90fc0","key":"ami-a9e90fc0","value":{"rev":"1-3f3a5d33f3db78c971ceade5c6a2b960"}},
> {"id":"ami-cf608da6","key":"ami-cf608da6","value":{"rev":"1-9c8c728402e151e0ad39e67909fd6af9"}},
> {"id":"ami-db608db2","key":"ami-db608db2","value":{"rev":"1-5d5683582b4c513536c0a05fe4d494a0"}},
> {"id":"ami-dd608db4","key":"ami-dd608db4","value":{"rev":"1-7187ff6b10fad61c79ed2c0cbf64b374"}},
> {"id":"expediter","key":"expediter","value":{"rev":"1-9b56984574a38d0c69e33abb055ea3e6"}}
> ]}
> 
> There's a view called "amis/active" which says:
> curl localhost:5984/conf/_design/amis | jsonpretty
> {
>   "_rev": "1-d210474cd70114aa12a9a0a45e5d0f20",
>   "_id": "_design/amis",
>   "language": "javascript",
>   "filters": {},
>   "views": {
>       "active": {
>           "map": "function(doc)\n{\n  if ((doc.doc_type ==
> \"ChefAMI\" || doc.doc_type == \"AMI\") && doc.active) {\n
> emit(doc._id, doc);\n  }\n}"
>       }
>   }
> }
> 
> 
> However when I run the view:
>   curl localhost:5984/conf/_design/amis/_view/active
> 
> It just hangs and "beam.smp" takes 10-14% CPU.
> 

That is odd, for only having 8 docs, are your docs HUGE?

The map function looks OK.

Chris

> CouchDB 0.11, Ubuntu 10.4
> 
> Any ideas would be greatly appreciated!
> 
> Adam Christian