Re: Fastest way / best practice to calculate "next birthdays"

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Fastest way / best practice to calculate "next birthdays"
Дата
Msg-id 555F9E47.5020003@BlueTreble.com
обсуждение исходный текст
Ответ на Re: Fastest way / best practice to calculate "next birthdays"  (Bosco Rama <postgres@boscorama.com>)
Список pgsql-performance
On 5/21/15 11:15 AM, Bosco Rama wrote:
> You could probably make some of that into a function that accepts a
> timestamptz and generates the two days.

You'll be better off if instead of 2 days it gives you a daterange:
http://www.postgresql.org/docs/9.4/static/rangetypes.html

I don't know about the exact ISO details, but your approach is the
correct one: find the date that the current week started on and then
build a range of [week start, week start + 7 days).

Also, note the use of [ vs ). That is the ONLY correct way to do this if
you're comparing to a timestamp.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


В списке pgsql-performance по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: How to clean/truncate / VACUUM FULL pg_largeobject without (much) downtime?
Следующее
От: Dave Johansen
Дата:
Сообщение: MAX() and multi-column index on a partitioned table?