From user-return-20353-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Mon Apr 9 14:02:06 2012 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5FF48991F for ; Mon, 9 Apr 2012 14:02:06 +0000 (UTC) Received: (qmail 27365 invoked by uid 500); 9 Apr 2012 14:02:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 27331 invoked by uid 500); 9 Apr 2012 14:02:04 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 27323 invoked by uid 99); 9 Apr 2012 14:02:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Apr 2012 14:02:04 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ziggythehamster@gmail.com designates 209.85.214.52 as permitted sender) Received: from [209.85.214.52] (HELO mail-bk0-f52.google.com) (209.85.214.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Apr 2012 14:02:00 +0000 Received: by bkcjm19 with SMTP id jm19so4386758bkc.11 for ; Mon, 09 Apr 2012 07:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=NdOymzWjgYuJ2IGydeEcbSV/jxjRsSi+rvpiAy4PtyQ=; b=Bs78Uh8NB3A+yMAqA+AsyOLHC8N4Vj1iCBPv3jz26N48S8RrJ7UbIhkRaTkwMMStZ2 p9ej1CYCtzUSAiuq//rgptKNMo8BTDIgvga1dop8CpemoQUi9VHjT6VKJ0J+URlW6gFz eNiLIvSv2Z49hJPEYASqOxck4jnkzzNSiN+xAN8bgKkB12CUq237UCe2UKZ4HtqqNe5n Pi5cS5djBjI07GyZIjtdSPKr06U+hA59wjw3EYTf8mKRS9Xl5beqvXkCzIatdE2xzJfM VWk9zjtPBamtuQXQn6YdyyZlmLrQHOiBCZK/qraktu9WxqYOgGUhL2/vHU3RTkalChsX PdOg== MIME-Version: 1.0 Received: by 10.204.151.86 with SMTP id b22mr3189030bkw.81.1333980099164; Mon, 09 Apr 2012 07:01:39 -0700 (PDT) Sender: ziggythehamster@gmail.com Received: by 10.204.150.202 with HTTP; Mon, 9 Apr 2012 07:01:39 -0700 (PDT) Received: by 10.204.150.202 with HTTP; Mon, 9 Apr 2012 07:01:39 -0700 (PDT) In-Reply-To: References: Date: Mon, 9 Apr 2012 09:01:39 -0500 X-Google-Sender-Auth: HFvv_3yOHdP0eRU_NSZr4AnBCaQ Message-ID: Subject: Re: Schema Design when migrating data from relational into document From: Keith Gable To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0015175cd64cf2b8fe04bd3f7194 X-Virus-Checked: Checked by ClamAV on apache.org --0015175cd64cf2b8fe04bd3f7194 Content-Type: text/plain; charset=ISO-8859-1 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" 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. > Is there are db layer that has been built for CouchDB ? > > Thanks in advance > --0015175cd64cf2b8fe04bd3f7194--