Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql
Дата
Msg-id 20171007043130.zronedebya6iwtum@alap3.anarazel.de
обсуждение исходный текст
Ответ на [BUGS] pg_logical_slot_peek_changes crashes postgres when called from insidepl/pgsql  (Ben Chobot <bench@silentmedia.com>)
Ответы Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql
Список pgsql-bugs
Hi,

On 2017-10-04 13:59:20 -0700, Ben Chobot wrote:
> postgres=# CREATE OR REPLACE FUNCTION logical_replication_slot_lsn_delta(slot text) RETURNS pg_lsn AS
> postgres-# $$
> postgres$# BEGIN
> postgres$#     return location from pg_logical_slot_peek_changes(slot,null,1) limit 1;
> postgres$# END
> postgres$# $$ language plpgsql;

As the issue is fixed now, I just want to mention that looking at
logical decoding output via the SQL interface, especially when doing it
in very small increments as you're suggesting here, is way much more
expensive than continually streaming changes via the replication
protocol. In a lot of cases it'll be orders of magnitude more expensive.
So if you can change your usecase to use that, you'll benefit. It also
avoids having to change between peek/get, because you can just send back
messages specifying up to where you've processed changes safely.

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql
Следующее
От: Ben Chobot
Дата:
Сообщение: Re: [BUGS] pg_logical_slot_peek_changes crashes postgres when calledfrom inside pl/pgsql