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 035F4D1B580 for ; Fri, 10 Oct 2003 16:45:11 +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 52902-08 for ; Fri, 10 Oct 2003 13:44:24 -0300 (ADT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id C5048D1B537 for ; Fri, 10 Oct 2003 13:44:21 -0300 (ADT) Received: (qmail 24915 invoked from network); 10 Oct 2003 16:44:21 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 10 Oct 2003 16:44:21 -0000 From: greg@turnstep.com To: pgsql-performance@postgresql.org Subject: Re: Compare rows X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <200310081611.59179.josh@agliodbs.com> Date: Fri, 10 Oct 2003 16:44:21 -0000 X-Mailer: JoyMail 1.38 Message-ID: <1756cdfe0672f1cab443627e1fd7a4b3@biglumber.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/345 X-Sequence-Number: 4093 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > The most efficient way for you to store data would be like this: > main table > id address > 3 67.92 > 7 69.5 > > child table > id value_type value > 3 uptime 0.3 > 3 memory 37 > 7 uptime 1.1 > 7 memory 15 Actually, a more efficient* way is this: value table vid value_name 1 uptime 2 memory child table id vid value 3 1 0.3 3 2 37 7 1 1.1 7 2 15 * Still not necessarily the *most* efficient, depending on how the values are distributed, but it sure beats storing "uptime" over and over again. :) - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200310101243 -----BEGIN PGP SIGNATURE----- Comment: http://www.turnstep.com/pgp.html iD8DBQE/huHxvJuQZxSWSsgRAiMNAKD4kQCwdv3fXyEFUu64mymtf567dwCcCKd5 ZzJaV7wjfs00DBT62bVpHhs= =32b8 -----END PGP SIGNATURE-----