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

2018-09-05 Thread Andres Freund
On 2018-09-05 19:11:56 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2018-09-05 18:45:52 -0400, Tom Lane wrote: > >> The snapshot has little to do with the query plan, usually. It's about > >> what view of the database the executed query will see, and particularly > >> about what view the

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

2018-09-05 Thread Daniel Wood
> > Queries stop getting re-optimized after 5 times, unless better plans are to > > be had. In the absence of schema changes or changing search path why is > > the snapshot needed? > > The snapshot has little to do with the query plan, usually. It's about > what view of the database the execut

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

2018-09-05 Thread Tom Lane
Andres Freund writes: > On 2018-09-05 18:45:52 -0400, Tom Lane wrote: >> The snapshot has little to do with the query plan, usually. It's about >> what view of the database the executed query will see, and particularly >> about what view the parameter input functions will see, if they look. > Th

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

2018-09-05 Thread Andres Freund
On 2018-09-05 18:45:52 -0400, Tom Lane wrote: > Daniel Wood writes: > >>> 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

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

2018-09-05 Thread Tom Lane
Daniel Wood writes: >>> 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 tr

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

2018-09-05 Thread Daniel Wood
> > 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

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

2018-09-05 Thread Andres Freund
Hi, On 2018-09-05 12:31:04 -0700, Daniel Wood wrote: > NOTE: > > 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; > > >

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

2018-09-05 Thread Tom Lane
Daniel Wood 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, s