自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

SET TRANSACTION 中文man頁面

系統(tǒng)
SET TRANSACTION 命令為當前事務設置特性。 它對后面的事務沒有影響。 SET SESSION CHARACTERISTICS 為一個會話中的每個事務設置缺省的隔離級別。 SET TRANSACTION 可以為一個獨立的事務覆蓋上面的設置。

NAME

SET TRANSACTION - 設置當前事務的特性

SYNOPSIS

SET TRANSACTION
    [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
SET SESSION CHARACTERISTICS AS TRANSACTION
    [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]

DESCRIPTION 描述

SET TRANSACTION 命令為當前事務設置特性。 它對后面的事務沒有影響。 SET SESSION CHARACTERISTICS 為一個會話中的每個事務設置缺省的隔離級別。 SET TRANSACTION 可以為一個獨立的事務覆蓋上面的設置。


 可用的事務特性是事務隔離級別和事務訪問模式(讀/寫或者只讀)。


 事務的隔離級別決定一個事務在同時存在其它并行運行的事務時它能夠看到什么數(shù)據(jù)。

READ COMMITTED

 一條語句只能看到在它開始之前的數(shù)據(jù)。這是缺省。
SERIALIZABLE

 當前的事務只能看到在這次事務第一條查詢或者修改數(shù)據(jù)的語句執(zhí)行之前的數(shù)據(jù)。
Tip: 提示: 說白了,serializable(可串行化)意味著兩個事務將把數(shù)據(jù)庫保持在同一個狀態(tài), 就好象這兩個事務是嚴格地按照先后順序執(zhí)行地那樣。


 事務隔離級別在事務中第一個數(shù)據(jù)修改語句 (SELECT, INSERT, DELETE, UPDATE, FETCH, COPY) 執(zhí)行之后就不能再次設置。 參閱 Chapter 12 ``Concurrency Control'' 獲取有關事務隔離級別和并發(fā)性控制的更多信息。


 事務訪問模式?jīng)Q定事務是讀/寫還是只讀。讀/寫是缺省。如果一個 事務是只讀,而且寫入的表不是臨時表,那么下面的 SQL 命令是不允許的:INSERT, UPDATE,DELETE,和 COPY TO; 而所有的 CREATE,ALTER,和 DROP 命令; COMMENT,GRANT,REVOKE, TRUNCATE;和 EXPLAIN ANALYZE 和EXECUTE 都不允許。這是一個高層次的只讀概念,它并不阻止對磁盤的寫入。  

NOTES 注意


 會話的缺省事務隔離級別也可以用命令

SET default_transaction_isolation = 'value'


 以及在配置文件里設置。 參考 Section 16.4 ``Run-time Configuration'' 獲取更多信息。  

COMPATIBILITY 兼容性


 兩個命令都在 SQL 標準里定義了。SQL 里的缺省事務隔離級別是 SERIALIZABLE; 在 PostgreSQL 里,缺省隔離級別是 READ COMMITED,但是你可以用上面的描述修改它。 PostgreSQL 并沒有提供隔離級別 READ UNCOMMITTED 和 REPEATABLE READ。 因為多版本并發(fā)控制,SERIALIZABLE 級別并非真正的可串行化。參閱 Chapter 12 ``Concurrency Control'' 獲取細節(jié)。


 在 SQL 標準里還有另外一種事務特性可以用這些命令設置:診斷范圍的大小。這個概念只用于嵌入的 SQL。

#p#

NAME

SET TRANSACTION - set the characteristics of the current transaction

SYNOPSIS

SET TRANSACTION
    [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]
SET SESSION CHARACTERISTICS AS TRANSACTION
    [ ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE } ] [ READ WRITE | READ ONLY ]

DESCRIPTION

The SET TRANSACTION command sets the transaction characteristics of the current transaction. It has no effect on any subsequent transactions. SET SESSION CHARACTERISTICS sets the default transaction characteristics for each transaction of a session. SET TRANSACTION can override it for an individual transaction.

The available transaction characteristics are the transaction isolation level and the transaction access mode (read/write or read-only).

The isolation level of a transaction determines what data the transaction can see when other transactions are running concurrently.

READ COMMITTED
A statement can only see rows committed before it began. This is the default.
SERIALIZABLE
The current transaction can only see rows committed before first query or data-modification statement was executed in this transaction.
Tip: Intuitively, serializable means that two concurrent transactions will leave the database in the same state as if the two has been executed strictly after one another in either order.

The transaction isolation level cannot be set after the first query or data-modification statement (SELECT, INSERT, DELETE, UPDATE, FETCH, COPY) of a transaction has been executed. See the chapter called ``Concurrency Control'' in the documentation for more information about transaction isolation and concurrency control.

The transaction access mode determines whether the transaction is read/write or read-only. Read/write is the default. When a transaction is read-only, the following SQL commands are disallowed: INSERT, UPDATE, DELETE, and COPY TO if the table they would write to is not a temporary table; all CREATE, ALTER, and DROP commands; COMMENT, GRANT, REVOKE, TRUNCATE; and EXPLAIN ANALYZE and EXECUTE if the command they would execute is among those listed. This is a high-level notion of read-only that does not prevent writes to disk.  

NOTES

The session default transaction isolation level can also be set with the command

SET default_transaction_isolation = 'value'

and in the configuration file. Consult the section called ``Run-time Configuration'' in the documentation for more information.  

COMPATIBILITY

Both commands are defined in the SQL standard. SERIALIZABLE is the default transaction isolation level in the standard; in PostgreSQL the default is ordinarily READ COMMITTED, but you can change it as described above. PostgreSQL does not provide the isolation levels READ UNCOMMITTED and REPEATABLE READ. Because of multiversion concurrency control, the SERIALIZABLE level is not truly serializable. See the chapter called ``Concurrency Control'' in the documentation for details.

In the SQL standard, there is one other transaction characteristic that can be set with these commands: the size of the diagnostics area. This concept is only for use in embedded SQL.

責任編輯:韓亞珊 來源: CMPP.net
相關推薦

2011-08-24 18:19:13

START TRANS中文man

2011-08-24 17:50:19

SET中文man

2011-08-24 17:53:08

SET CONSTRA中文man

2011-08-24 17:58:08

SET SESSION中文man

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-15 15:02:31

usleep中文man

2011-09-23 13:59:40

find中文man

2011-08-12 09:17:57

deallocvt中文man

2011-08-25 17:24:54

puts中文man

2011-07-15 16:58:36

ac中文man

2011-08-11 18:32:21

cp中文man

2011-08-23 11:34:26

ipcs中文man

2011-08-25 10:16:02

lmhosts中文man

2011-08-24 15:29:06

grant中文man

2011-08-25 17:32:40

setbuffer中文man

2011-08-25 16:50:08

getc中文man

2011-08-25 16:52:54

getchar中文man
點贊
收藏

51CTO技術棧公眾號