pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Melanie Plageman <melanieplageman@gmail.com>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Subject: Re: BitmapHeapScan streaming read user and prelim refactoring
Date: Thu, 14 Mar 2024 15:00:49 +0200
Message-ID: <7ffe3d58-ec85-41f0-93af-37cfb60331c2@iki.fi> (raw)
In-Reply-To: <CA+TgmoYiYQLSyj_-yjrtAkUTt+2i-k_NUek+tpr37EzAGXKO3A@mail.gmail.com>
References: <CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA@mail.gmail.com>
	<20240214194228.jf4o7luxtyra5ggv@awork3.anarazel.de>
	<CAAKRu_bQ9a2dB42Tz-mrsR+2MuG-ojRmqbX-x-TC08Uo_RunNw@mail.gmail.com>
	<20240216173559.xiy5xcl5dqmsprns@liskov>
	<20240227015028.knohvy3spaqwk7lf@liskov>
	<20240227142230.nu3ytvcjwouvczlt@liskov>
	<5f3b9d59-0f43-419d-80ca-6d04c07cf61a@iki.fi>
	<CAFiTN-vALdOjGA4zyKVrw93e8oTpeFxJWUKaeCrQczVw=W4DAQ@mail.gmail.com>
	<CA+Tgmob_5W8=kxPKbjzjy_UWO1QXv0Z53jnvLABJwuU7S4zL+Q@mail.gmail.com>
	<CAFiTN-sdUxh3O_7fh=iEVpmvZkALjywOkYu0LnqJcfDZEQdhVg@mail.gmail.com>
	<cd50927a-8b19-4f0f-884d-609212c71c91@iki.fi>
	<CA+TgmoYiYQLSyj_-yjrtAkUTt+2i-k_NUek+tpr37EzAGXKO3A@mail.gmail.com>

On 14/03/2024 14:34, Robert Haas wrote:
> On Thu, Mar 14, 2024 at 6:37 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> If es_snapshot was different from the active snapshot, things would get
>> weird, even without parallel query. The scans would use es_snapshot for
>> the visibility checks, but any functions you execute in quals would use
>> the active snapshot.
> 
> Hmm, that's an interesting point.
> 
> The case where the query is suspended and resumed - i.e. cursors are
> used - probably needs more analysis. In that case, perhaps there's
> more room for the snapshots to diverge.

The portal code is pretty explicit about it, the ExecutorRun() call in 
PortalRunSelect() looks like this:

             PushActiveSnapshot(queryDesc->snapshot);
             ExecutorRun(queryDesc, direction, (uint64) count,
                         portal->run_once);
             nprocessed = queryDesc->estate->es_processed;
             PopActiveSnapshot();

I looked at all the callers of ExecutorRun(), and they all have the 
active snapshot equal to queryDesc->snapshot, either because they called 
CreateQueryDesc() with the active snapshot before ExecutorRun(), or they 
set the active snapshot like above.

-- 
Heikki Linnakangas
Neon (https://neon.tech)






view thread (248+ messages)  latest in thread

Message-ID: <7ffe3d58-ec85-41f0-93af-37cfb60331c2@iki.fi>
Permalink:  ../7ffe3d58-ec85-41f0-93af-37cfb60331c2@iki.fi/
Also on:    postgresql.org/message-id/7ffe3d58-ec85-41f0-93af-37cfb60331c2@iki.fi

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: hlinnaka@iki.fi, robertmhaas@gmail.com, dilipbalaut@gmail.com, melanieplageman@gmail.com, byavuz81@gmail.com, andres@anarazel.de, thomas.munro@gmail.com, tomas.vondra@enterprisedb.com
  Subject: Re: BitmapHeapScan streaming read user and prelim refactoring
  In-Reply-To: <7ffe3d58-ec85-41f0-93af-37cfb60331c2@iki.fi>

* 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