Re: time stops within transaction

From: "Vadim Mikheev" <vmikheev(at)sectorbase(dot)com>
To: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Alex Pilosov" <alex(at)pilosoft(dot)com>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: time stops within transaction
Date: 2000-10-19 05:51:22
Message-ID: 00be01c03990$9ceb15e0$b77a30d0@sectorbase.com
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 make 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris 2000-10-19 07:33:24 Re: INHERITS doesn't offer enough functionality
Previous Message Tom Lane 2000-10-19 05:40:54 Re: Index Ops supporting money type