couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Barnes <>
Subject Re: few doubts
Date Mon, 04 Jul 2011 03:24:07 GMT
On 4/07/2011 1:11 PM, Matthew John wrote:
> Hi all,
> I am a newbie at CouchDB. I had a few queries back in my mind and thought I
> would shoot them here:
> 1) I am familiar with MySql systems. In one of the applications I ve made,
> whenever the server gets restarted I used to perform a warm up (similar to
> Select * from *) inorder to populate the cache. And this used to take almost
> like half an hour. How does it happen in CuuchDB and how long might it take
> for the "warm up"

Views are stored on disk, and will persist across server restarts.

> 2) I understand that all the MR queries (views) to be used in the system has
> to be coded in the Design document. Does that mean a super-set of all
> possible queries which we might use in the System has to be coded in the
> Design doc? Can this be added on the fly (dynamic )

Dynamically added, or 'temporary' views are really only meant for 
testing, and on small datasets. Don't use them.

Views are defined in the design document beforehand, yes, but a single 
couchdb view is much more flexible and customisable than an SQL query.
For instance, you could have a view that emits a values with a key like 
[country,state,city], and has a reduce of _count.
Then you could:
* Fetch all values from a single country. 
* Fetch all values from a single state. 
* Fetch all values from american states A-L. 
* Fetch total count of rows; reduce=true
* Fetch total count of rows, grouped by country,state,city; 
* Fetch total count of rows, grouped by country,state; 

It may require some re-thinking of your data model and queries to get 
the best solution working in couchdb, but it pays off.


View raw message