Unix/Linux Go Back    


RedHat 9 (Linux i386) - man page for begin (redhat section 7)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)


BEGIN(7)				   SQL Commands 				 BEGIN(7)

NAME
       BEGIN - start a transaction block

SYNOPSIS
       BEGIN [ WORK | TRANSACTION ]

   INPUTS
       WORK

       TRANSACTION
	      Optional keywords. They have no effect.

   OUTPUTS
       BEGIN  This signifies that a new transaction has been started.

       WARNING: BEGIN: already a transaction in progress
	      This indicates that a transaction was already in progress.  The current transaction
	      is not affected.

DESCRIPTION
       By default, PostgreSQL executes transactions in unchained mode (also known  as  ``autocom-
       mit''  in other database systems).  In other words, each user statement is executed in its
       own transaction and a commit is implicitly performed at the end of the statement (if  exe-
       cution  was successful, otherwise a rollback is done).  BEGIN initiates a user transaction
       in chained mode, i.e., all user statements after BEGIN command will be executed in a  sin-
       gle  transaction  until	an explicit COMMIT [commit(7)] or ROLLBACK [rollback(7)].  State-
       ments are executed more quickly in chained mode, because transaction start/commit requires
       significant  CPU  and disk activity. Execution of multiple statements inside a transaction
       is also useful to ensure consistency when changing several related tables:  other  clients
       will  be  unable  to  see the intermediate states wherein not all the related updates have
       been done.

       The default transaction isolation level in PostgreSQL  is  READ	COMMITTED,  wherein  each
       query  inside  the  transaction sees changes committed before that query begins execution.
       So, you have to use SET TRANSACTION ISOLATION LEVEL SERIALIZABLE just after BEGIN  if  you
       need  more  rigorous  transaction  isolation.  (Alternatively,  you can change the default
       transaction isolation level; see the PostgreSQL Administrator's Guide  for  details.)   In
       SERIALIZABLE  mode  queries  will see only changes committed before the entire transaction
       began (actually, before execution of the first DML statement in the transaction).

       Transactions have the standard ACID (atomic, consistent, isolatable, and durable)  proper-
       ties.

   NOTES
       START TRANSACTION [start_transaction(7)] has the same functionality as BEGIN.

       Use COMMIT [commit(7)] or ROLLBACK [rollback(7)] to terminate a transaction.

       Refer to LOCK [lock(7)] for further information about locking tables inside a transaction.

       If you turn autocommit mode off, then BEGIN is not required: any SQL command automatically
       starts a transaction.

USAGE
       To begin a user transaction:

       BEGIN WORK;

COMPATIBILITY
   SQL92
       BEGIN is a PostgreSQL language extension.  There is no explicit BEGIN  command  in  SQL92;
       transaction  initiation is always implicit and it terminates either with a COMMIT or ROLL-
       BACK statement.

	      Note: Many relational database systems offer an  autocommit  feature  as	a  conve-
	      nience.

       Incidentally,  the  BEGIN keyword is used for a different purpose in embedded SQL. You are
       advised to be careful about the transaction semantics when porting database applications.

       SQL92 also requires SERIALIZABLE to be the default transaction isolation level.

SQL - Language Statements		    2002-11-22					 BEGIN(7)
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums


All times are GMT -4. The time now is 03:11 PM.