Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id F1CDBDE314E for ; Tue, 3 Apr 2012 19:27:09 -0300 (ADT) Received: from smtp.01.com ([199.36.142.181]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SFCBt-0002CF-Tv for pgsql-hackers@postgresql.org; Tue, 03 Apr 2012 22:27:09 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 23E944F5563 for ; Tue, 3 Apr 2012 17:26:52 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KVY2UUg3DGnz for ; Tue, 3 Apr 2012 17:26:52 -0500 (CDT) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 068684F5C33 for ; Tue, 3 Apr 2012 17:26:52 -0500 (CDT) Received: from Sidney-Stratton.local (70-36-143-92.dsl.dynamic.sonic.net [70.36.143.92]) by smtp-out-2.01.com (Postfix) with ESMTPSA id A14544F5563 for ; Tue, 3 Apr 2012 17:26:51 -0500 (CDT) Message-ID: <4F7B7925.3060506@agliodbs.com> Date: Tue, 03 Apr 2012 15:26:45 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: pgsql-hackers@postgresql.org Subject: Re: HTTP Frontend? (and a brief thought on materialized views) References: <4F7479FE.9050702@dunslane.net> In-Reply-To: X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/109 X-Sequence-Number: 205912 > While I was doing this I always thought this would have been a better > approach for my previous project, an accounting application. If I could > just have stored entities like invoice & customer as a single document that > is inserted, updated, etc. atomically it would be a lot simpler and faster > than having to break things out into columns and rows spread over various > tables. Actually, an accounting application is the *worst* candidate for document-oriented storage. For example, it's pretty normal for customers to have multiple invoices, and for each invoice to have multiple line-items which relate to inventory items. Without relational structure, answering questions like "Do I have enough green shoes in stock to cover pending orders within the next 30 days in Texas?" goes from a relatively simple query to a major exercise in frustration. And it's not possible to implement required business constraints ("A customers balance may not go below zero") at all in a document database. There's strong arguments to be made for document-structured storage for some applications. But RDBMS covers financial applications very well; it's what RDBMS was designed for in the first place. > Some fields are just "information" that isn't searched for or used > relationally but ends up getting a field (or a whole bunch of fields, like > your address) in the DB schema anyway. Adding, removing, and changing > columns is always scary to me in the SQL database - when there's no schema > you can fix these things as part of the definition of your "view" instead. Yes, having "documents" *in addition* to relational data gives you the best of both worlds. You can use relational structures to store data which is well-defined and business-critical, and document structures to store data which is undefined and not critical. > So I kind of think the document database kind of bridges the gap between an > OODBMS and the RDBMS because the document is like a little cluster of OODBMS != DocumentDB -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com