Re: truncating timestamps on arbitrary intervals

From: Salek Talangi <salek(dot)talangi(at)googlemail(dot)com>
To: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: truncating timestamps on arbitrary intervals
Date: 2021-04-01 13:11:25
Message-ID: CACX8wBfHPKn7-2wo-32kTo_KQ5tsR_xvrFWDEUEzZZQw4CmcnQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

it might be a bit late now, but do you know that TimescaleDB already has a
similar feature, named time_bucket?
https://docs.timescale.com/latest/api#time_bucket
Perhaps that can help with some design decisions.
I saw your feature on Depesz' "Waiting for PostgreSQL 14" and remembered
reading about it just two days ago.

Best regards
Salek Talangi

Am Do., 1. Apr. 2021 um 13:31 Uhr schrieb John Naylor <
john(dot)naylor(at)enterprisedb(dot)com>:

> On Sat, Mar 27, 2021 at 1:06 PM Justin Pryzby <pryzby(at)telsasoft(dot)com>
> wrote:
> >
> > The current docs seem to be missing a "synopsis", like
> >
> > +<synopsis>
> > +date_trunc(<replaceable>stride</replaceable>,
> <replaceable>timestamp</replaceable>, <replaceable>origin</replaceable>)
> > +</synopsis>
>
> The attached
> - adds a synopsis
> - adds a bit more description to the parameters similar to those in
> date_trunc
> - documents that negative intervals are treated the same as positive ones
>
> Note on the last point: This just falls out of the math, so was not
> deliberate, but it seems fine to me. We could ban negative intervals, but
> that would possibly just inconvenience some people unnecessarily. We could
> also treat negative strides differently somehow, but I don't immediately
> see a useful and/or intuitive change in behavior to come of that.
>
> --
> John Naylor
> EDB: http://www.enterprisedb.com
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-04-01 13:12:47 Re: ModifyTable overheads in generic plans
Previous Message Zhihong Yu 2021-04-01 13:09:47 Re: Crash in BRIN minmax-multi indexes