X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0A579D1B50F for ; Wed, 8 Oct 2003 23:15:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67234-02 for ; Wed, 8 Oct 2003 20:14:25 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id A99E2D1B4EE for ; Wed, 8 Oct 2003 20:14:21 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3743025; Wed, 08 Oct 2003 16:14:31 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Greg Spiegelberg , PgSQL Performance ML Subject: Re: Compare rows Date: Wed, 8 Oct 2003 16:11:59 -0700 User-Agent: KMail/1.4.3 References: <3F841A28.8060504@cranel.com> <200310081010.26576.josh@agliodbs.com> <3F84613D.8040207@cranel.com> In-Reply-To: <3F84613D.8040207@cranel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200310081611.59179.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/249 X-Sequence-Number: 3997 Greg, > You lost me on that one. What's a "vertical child table"? Currently, you store data like this: id address uptime speed memory tty 3 67.92 0.3 11.2 37 6 7 69.5 1.1 NULL 15 NULL 9 65.5 0.1 NULL 94 2 The most efficient way for you to store data would be like this: main table id address 3 67.92 7 69.5 9 65.5 child table id value_type value 3 uptime 0.3 3 speed 11.2 3 memory 37 3 tty 6 7 uptime 1.1 7 memory 15 9 uptime 0.1 9 memory 94 9 tty 2 As you can see, the NULLs are not stored, making this system much more=20 efficient on storage space. Tommorrow I'll (hopefully) write up how to query this for comparisons. It= =20 would help if you gave a little more details about what specific comparison= =20 you're doing, e.g. between tables or table to value, comparing just the las= t=20 value or all rows, etc. --=20 -Josh Berkus Aglio Database Solutions San Francisco