X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B9B7530D178 for ; Wed, 18 Jun 2003 13:21:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 54825-02 for ; Wed, 18 Jun 2003 10:20:53 -0300 (ADT) Received: from tomcat.velocet.net (tomcat.velocet.net [216.138.223.228]) by svr1.postgresql.org (Postfix) with ESMTP id 8F19B30DBD7 for ; Wed, 18 Jun 2003 10:20:51 -0300 (ADT) Received: from bee.vii.net (H98.C230.tor.velocet.net [216.138.230.98]) by tomcat.velocet.net (Postfix) with ESMTP id 11F09421A1E; Wed, 18 Jun 2003 09:20:50 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by bee.vii.net (Postfix) with ESMTP id D1B7B5C78; Wed, 18 Jun 2003 09:20:44 -0400 (EDT) From: Tm To: Josh Berkus , Michael A Nachbaur , pgsql-sql@postgresql.org Subject: Re: Object-Relational table design question Date: Wed, 18 Jun 2003 09:20:44 -0400 User-Agent: KMail/1.5.2 References: <200306170857.26558.mike@nachbaur.com> <200306170923.34974.josh@agliodbs.com> In-Reply-To: <200306170923.34974.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200306180920.44304.x@Vex.Net> X-Archive-Number: 200306/213 X-Sequence-Number: 13971 On June 17, 2003 12:23 pm, Josh Berkus wrote: > Personally, I'm not a fan of inherited tables; I think they muddy up > the relationality of SQL without providing any additional We actually are doing what the original poster is in the process of doing; we have an ISP billing system based on postgresql. I have to agree with the above. We actually did use inheritence for a few things (though not for account definitions), and I've always found it somewhat of a pain. Especially when pg_dump was broken and corrupted the database on restore... I believe this is fixed now, but I can't see the benefit of the complication, whereas it does make the relationships more murky as described above. > JOIN webhosting ON service.id = webhosting.service This would work though it's not very scaleable. Our current system makes all elements of a service into what we call an 'attribute'. The attributes are defined in a table, and attached to each account type, and turned on or off, and twiddled with various definitions such as term/period billing, etc. This makes it relatively easy to add new services... just add another entry in the account attributes table, whereas with hard coded joins above, if you add more services you're going to have to edit all of your code where joins take place. So the billing job, for example, if you want a list of services that a customer's account has: SELECT * FROM account_attribute WHERE account_type=customer.account_type AND bill_mode>0; (We go even further and do resource based accounting in yet another relation which references the attributes... it's a bit complicated, but I think its proving quite flexible so far, and cleaner than using inheritance). -- Tim Middleton | Cain Gang Ltd | But the trouble was that my hysterical fit x@veX.net | www.Vex.Net | could not go on for ever. --Dost (NFTU)