Re: Getting rows in statement-level triggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Getting rows in statement-level triggers
Дата
Msg-id 13152.1223077504@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Getting rows in statement-level triggers  (Artacus <artacus@comcast.net>)
Список pgsql-general
Artacus <artacus@comcast.net> writes:
>> This will not work, or at least it will stop working after your
>> installation passes 4 billion transactions.

>     * So what exactly happens at the 4 billion mark?

txid keeps going (that's why it's a bigint).  xid will wrap around.

>     * Why can't I cast an xid to int or bigint?

No very strong reason except that no such code is provided...
but you do have to think hard about the fact that xid comparison
is circular and does not work at all like integer comparison.

>     * The table in question is the largest in the db. How performative
>       is it to query based on xmin? Is xmin indexed? Can it be?

Not very, no, and no.

If you were really desperate you could make an indexed bigint column
that was filled with current_txid by an insert/update trigger, and
then search on that.

            regards, tom lane

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

Предыдущее
От: Joshua Drake
Дата:
Сообщение: Re: failed to install posgrest
Следующее
От: Erik Jones
Дата:
Сообщение: Re: ]OT] Parsing postgresql.conf archive_command