Re: newbie : START TRANSACTION

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Zouari Fourat <fourat(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: newbie : START TRANSACTION
Date: 2005-02-15 15:29:16
Message-ID: 1108481356.11967.166.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, 2005-02-15 at 09:14, Zouari Fourat wrote:
> Hello
> am new to transactional sql (just moved from mysql) and would like to
> use transactions and i want to ask about it here, when am in a
> transaction block can i execute other queries on the server (that
> table exactly) or shoudl i commit the transaction to free the table ?

Firstly, read through this section of the manual:

http://www.postgresql.org/docs/8.0/static/mvcc.html

Secondly, postresql is designed around transactions, and generally you
don't have to worry about accidentally doing too much in one or anything
like that. This is especially true of DML (Data manipulation language)
queries.

However, transactions and DDL (data definition language) are a slightly
different story. While everything except create / drop database is
transactable, DDL statements tend to take out locks that do lock out
other users while running, and therefore should be run as a batch then
committed or not quickly, generally speaking.

Basically, as long as you're updating your data, you don't have to worry
too much about what's been locked, except for some visibility issues
(you might need select or update for some of those problems, as well as
serializable mode). When you're alter table structure and such, then it
can become an issue to other usres.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Dick Davies 2005-02-15 15:51:48 empty a database
Previous Message Zouari Fourat 2005-02-15 15:14:10 newbie : START TRANSACTION