Re: [SQL] [ADMIN] Is there anyway to... - Mailing list pgsql-general

From Richard Huxton
Subject Re: [SQL] [ADMIN] Is there anyway to...
Date
Msg-id 455300C3.4050008@archonet.com
Whole thread Raw
In response to Re: [SQL] [ADMIN] Is there anyway to...  (<operationsengineer1@yahoo.com>)
List pgsql-general
operationsengineer1@yahoo.com wrote:
> i'm wanting to learn something here so i'm going to
> chime in.
>
> the way i read what you are saying is that you'd have
> start_date and number_days columns in your table.
>
> each day a query would run and pull the start_date and
> numbers_days columns.
>
> the application (or postgresql function) would then
> take the current date, subtract starte date and
> compare it to number of days.  if it is above that
> number, the code will take some sort of action.
>
> is that about it or have i missed something?

I think that's what Jim's talking about. Databases are good at filtering
large numbers of rows.

You'll also want some sort of status code or "processed" flag, so you
know not to look at rows you've already handled.

The other alternative would be an "expiry_list" table that stores the
target row's key and when it expires. Add a row when the contract is
created. Delete the row when the contract is paid. Keep it all
up-to-date with triggers.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Can PostgreSQL notify a client that a trigger has fired?
Next
From: "Gregory S. Williamson"
Date:
Subject: Re: planer picks a bad plan (seq-scan instead of index)