Streaming Replication vs Logical
Our docs seem to contrast "streaming replication" to logical, but
these are not really opposites. Sometimes when they say "streaming"
they mean "physical".
Probably this is historical: at first physical replication was the
only kind of streaming we had.
Personally this has caused me a lot of confusion. For example,
recently when I read "Synchronous replication (see Section 26.2.8) is
only supported on replication slots used over the streaming
replication interface," I took it to mean synchronous replication only
worked for physical replication, not logical. But actually here the
contrast is between the streaming protocol and SQL commands. I think
it would help if the docs elsewhere took more care to say "physical"
not "streaming" when that is the meaning.
This patch fixes a callout note in the Logical Decoding section. It
was sort of vague before. It dates back to the original commit
documenting logical decoding, so I'm not sure of the original motive.
I think the new text is more precise and about the other use for
replication slots, and also clearly separates streaming replication
from physical-vs-logical replication. (I used the word "typically"
because you *can* have a standby with logical replication, although
elsewhere we warn it may not be as robust.)
I also tried to fix the first three paragraphs of
https://www.postgresql.org/docs/current/runtime-config-replication.html
which seem to be setting up a distinction between streaming
replication and logical. This is tricky, because (1) we are trying to
introduce how we've organized different config parameters, and some
affect both physical and logical replication (e.g.
max_replication_slots and wal_retrieve_retry_interval) (2) you can use
logical replication without streaming (e.g.
pg_logical_slot_get_changes).
While I was making edits there, I took out some language about
"built-in" and "feature", which seem like unnecessary wordiness.
I also added "physical" to a couple places in
https://www.postgresql.org/docs/current/warm-standby.html as well as a
Note callout to clarify that the whole page is really about using
physical replication. Technically you could use logical replication to
run a standby, but that seems like a separate discussion.
Yours,
--
Paul ~{:-)
pj@illuminatedcomputing.com
Attachments:
v1-0001-Distinguish-between-streaming-replication-and-phy.patchapplication/octet-stream; name=v1-0001-Distinguish-between-streaming-replication-and-phy.patchDownload+20-12
On Fri, 2024-10-11 at 15:53 -0700, Paul A Jungwirth wrote:
Our docs seem to contrast "streaming replication" to logical, but
these are not really opposites. Sometimes when they say "streaming"
they mean "physical".Probably this is historical: at first physical replication was the
only kind of streaming we had.Personally this has caused me a lot of confusion. For example,
recently when I read "Synchronous replication (see Section 26.2.8) is
only supported on replication slots used over the streaming
replication interface," I took it to mean synchronous replication only
worked for physical replication, not logical.
What you are saying makes a lot of sense, and improving some of this
is a good thing.
Our current trminology is a mess. There are some places in the documentation
that speak of physical vs. logical replication, while most places use the
term "streaming replication" for physical replication. I myself consequently
speak of "streaming replication" vs. "logical replication", even though both
stream data. The protocol section of the documentation describes the
"streaming replication protocol" and the "logical streaming replication protocol".
This is confusing, and I am also sometimes confused in the way you described
above.
I think the mess is too well established to be really cleaned up. But adding
some clarity is a good thing, so +1.
Yours,
Laurenz Albe
On 12.10.24 00:53, Paul A Jungwirth wrote:
Our docs seem to contrast "streaming replication" to logical, but
these are not really opposites. Sometimes when they say "streaming"
they mean "physical".Probably this is historical: at first physical replication was the
only kind of streaming we had.Personally this has caused me a lot of confusion. For example,
recently when I read "Synchronous replication (see Section 26.2.8) is
only supported on replication slots used over the streaming
replication interface," I took it to mean synchronous replication only
worked for physical replication, not logical. But actually here the
contrast is between the streaming protocol and SQL commands. I think
it would help if the docs elsewhere took more care to say "physical"
not "streaming" when that is the meaning.This patch fixes a callout note in the Logical Decoding section. It
was sort of vague before. It dates back to the original commit
documenting logical decoding, so I'm not sure of the original motive.
I think the new text is more precise and about the other use for
replication slots, and also clearly separates streaming replication
from physical-vs-logical replication. (I used the word "typically"
because you *can* have a standby with logical replication, although
elsewhere we warn it may not be as robust.)I also tried to fix the first three paragraphs of
https://www.postgresql.org/docs/current/runtime-config-replication.html
which seem to be setting up a distinction between streaming
replication and logical. This is tricky, because (1) we are trying to
introduce how we've organized different config parameters, and some
affect both physical and logical replication (e.g.
max_replication_slots and wal_retrieve_retry_interval) (2) you can use
logical replication without streaming (e.g.
pg_logical_slot_get_changes).While I was making edits there, I took out some language about
"built-in" and "feature", which seem like unnecessary wordiness.I also added "physical" to a couple places in
https://www.postgresql.org/docs/current/warm-standby.html as well as a
Note callout to clarify that the whole page is really about using
physical replication. Technically you could use logical replication to
run a standby, but that seems like a separate discussion.Yours,
Adding clear definitions to the glossary would help users and authors alike.
J. Purtz
On Sat, Oct 12, 2024 at 07:01:31AM +0200, Laurenz Albe wrote:
On Fri, 2024-10-11 at 15:53 -0700, Paul A Jungwirth wrote:
Our docs seem to contrast "streaming replication" to logical, but
these are not really opposites. Sometimes when they say "streaming"
they mean "physical".Probably this is historical: at first physical replication was the
only kind of streaming we had.Personally this has caused me a lot of confusion. For example,
recently when I read "Synchronous replication (see Section 26.2.8) is
only supported on replication slots used over the streaming
replication interface," I took it to mean synchronous replication only
worked for physical replication, not logical.What you are saying makes a lot of sense, and improving some of this
is a good thing.Our current trminology is a mess. There are some places in the documentation
that speak of physical vs. logical replication, while most places use the
term "streaming replication" for physical replication. I myself consequently
speak of "streaming replication" vs. "logical replication", even though both
stream data. The protocol section of the documentation describes the
"streaming replication protocol" and the "logical streaming replication protocol".This is confusing, and I am also sometimes confused in the way you described
above.I think the mess is too well established to be really cleaned up. But adding
some clarity is a good thing, so +1.
I don't think our current setup is sustainable so I think it does need
to be cleaned up. Also, physical/logical replication slots also needs
help, I think.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
When a patient asks the doctor, "Am I going to die?", he means
"Am I going to die soon?"
On Wed, Feb 19, 2025 at 10:07 PM Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Oct 12, 2024 at 07:01:31AM +0200, Laurenz Albe wrote:
On Fri, 2024-10-11 at 15:53 -0700, Paul A Jungwirth wrote:
Our docs seem to contrast "streaming replication" to logical, but
these are not really opposites. Sometimes when they say "streaming"
they mean "physical".Probably this is historical: at first physical replication was the
only kind of streaming we had.Personally this has caused me a lot of confusion. For example,
recently when I read "Synchronous replication (see Section 26.2.8) is
only supported on replication slots used over the streaming
replication interface," I took it to mean synchronous replication only
worked for physical replication, not logical.What you are saying makes a lot of sense, and improving some of this
is a good thing.Our current trminology is a mess. There are some places in the
documentation
that speak of physical vs. logical replication, while most places use the
term "streaming replication" for physical replication. I myselfconsequently
speak of "streaming replication" vs. "logical replication", even though
both
stream data. The protocol section of the documentation describes the
"streaming replication protocol" and the "logical streaming replicationprotocol".
This is confusing, and I am also sometimes confused in the way you
described
above.
I think the mess is too well established to be really cleaned up. But
adding
some clarity is a good thing, so +1.
The attached patch expands on Paul's original patch, further
consolidating around the terms "streaming physical replication" and
"streaming logical replication" in places where it makes sense. I would
note that there are places where "streaming replication" makes sense (when
it applies to both types) and potentially when "physical replication" might
make sense when we could be talking about either streaming or wal shipping,
so I don't think we can completely eliminate that, but hopefully this
improves what we have.
I don't think our current setup is sustainable so I think it does need
to be cleaned up. Also, physical/logical replication slots also needs
help, I think.
I took a look through some of the replication slot stuff and ISTM that it
basically gets the streaming logical/physical replication distinctions
correct, and I *think*
it gets the slot distinctions correct as well, but to the degree there
might be some issue there, I think it could be addressed separately.
Robert Treat
https://xzilla.net
Attachments:
v2-0001-Distinguish-between-streaming-replication-and-phy.patchapplication/octet-stream; name=v2-0001-Distinguish-between-streaming-replication-and-phy.patchDownload+31-23
On Wed, Feb 19, 2025 at 11:15 PM Robert Treat <rob@xzilla.net> wrote:
On Wed, Feb 19, 2025 at 10:07 PM Bruce Momjian <bruce@momjian.us> wrote:
On Sat, Oct 12, 2024 at 07:01:31AM +0200, Laurenz Albe wrote:
On Fri, 2024-10-11 at 15:53 -0700, Paul A Jungwirth wrote:
Our docs seem to contrast "streaming replication" to logical, but
these are not really opposites. Sometimes when they say "streaming"
they mean "physical".Probably this is historical: at first physical replication was the
only kind of streaming we had.Personally this has caused me a lot of confusion. For example,
recently when I read "Synchronous replication (see Section 26.2.8) is
only supported on replication slots used over the streaming
replication interface," I took it to mean synchronous replication only
worked for physical replication, not logical.What you are saying makes a lot of sense, and improving some of this
is a good thing.Our current trminology is a mess. There are some places in the documentation
that speak of physical vs. logical replication, while most places use the
term "streaming replication" for physical replication. I myself consequently
speak of "streaming replication" vs. "logical replication", even though both
stream data. The protocol section of the documentation describes the
"streaming replication protocol" and the "logical streaming replication protocol".This is confusing, and I am also sometimes confused in the way you described
above.I think the mess is too well established to be really cleaned up. But adding
some clarity is a good thing, so +1.The attached patch expands on Paul's original patch, further consolidating around the terms "streaming physical replication" and "streaming logical replication" in places where it makes sense. I would note that there are places where "streaming replication" makes sense (when it applies to both types) and potentially when "physical replication" might make sense when we could be talking about either streaming or wal shipping, so I don't think we can completely eliminate that, but hopefully this improves what we have.
I don't think our current setup is sustainable so I think it does need
to be cleaned up. Also, physical/logical replication slots also needs
help, I think.I took a look through some of the replication slot stuff and ISTM that it basically gets the streaming logical/physical replication distinctions correct, and I *think*
it gets the slot distinctions correct as well, but to the degree there might be some issue there, I think it could be addressed separately.
Hey Bruce,
Your recent commit on this topic [1]https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=a5b69e30731fb623715ecf4c8073c0f2dee41678;hp=acbc9beaaed6ee88416e1dcef5df77fd5baba0be) reminded me of the patch from
earlier this year meant to address some other areas where we are
blurry about using streaming vs physical vs logical replication. I
think (I might possibly still be jet lagged) I have updated the
previous version of that patch against HEAD, attached, and bumping it
up for review.
Robert Treat
https://xzilla.net
Attachments:
v3-0001-Clarify-usage-of-the-term-streaming-replication.patchapplication/octet-stream; name=v3-0001-Clarify-usage-of-the-term-streaming-replication.patchDownload+31-23
On Mon, Nov 24, 2025 at 11:28:22PM -0500, Robert Treat wrote:
I took a look through some of the replication slot stuff and ISTM that it basically gets the streaming logical/physical replication distinctions correct, and I *think*
it gets the slot distinctions correct as well, but to the degree there might be some issue there, I think it could be addressed separately.Hey Bruce,
Your recent commit on this topic [1] reminded me of the patch from
earlier this year meant to address some other areas where we are
blurry about using streaming vs physical vs logical replication. I
think (I might possibly still be jet lagged) I have updated the
previous version of that patch against HEAD, attached, and bumping it
up for review.
Funny you found this patch, and I was thinking about it recently also
because of the fixes for physical vs logical replication. I will apply
this patch after sufficient review time, thanks.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
On Thu, Nov 27, 2025 at 12:16:01AM -0500, Bruce Momjian wrote:
On Mon, Nov 24, 2025 at 11:28:22PM -0500, Robert Treat wrote:
I took a look through some of the replication slot stuff and ISTM that it basically gets the streaming logical/physical replication distinctions correct, and I *think*
it gets the slot distinctions correct as well, but to the degree there might be some issue there, I think it could be addressed separately.Hey Bruce,
Your recent commit on this topic [1] reminded me of the patch from
earlier this year meant to address some other areas where we are
blurry about using streaming vs physical vs logical replication. I
think (I might possibly still be jet lagged) I have updated the
previous version of that patch against HEAD, attached, and bumping it
up for review.Funny you found this patch, and I was thinking about it recently also
because of the fixes for physical vs logical replication. I will apply
this patch after sufficient review time, thanks.
Great, patch applied, and commitfest updated. I apologize this dropped
off my radar for so long.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
On Fri, Dec 19, 2025 at 12:02 PM Bruce Momjian <bruce@momjian.us> wrote:
On Thu, Nov 27, 2025 at 12:16:01AM -0500, Bruce Momjian wrote:
On Mon, Nov 24, 2025 at 11:28:22PM -0500, Robert Treat wrote:
I took a look through some of the replication slot stuff and ISTM that it basically gets the streaming logical/physical replication distinctions correct, and I *think*
it gets the slot distinctions correct as well, but to the degree there might be some issue there, I think it could be addressed separately.Hey Bruce,
Your recent commit on this topic [1] reminded me of the patch from
earlier this year meant to address some other areas where we are
blurry about using streaming vs physical vs logical replication. I
think (I might possibly still be jet lagged) I have updated the
previous version of that patch against HEAD, attached, and bumping it
up for review.Funny you found this patch, and I was thinking about it recently also
because of the fixes for physical vs logical replication. I will apply
this patch after sufficient review time, thanks.Great, patch applied, and commitfest updated. I apologize this dropped
off my radar for so long.
Thanks Bruce / All!
Robert Treat
https://xzilla.net