Re: On the need for a snapshot in exec_bind_message()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Wood <hexexpert(at)comcast(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: On the need for a snapshot in exec_bind_message()
Date: 2018-09-05 19:39:50
Message-ID: 13880.1536176390@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Wood <hexexpert(at)comcast(dot)net> writes:
> In particular:
> exec_bind_message()
> PushActiveSnapshot(GetTransactionSnapshot());

> If there were no input functions, that needed this, nor reparsing or
> reanalyzing needed, and we knew this up front, it'd be a huge win.

Unfortunately, that's not the case, so I think trying to get rid of
this call is a nonstarter.

What we have kicked around a bit is trying to get rid of the additional
snapshot-taking at the start of execution, so that the snapshot taken
at BIND time serves all the way through the query. That'd require a
fair amount of refactoring I think, but at least it's not a broken idea
on its face.

> In GetSnapshotData because pgxact, is declared volatile, the compiler will not reduce the following two IF tests into a single test:
> if (pgxact->vacuumFlags & PROC_IN_LOGICAL_DECODING)
> continue;
> if (pgxact->vacuumFlags & PROC_IN_VACUUM)
> continue;

That, on the other hand, is just crummy coding :-(

> I'm still working on quantifying any gain.

It'll be interesting to see if you can show visible improvement from
merging those. It's enough of a hotspot that I wouldn't be surprised
to find some, but actual numbers would be nice.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-09-05 19:46:45 Re: buildfarm: could not read block 3 in file "base/16384/2662": read only 0 of 8192 bytes
Previous Message Daniel Wood 2018-09-05 19:31:04 On the need for a snapshot in exec_bind_message()