Re: Selecting table row with latest date - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Selecting table row with latest date
Date
Msg-id CA+bJJbx2kV=nDNB9zxBhMzgNaYLH-4nCh98y7boH-vkYCaUPeA@mail.gmail.com
Whole thread Raw
In response to Re: Selecting table row with latest date  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Selecting table row with latest date
List pgsql-general
Rich:

On Thu, Aug 19, 2021 at 6:59 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:
> On Thu, 19 Aug 2021, Rob Sargent wrote:
> > Yeah, but my quibble is the the table you described up-thread. Your
> > contact table contains next_contact? I think that column should be
> > normalized out.
> Why should I have a separate table with one column: next_contact? The
> next_contact date is associated with a person and the date that person was
> contacted.

Is your next_contact really dependent on the contact record (
person+contact_date? ).

I mean, your tables seem CRM like. You stated next_contact for old
contacts is not interesting. It seems next_contact is associated just
by a person, something like this:

You contact person 1 on april 2, decide to follow up on june 2 =>
insert ( p=1, cd=20210402, nc=20210602 ).

Case 1: You contact it in 20210603 , followup for mid july:
   Insert (1, 20210603, 20210715).
   Is the nc for the previous record useful for anything ? ( It seems
to be nor useful for calling, but you may want to do reports to see
next-contact correlation with the contacts on another records )

Case 2: You contact in mid may ( for whatever reason, he calls you,
whatever, you insert a record for follow up in July ( 1,20210515,
20210715).
Is the next contact date for june still valid?

To me, and maybe others, it seems there is only one valid next-contact
date, potentially null, which should go in the person record, and may
be the contacts table should capture the value of next-contact at the
time the contact was made for analysis. This also makes finding
contacts to be made soon easier.

Of course no separate table for next-contact.

Francisco Olarte.



pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: PostgreSQL 9.2 high replication lag
Next
From: Rich Shepard
Date:
Subject: Re: Selecting table row with latest date