Re: Usage of epoch in txid_current

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Usage of epoch in txid_current
Дата
Msg-id 20180710024014.jietykoykf5ygr7m@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Usage of epoch in txid_current  (Craig Ringer <craig@2ndquadrant.com>)
Ответы Re: Usage of epoch in txid_current  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
On 2018-07-10 10:32:44 +0800, Craig Ringer wrote:
> On 10 July 2018 at 07:35, Thomas Munro <thomas.munro@enterprisedb.com>
> wrote:
> 
> >
> > I played around with this idea yesterday.  Experiment-grade patch
> > attached.  Approach:
> >
> > 1.  Introduce a new type BigTransactionId (better names welcome).
> >
> 
> txid_current() should be changed to BigTransactionId too. It's currently
> bigint.

That's quite a bit more work though, no? We'd have to introduce a new
SQL level type (including operators).  As I said nearby, I think that's
a good idea, but I don't see any sort of benefit of forcing those
patches to be done at once.


> Users are currently left in a real mess when it comes to pg_stat_activity
> xids, etc, which are epoch-unqualified. txid_current() reports an
> epoch-qualified xid, but there's no sensible and safe conversion from
> txid_current()'s bigint to an epoch-qualified ID.

I am confused what you mean by "to an epoch-qualified ID". You want to
split txid_current()'s return value into epoch and xid? Isn't that
fairly trivial?

SELECT bigxid & x'ffffff'::int8 AS xid, bigxid >> 32 epoch FROM txid_current() bigxid;

Now I'm not saying that's pretty and couldn't be made easier.

Greetings,

Andres Freund


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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Usage of epoch in txid_current
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: Failure assertion in GROUPS mode of window function in current HEAD