Thanks Andrew for bringing that into consideration [?] On Tue, Apr 10, 2012 at 7:34 AM, Andrew Woodcock <[email protected]>wrote:
> Bear in mind as well how often you will be updating certain information: > each update creates a document revision, so a large document where a couple > of fields (or even just one) are frequently updated can lead to increased > storage requirements and will also impact replication: there will be > frequent replication of a large document where only a small part is > actually changing. In a scenario like that, it may well be better to have > the frequently updating field(s) in separate documents. > > Regards, > > Andrew > > On 9 April 2012 17:26, Mohammad Prabowo <[email protected]> wrote: > > > Thanks! I had read somewhere that there is a tradeoff between embedding > the > > data (example 1) or more normalized document (example 2). It's more of a > > choice between data locality, disk space, and querying flexibilities. I > > guess since every query must go trough views, the speed benefits of data > > locality is therefore reduced > > > > On Mon, Apr 9, 2012 at 9:01 PM, Keith Gable <[email protected] > > >wrote: > > > > > I'd go the first route, but salaries and titles should be arrays of > > hashes: > > > > > > "titles": [ > > > { "name": "xxx", "from": "xxx", "to": "xxx" } > > > ] > > > > > > If you want to decouple the data, like if you wanted a list of all > > titles, > > > you'd use CouchDB views. > > > On Apr 9, 2012 6:07 AM, "Mohammad Prabowo" <[email protected]> wrote: > > > > > > > Hi, suppose i have relational db with schema like this > > > > > > > > employees-schema< > > > > http://dev.mysql.com/doc/employee/en/images/employees-schema.png> > > > > > > > > I want to try converting it into document. I have two question: > > > > > > > > 1. The main strength of Document is that it is 'self contained'. > > > Meaning > > > > we don't need to do JOIN stuff, and all data that is needed are > > > contained > > > > within documents. So, should i choose to use nested documents like > > > this : > > > > > > > > { > > > > "emp_no": "...", > > > > "birth_date": "...", > > > > "first_name": "..", > > > > "last_name": "..", > > > > "gender": "..", > > > > "hire_date": "..", > > > > "titles": { > > > > "title": "...", > > > > "from_date": "...", > > > > "to_date": "..." > > > > }, > > > > "salaries": { > > > > "salary": "...", > > > > "from_date": "...", > > > > "to_date": "..." > > > > } > > > > } > > > > > > > > > > > > or using different documents like this : > > > > > > > > [ > > > > { > > > > "doc_name": "employees", > > > > "emp_no": "...", > > > > "birth_date": "...", > > > > "first_name": "..", > > > > "last_name": "..", > > > > "gender": "..", > > > > "hire_date": ".." > > > > }, > > > > { > > > > "doc_name": "titles", > > > > "from_date": "...", > > > > "to_date": "..." > > > > }, > > > > { > > > > "doc_name": "salaries", > > > > "salary": "...", > > > > "from_date": "...", > > > > "to_date": "..." > > > > } > > > > ] > > > > > > > > > > > > 2. I want to benchmark MySQL and CouchDB with > > > > YCSB<https://github.com/brianfrankcooper/YCSB/wiki>. > > > > Is there are db layer that has been built for CouchDB ? > > > > > > > > Thanks in advance > > > > > > > > > >
