Re: time stops within transaction

From: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>
To: "'pgsql-hackers(at)hub(dot)org'" <pgsql-hackers(at)hub(dot)org>
Subject: Re: time stops within transaction
Date: 2000-10-19 11:23:50
Message-ID: 8F4C99C66D04D4118F580090272A7A23018D75@SECTORBASE1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > Snapshot is made per top-level statement and functions/subqueries
> > > use the same snapshot as that of top-level statement.
> >
> > Not so. SetQuerySnapshot is executed per querytree, not per top-level
> > statement --- for example, if a rule generates multiple queries from
> > a user statement, SetQuerySnapshot is called again for each query.

This is true. I just made it to work as it was in pre-6.5 times - each
query of *top level* query list uses own snapshot (in read committed mode
only) as if they were submitted by user one by one.

But functions/subqueries called while executing query uses same snapshot
as query itself.

> > With the current structure of pg_exec_query_string(), an operation
> > executed in the outer loop, rather than the inner, would more or less
> > correspond to one "top level" query --- if you want to assume that
> > pg_exec_query_string() is only called from PostgresMain. That's
> > true today but hasn't always been true --- I believe it used to be
> > used to parse SPI commands, and someday it may be again.

It was never used in SPI. Just look at _SPI_execute. Same parent query
snapshot is used in SPI functions. *But* SPI' queries *see* changes
made by parent query - I never was sure about this and think I've asked
other opinions. No opinions - no changes -:)

> If there's no concept of top-level statement,there's no
> concept of read consistency and MVCC isn't needed.

Except of the fact that SPI' queries see changes made by parent same
snapshot is used all time while executing top-level query (single query,
not query list).

Vadim

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris 2000-10-19 11:58:14 Re: INHERITS doesn't offer enough functionality
Previous Message Mikheev, Vadim 2000-10-19 11:20:11 Re: SetQuerySnapshot() for utility statements