From: | Greg Spiegelberg <gspiegelberg(at)cranel(dot)com> |
---|---|
To: | PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Compare rows |
Date: | 2003-10-08 18:39:54 |
Message-ID: | 3F8459FA.1030008@cranel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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(at)Cranel(dot)com
Cranel. Technology. Integrity. Focus.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff | 2003-10-08 18:45:49 | Re: [HACKERS] Sun performance - Major discovery! |
Previous Message | Neil Conway | 2003-10-08 18:37:31 | Re: Sun performance - Major discovery! |