Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzA2i-00FxkQ-G2 for pgsql-general@arkaria.postgresql.org; Mon, 31 Mar 2025 07:58:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tzA2h-0022ou-04 for pgsql-general@arkaria.postgresql.org; Mon, 31 Mar 2025 07:58:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzA2g-0022ol-KM for pgsql-general@lists.postgresql.org; Mon, 31 Mar 2025 07:58:46 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzA2d-002Buq-1M for pgsql-general@lists.postgresql.org; Mon, 31 Mar 2025 07:58:45 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-ac6e8cf9132so737377666b.2 for ; Mon, 31 Mar 2025 00:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1743407922; x=1744012722; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=n+PaPFCQAserr5vU87gfbQmxBwW0IgZHFNW7ooZQgCY=; b=rr62rNdOuW78Fl1UMejKiBdajyeLuurq27P+T/68gv7ED2Zb3yeXcGVqakRJz+tgS1 ZIIncRzrT21JR8+IqHqOyTAe+x8aDE2nDoHPvnK6xmtfquGOVF99hNGC2q5grC/1twSj MV4nWRZQSoVmO5fL9/VBMi33a882/1V57FZ3adupTJhkJFdi3y5n6LbXiZVzYrpuXh5r fHZ7/Yn35mOD4QIKb4puRuAZkousADrX1iRkAFXVwkVOXUp0J5qTYin7GsWGlVo38lo8 MPiV1N8wsnw7bbGwV3YDsLH0EaybE9pt65VbjZ/wmE4yDabhYDU6TjdKicF8e3kgayu+ PNbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743407922; x=1744012722; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=n+PaPFCQAserr5vU87gfbQmxBwW0IgZHFNW7ooZQgCY=; b=fzkNXcQqoqerD7a9vFnQdJP1qfFjK2JREcdQ6RanLNSNIOIgRom0G8TnvJFzVa2jQz k8JVI+/JM6/QLHAi3LDJt33VEPDbBn5eSk7TQ2VYiuN1kGJbEMiYfc7tA5GmdHUq2KXv hyTM8OMBorS4Lc4x9/zx6R0TiyYcu8lGDCu2kkaXF25aIxYHisyNmktmjUNPI/TGRrO9 t2NlqjNkPK913nSEv9BPtlHRarvhlBfyXQiw/BdmfDYAnXxwHaoeF1LjZDYe8SLEByMf 8X3a2kZn7VlhT/g394BfOGgfLlBT66NGUpmloqwtTDxOP8+1XzB4KMAUW5PNgsOX/bqw ytTg== X-Gm-Message-State: AOJu0YxUy9zRRLhGNXmkpwR+iJihnJ38WKr7wwyQ4SOVDCIlstPpk+n9 Y0HpFFjzyGcOvc+fgorLSXYBmTSucvTggIjNX3avaGMhya672YqGwJJAW6nlfr2cQgCym2Dd/n6 luao= X-Gm-Gg: ASbGncuScxhSANrmg0ov+PBxWgAePbWKSDl8CZFg6qdXUcR/igj1L6FWYCWlQExAH7v 5M0t0s1GgQgJCWT0TeA2cMscnbYkIfQ3E25uRas0cxVTCN7aHhgDWLLWeAehkb+75iUB8oDKrle h+1S3aP0DwK6HMDRnbwjnL5vmFcaCCQO+fWmQ7DcT0KlzBHFYFOUSCyk0xHKaV/k3xNvCiH1KyN +mSTxQ4+0spFExbD7pa6k5tMFgKL1QpHD7zh8EAv8wl0Tn6TBGxOINaZRukqMpTDEtOoGTNl0E5 7h1lrLS8wncxRbZMSKTqwK0iVxIft6lh6Fbc4T/HNQp9XfWU05L0M8q4Slt+StyC X-Google-Smtp-Source: AGHT+IHY/zLTzVJR+Z4Lg8gkJmqLuqjSQChOta6Mjuiuohb0613D1lmQNZceKG3KfMTaCqVo/qMAqA== X-Received: by 2002:a17:907:d27:b0:ac6:f4c1:b797 with SMTP id a640c23a62f3a-ac738aab50fmr700287866b.19.1743407922158; Mon, 31 Mar 2025 00:58:42 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:34ec:3b31:5a10:8f72:8b97]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac7196dc49csm579134066b.168.2025.03.31.00.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Mar 2025 00:58:41 -0700 (PDT) Message-ID: Subject: Re: SQL Server's WITH (NOLOCK) equivalent in PostgreSQL? From: Laurenz Albe To: "David G. Johnston" , =?UTF-8?Q?=EC=9D=B4=ED=98=84=EC=A7=84?= Cc: "pgsql-general@lists.postgresql.org" Date: Mon, 31 Mar 2025 09:58:41 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 2025-03-30 at 22:10 -0700, David G. Johnston wrote: > On Sunday, March 30, 2025, =EC=9D=B4=ED=98=84=EC=A7=84 wrote: > > Since PostgreSQL uses MVCC, I'm wondering what the best practice is for= non-blocking reads,=20 > > and whether there's an equivalent to dirty reads or READ UNCOMMITTED. >=20 > https://www.postgresql.org/docs/current/transaction-iso.html >=20 > We are unable to implement read uncommitted because of our choice to impl= ement MVCC. Perhaps it would be better to say "there is no need to implement a READ UNC= OMMITTED isolation level that actually allows for dirty reads". On databases like S= QL Server you don't use READ UNCOMMITTED because you desperately want to see dirty, i= nconsistent 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