Re: [SQL] [ADMIN] Is there anyway to...

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: [SQL] [ADMIN] Is there anyway to...
Дата
Msg-id 455300C3.4050008@archonet.com
обсуждение исходный текст
Ответ на Re: [SQL] [ADMIN] Is there anyway to...  (<operationsengineer1@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Can PostgreSQL notify a client that a trigger has fired?
Следующее
От: "Gregory S. Williamson"
Дата:
Сообщение: Re: planer picks a bad plan (seq-scan instead of index)