Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 405AC633431 for ; Thu, 7 Jan 2010 16:20:10 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 61447-09 for ; Thu, 7 Jan 2010 20:19:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com [209.85.220.227]) by mail.postgresql.org (Postfix) with ESMTP id 80F906335A4 for ; Thu, 7 Jan 2010 16:19:59 -0400 (AST) Received: by fxm27 with SMTP id 27so4099330fxm.3 for ; Thu, 07 Jan 2010 12:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=BohFrRo4n8MZldlmBdkcu1/FKdfSamMLH13LAsvsFwQ=; b=sJem59SCVvzTwDL0+TOOuMP6Ld+XV2w5sUJFhtbs+4l0EvJD7fUaGa2/RP9jOOhtIq aUxbr4+UUzfU2BjiV6iLxfx1p1kTGMp5E3LVqT8Nzy9lw6Io6K7j0o1LCPzKyC31+x2I eCMHcjXDt5zdGFDiaahdgzKIR8qJgqp+QJ5Ss= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=h6w7O5jec4ZqJEqXqz3AXJTxeYr2svKZeAYmqa9iMgK25iF1TexxWLaoAZwqcMeCai hSH8r1bg9P5m7lBcJwUUhv1AutM9Q2XJxmRBUa03UzE2+P+MdI6ixLGosVyiVp5FQyra qZXybqfGxa9JJlsRkQnhB/N9zRV3kdEtdfHwA= MIME-Version: 1.0 Received: by 10.239.179.98 with SMTP id c34mr727168hbg.17.1262895597625; Thu, 07 Jan 2010 12:19:57 -0800 (PST) In-Reply-To: <22f7878e1001061553j69b3b461hadd4633c58c5304f@mail.gmail.com> References: <22f7878e1001061553j69b3b461hadd4633c58c5304f@mail.gmail.com> Date: Thu, 7 Jan 2010 15:19:57 -0500 Message-ID: <603c8f071001071219n423913b6l435e6c227c831333@mail.gmail.com> Subject: Re: noob inheritance question From: Robert Haas To: Zintrigue Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/121 X-Sequence-Number: 37001 On Wed, Jan 6, 2010 at 6:53 PM, Zintrigue wrote: > I'm wondering if there's any performance penalty here There definitely is. Your design sounds pretty painful to me... adding a column referencing a side-table will be much nicer. > If anyone can offer in any insight as too how inheritance is actually > executed (compared to JOINs especially), I'd be most grateful. You can look at the query plans for your queries using EXPLAIN. Inheritance is really just UNION ALL under the covers - it's meant for partitioning, not the sort of thing you're trying to do here, so your query plans will probably not be too good with this design. ...Robert