Re: Option to ensure monotonic timestamps

2018-02-20 Thread Brent Kerby
The issue is that presence of timestamps is fundamental to the functionality of temporal tables. The users need to.be able to make queries on temporal tables in terms of timestamps; LSNs won't mean anything to them. It would be an option to implement the temporal tables using LSNs under the hood, b

Re: Option to ensure monotonic timestamps

2018-02-20 Thread Brent Kerby
Right, I'm talking about temporal tables in the sense of the SQL:2011 standard. I know there's a Postgres extension temporal_tables by Vlad Arkhipov (https://github.com/arkhipov/temporal_tables/) that approximates this. There's also a way of doing it using only triggers written in pgplsql, by Paolo

Re: Option to ensure monotonic timestamps

2018-02-20 Thread Tom Lane
Andres Freund writes: > On 2018-02-20 12:32:22 -0500, Tom Lane wrote: >> The "global" variable would actually need to be cluster-wide, ie in shared >> memory, which would imply contention and the need for locks. I think the >> overhead of this would be mighty high, and the return pretty low. > I

Re: Option to ensure monotonic timestamps

2018-02-20 Thread Andres Freund
Hi, On 2018-02-20 12:32:22 -0500, Tom Lane wrote: > The "global" variable would actually need to be cluster-wide, ie in shared > memory, which would imply contention and the need for locks. I think the > overhead of this would be mighty high, and the return pretty low. I think if we wanted to go

Re: Option to ensure monotonic timestamps

2018-02-20 Thread Patrick Krecker
On Tue, Feb 20, 2018 at 9:51 AM, Andres Freund wrote: > Hi, > > Leaving Tom's concerns aside: > > On 2018-02-19 13:42:31 -0700, Brent Kerby wrote: >> Hi, I'm new to Postgres hacking, and I'm interested in the possibility of a >> new feature to make it possible to ensure that Postgres-generated >>

Re: Option to ensure monotonic timestamps

2018-02-20 Thread Andres Freund
Hi, Leaving Tom's concerns aside: On 2018-02-19 13:42:31 -0700, Brent Kerby wrote: > Hi, I'm new to Postgres hacking, and I'm interested in the possibility of a > new feature to make it possible to ensure that Postgres-generated > timestamps never decrease even if the system clock may step backwa

Re: Option to ensure monotonic timestamps

2018-02-20 Thread Tom Lane
Brent Kerby writes: > What I propose is that we could add a boolean configuration option, say > 'ensure_monotonic_timestamps', that enables the following behavior: when > GetCurrentTimestamp is called ( > https://doxygen.postgresql.org/backend_2utils_2adt_2timestamp_8c.html#a9822cdf3fd41b15851c0c1