From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Luca Ferrari <fluca1978@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: session_replication_role meaning?
Date: Tue, 30 Jan 2018 09:36:16 +0100
Message-ID: <1517301376.2517.14.camel@cybertec.at> (raw)
In-Reply-To: <CAKoxK+7qePHxaFxY3FUxNiTL98tR-LShmPQOoryr7RrH=LFx6A@mail.gmail.com>
References: <CAKoxK+7qePHxaFxY3FUxNiTL98tR-LShmPQOoryr7RrH=LFx6A@mail.gmail.com>
Luca Ferrari wrote:
> now this should be trivial, but I cannot udnerstand what is the
> purpose of session_replication_role
> or better, when I should use it in a way different from 'origin'.
It is used to enable or disable triggers.
By default, tables are created with all triggers enabled, which means
that they fire with the default setting "session_replication_role = origin".
You can change "session_replication_role" to "replica" to disable the firing
of triggers (unless they are set ENABLE REPLICA or ENABLE ALWAYS).
This is done by the logical replication apply worker, but you can also
use it to bypass triggers, e.g. to speed up operation, if you know what
you are doing.
What is confusing is that there are three settings for "session_replication_role",
but the two settings "local" and "origin" have the same meaning.
Maybe that was meant to change at some point, but I see no explanation in
the original discussion.
Yours,
Laurenz Albe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, fluca1978@gmail.com
Subject: Re: session_replication_role meaning?
In-Reply-To: <1517301376.2517.14.camel@cybertec.at>
References: <CAKoxK+7qePHxaFxY3FUxNiTL98tR-LShmPQOoryr7RrH=LFx6A@mail.gmail.com> <1517301376.2517.14.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox