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 C7FF4D1B4E3 for ; Wed, 8 Oct 2003 18:40:46 +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 19304-09 for ; Wed, 8 Oct 2003 15:40:02 -0300 (ADT) Received: from colsweeper.cranel.com (newmail.cranel.com [12.32.71.147]) by svr1.postgresql.org (Postfix) with ESMTP id 89324D1B4F6 for ; Wed, 8 Oct 2003 15:40:00 -0300 (ADT) Received: from colmail01.cranel.com (colmail01.cranel.com) by colsweeper.cranel.com (Content Technologies SMTPRS 4.2.5) with ESMTP id for ; Wed, 8 Oct 2003 14:42:07 -0400 Received: from cranel.com (gspiegelberg.cranel.com [192.168.11.134]) by colmail01.cranel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id T6NHFHJY; Wed, 8 Oct 2003 14:42:50 -0400 Message-ID: <3F8459FA.1030008@cranel.com> Date: Wed, 08 Oct 2003 14:39:54 -0400 From: Greg Spiegelberg Organization: Cranel, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: PgSQL Performance ML Subject: Re: Compare rows References: <3F841A28.8060504@cranel.com> <200310080901.45093.josh@agliodbs.com> <3F843AFD.3020700@cranel.com> <3F843F73.6030302@joeconway.com> In-Reply-To: <3F843F73.6030302@joeconway.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/235 X-Sequence-Number: 3983 Joe Conway wrote: > Greg Spiegelberg wrote: > >> The reason for my initial question was this. We save changes only. >> In other words, if system S has row T1 for day D1 and if on day D2 >> we have another row T1 (excluding our time column) we don't want >> to save it. > > > It still isn't entirely clear to me what you are trying to do, but > perhaps some sort of calculated checksum or hash would work to determine > if the data has changed? Best example I have is this. You're running Solaris 5.8 with patch 108528-X and you're collecting that data daily. Would you want option 1 or 2 below? Option 1 - Store it all Day | OS | Patch ------+-------------+----------- Oct 1 | Solaris 5.8 | 108528-12 Oct 2 | Solaris 5.8 | 108528-12 Oct 3 | Solaris 5.8 | 108528-13 Oct 4 | Solaris 5.8 | 108528-13 Oct 5 | Solaris 5.8 | 108528-13 and so on... To find what you're running: select * from table order by day desc limit 1; To find when it last changed however takes a join. Option 2 - Store only changes Day | OS | Patch ------+-------------+----------- Oct 1 | Solaris 5.8 | 108528-12 Oct 3 | Solaris 5.8 | 108528-13 To find what you're running: select * from table order by day desc limit 1; To find when it last changed: select * from table order by day desc limit 1 offset 1; I selected Option 2 because I'm dealing with mounds of complicated and varying data formats and didn't want to have to write complex queries for everything. Greg -- Greg Spiegelberg Sr. Product Development Engineer Cranel, Incorporated. Phone: 614.318.4314 Fax: 614.431.8388 Email: gspiegelberg@Cranel.com Cranel. Technology. Integrity. Focus.