Search Postgresql Archives

Re: Postgres 8.3 HOT and non-persistent xids

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ Pavan already answered most of this, but ... ]

"Mike C" <smith.not.western@xxxxxxxxx> writes:
> And for non-persistent transaction ids, the documentation says that
> this is for read-only transactions. What defines a read-only
> transaction for this purpose?

A transaction that has not done anything that requires it to sign an
update with its transaction ID.

> Does postgres check to see if a SELECT
> includes e.g. a sequence change via nextval?

IIRC, nextval() doesn't involve marking anything with one's XID,
because it is not a rollback-able operation.  But you are thinking
at quite the wrong level if you suppose that this behavior has anything
to do with "checking a SELECT for a writing operation".  The way it
really works is that a backend generates a persistent XID for its
current transaction at the instant that some bit of code first demands
the transaction's XID.  Typically this happens because you insert,
update, or delete some tuple, and the XID is needed to set xmin or xmax
of the tuple.  There are some other cases, but they are covered by
definition, because there is no way to get the current XID except to ask
that code for it.

> If I mark the transaction
> as readonly using the PG JDBC driver, will that be sufficient?

If this means what I think it means, it's irrelevant.  Materializing a
persistent XID is driven off what the transaction *actually* does,
not off whether it's declared to be read-only or not.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux