public inbox for [email protected]help / color / mirror / Atom feed
Is postgresql's json strong consistency or eventually consistency? 6+ messages / 4 participants [nested] [flat]
* Is postgresql's json strong consistency or eventually consistency? @ 2025-01-16 12:25 anlex N <[email protected]> 0 siblings, 2 replies; 6+ messages in thread From: anlex N @ 2025-01-16 12:25 UTC (permalink / raw) To: [email protected] I have searched all archives, but have no results. Please help me. ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Is postgresql's json strong consistency or eventually consistency? @ 2025-01-16 13:02 Laurenz Albe <[email protected]> parent: anlex N <[email protected]> 1 sibling, 1 reply; 6+ messages in thread From: Laurenz Albe @ 2025-01-16 13:02 UTC (permalink / raw) To: anlex N <[email protected]>; [email protected] On Thu, 2025-01-16 at 15:25 +0300, anlex N wrote: > I have searched all archives, but have no results. Please help me. That's probably because the question doesn't make much sense. A single PostgreSQL instance (=cluster) enforces consistency, and it doesn't matter which data type you are using. So I guess the answer should be "strong consistency". Yours, Laurenz Albe ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Is postgresql's json strong consistency or eventually consistency? @ 2025-01-16 15:57 Adrian Klaver <[email protected]> parent: anlex N <[email protected]> 1 sibling, 1 reply; 6+ messages in thread From: Adrian Klaver @ 2025-01-16 15:57 UTC (permalink / raw) To: anlex N <[email protected]>; [email protected] On 1/16/25 04:25, anlex N wrote: > I have searched all archives, but have no results. Please help me. Consistency of what? -- Adrian Klaver [email protected] ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Is postgresql's json strong consistency or eventually consistency? @ 2025-01-24 03:46 anlex N <[email protected]> parent: Adrian Klaver <[email protected]> 0 siblings, 1 reply; 6+ messages in thread From: anlex N @ 2025-01-24 03:46 UTC (permalink / raw) To: Adrian Klaver <[email protected]>; +Cc: [email protected] Hello Adrian, Laurenz. Have you tried postgresql's json in your everyday life? How fast is it? how is it than mongodb? On Thu, Jan 16, 2025 at 6:57 PM Adrian Klaver <[email protected]> wrote: > On 1/16/25 04:25, anlex N wrote: > > I have searched all archives, but have no results. Please help me. > > Consistency of what? > > -- > Adrian Klaver > [email protected] > > ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Is postgresql's json strong consistency or eventually consistency? @ 2025-01-24 05:19 Adrian Klaver <[email protected]> parent: anlex N <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Adrian Klaver @ 2025-01-24 05:19 UTC (permalink / raw) To: anlex N <[email protected]>; +Cc: [email protected] On 1/23/25 19:46, anlex N wrote: > Hello Adrian, Laurenz. Have you tried postgresql's json in your everyday > life? How fast is it? how is it than mongodb? To get the answers you want it would be better to describe what you are trying to achieve by using JSON. > > On Thu, Jan 16, 2025 at 6:57 PM Adrian Klaver <[email protected] > <mailto:[email protected]>> wrote: > > On 1/16/25 04:25, anlex N wrote: > > I have searched all archives, but have no results. Please help me. > > Consistency of what? > > -- > Adrian Klaver > [email protected] <mailto:[email protected]> > -- Adrian Klaver [email protected] ^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Is postgresql's json strong consistency or eventually consistency? @ 2025-01-24 10:40 Torsten Förtsch <[email protected]> parent: Laurenz Albe <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Torsten Förtsch @ 2025-01-24 10:40 UTC (permalink / raw) To: Laurenz Albe <[email protected]>; +Cc: anlex N <[email protected]>; [email protected] On Thu, Jan 16, 2025 at 2:02 PM Laurenz Albe <[email protected]> wrote: > On Thu, 2025-01-16 at 15:25 +0300, anlex N wrote: > > I have searched all archives, but have no results. Please help me. > > That's probably because the question doesn't make much sense. > A single PostgreSQL instance (=cluster) enforces consistency, > and it doesn't matter which data type you are using. > > So I guess the answer should be "strong consistency". I guess what the original author was trying to ask is how many databases have to acknowledge a transaction before it is considered committed, stuff that's called in mongodb write_concern and read_concern. @anlex, PG at its heart is not a distributed system. When you talk about consistency in PG you normally mean foreign key consistency or similar, properties where data in one table is somehow related to data in another table. A slightly different meaning of consistency comes when you talk about transaction isolation levels. All of this is different from Mongodb's read/write consistency. In Mongodb a write can go to one machine while the subsequent read can fetch data from another. So, you worry about linearizability, causal consistency and such things. The only slightly similar question in PG is "Can I see data somehow, on the master or a replica, that has been written to the database but where the master has not yet acknowledged the commit to the client?" The short answer is, yes. As soon as the commit record has been written to the WAL, it is being transferred and replayed on streaming replicas. After that the master might still have to do things like waiting for a synchronous replica to acknowledge the transaction before the transaction becomes visible on the master. On a fast enough replica, the transaction can, hence, become visible before it's visible on the master. https://foertsch.cc/en/postgres/commit-timing You can control that behavior with the `synchronous_commit` setting in combination with `synchronous_standby_names`. You can tell the DB, for instance, a transaction should be considered as committed only when 3 out of 5 replicas have acknowledged it. If you set synchronous_commit=remote_apply and configure N out of N replicas in synchronous_standby_names, that would likely give you a distributed database with strong consistency where you can direct writes to the master and read-only load to the replicas. But I guess nobody in his right mind would do that unless your database is rarely written to. ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2025-01-24 10:40 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-01-16 12:25 Is postgresql's json strong consistency or eventually consistency? anlex N <[email protected]> 2025-01-16 13:02 ` Laurenz Albe <[email protected]> 2025-01-24 10:40 ` Torsten Förtsch <[email protected]> 2025-01-16 15:57 ` Adrian Klaver <[email protected]> 2025-01-24 03:46 ` anlex N <[email protected]> 2025-01-24 05:19 ` Adrian Klaver <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox