begin.7
来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 87 行
7
87 行
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "BEGIN" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMEBEGIN \- start a transaction block.SH SYNOPSIS.sp.nfBEGIN [ WORK | TRANSACTION ] [ \fItransaction_mode\fR [, ...] ]where \fItransaction_mode\fR is one of: ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } READ WRITE | READ ONLY.sp.fi.SH "DESCRIPTION".PP\fBBEGIN\fR initiates a transaction block, that is,all statements after a \fBBEGIN\fR command will beexecuted in a single transaction until an explicit COMMIT [\fBcommit\fR(7)] or ROLLBACK [\fBrollback\fR(l)] is given.By default (without \fBBEGIN\fR),PostgreSQL executestransactions in ``autocommit'' mode, that is, eachstatement is executed in its own transaction and a commit isimplicitly performed at the end of the statement (if execution wassuccessful, otherwise a rollback is done)..PPStatements are executed more quickly in a transaction block, becausetransaction start/commit requires significant CPU and diskactivity. Execution of multiple statements inside a transaction isalso useful to ensure consistency when making several related changes:other sessions will be unable to see the intermediate stateswherein not all the related updates have been done..PPIf the isolation level or read/write mode is specified, the newtransaction has those characteristics, as ifSET TRANSACTION [\fBset_transaction\fR(7)] was executed..SH "PARAMETERS".TP\fBWORK\fR.TP\fBTRANSACTION\fROptional key words. They have no effect..PPRefer to SET TRANSACTION [\fBset_transaction\fR(7)] for information on the meaningof the other parameters to this statement..PP.SH "NOTES".PPSTART TRANSACTION [\fBstart_transaction\fR(7)] has the same functionalityas \fBBEGIN\fR..PPUse COMMIT [\fBcommit\fR(7)] orROLLBACK [\fBrollback\fR(7)]to terminate a transaction block..PPIssuing \fBBEGIN\fR when already inside a transaction block willprovoke a warning message. The state of the transaction is not affected.To nest transactions within a transaction block, use savepoints (see SAVEPOINT [\fBsavepoint\fR(7)])..PPFor reasons of backwards compatibility, the commas between successive\fItransaction_modes\fR may beomitted..SH "EXAMPLES".PPTo begin a transaction block:.sp.nfBEGIN;.sp.fi.SH "COMPATIBILITY".PP\fBBEGIN\fR is a PostgreSQLlanguage extension. It is equivalent to the SQL-standard commandSTART TRANSACTION [\fBstart_transaction\fR(7)], whose reference pagecontains additional compatibility information..PPIncidentally, the BEGIN key word is used for adifferent purpose in embedded SQL. You are advised to be carefulabout the transaction semantics when porting database applications..SH "SEE ALSO"COMMIT [\fBcommit\fR(7)], ROLLBACK [\fBrollback\fR(l)], START TRANSACTION [\fBstart_transaction\fR(l)], SAVEPOINT [\fBsavepoint\fR(l)]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?