Re: Automatic transactions in SELECT...

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Automatic transactions in SELECT...
Date: 2013-02-09 09:07:36
Message-ID: kf53ki$ot2$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Tom Lisjac wrote on 09.02.2013 03:16:
> We're in the process of deploying 9.2.1 to support an internal
> application we've been working on for the last few months. One of our
> programmers has recently complained that we get occasional hangs because
> "postgres automatically runs SELECT statements in a transaction that
> requires an explicit commit".

This behaviour is true for most (if not all) DBMS - defintely for Oracle, SQL Server and MySQL.

If no transaction is active, _any_ (DML) statement (including SELECT) will start a new transaction.
This can either be controlled via explicit transaction handling (BEGIN ... END) or the
autocommit property of the connection.

What exactly are those "occasional hangs"? How do they manifest themselves?

The select doesn't lock the rows that were selected (unless a FOR UPDATE was used).

Regards
Thomas

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lisjac 2013-02-09 10:43:26 Re: Automatic transactions in SELECT...
Previous Message Tom Lisjac 2013-02-09 05:15:40 Re: Automatic transactions in SELECT...