Re: SQL Server's WITH (NOLOCK) equivalent in PostgreSQL?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, 이현진 <jemie9812(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL Server's WITH (NOLOCK) equivalent in PostgreSQL?
Date: 2025-03-31 07:58:41
Message-ID: cd5bae52c59264f52d98859b99a364797ad4655f.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 2025-03-30 at 22:10 -0700, David G. Johnston wrote:
> On Sunday, March 30, 2025, 이현진 <jemie9812(at)gmail(dot)com> wrote:
> > Since PostgreSQL uses MVCC, I'm wondering what the best practice is for non-blocking reads,
> > and whether there's an equivalent to dirty reads or READ UNCOMMITTED.
>
> https://www.postgresql.org/docs/current/transaction-iso.html
>
> We are unable to implement read uncommitted because of our choice to implement MVCC.

Perhaps it would be better to say "there is no need to implement a READ UNCOMMITTED
isolation level that actually allows for dirty reads". On databases like SQL Server
you don't use READ UNCOMMITTED because you desperately want to see dirty, inconsistent
data. It is just something you have to accept in order to avoid read locks.

Since PostgreSQL doesn't use read locks, there is no need for that.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eden Aharoni 2025-03-31 13:54:20 RDS IO Read time
Previous Message David G. Johnston 2025-03-31 05:10:54 Re: SQL Server's WITH (NOLOCK) equivalent in PostgreSQL?