

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# SYS\_TRANSACTION\_HISTORY
<a name="SYS_TRANSACTION_HISTORY"></a>

追蹤查詢時，請使用 SYS\_TRANSACTION\_HISTORY 來查看交易的詳細資訊。

只有超級使用者才能看到 SYS\_TRANSACTION\_HISTORY。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="SYS_TRANSACTION_HISTORY-table-columns"></a>


| 欄名稱  | 資料類型  | Description  | 
| --- | --- | --- | 
| user\_id | integer | 產生項目的使用者之 ID。 | 
| transaction\_id | bigint | 交易的 ID。 | 
| isolation\_level | text | 交易的隔離層級。可能值為 Serializable 和 Snapshot Isolation。 | 
| status | text | 交易的狀態。可能的狀態為 committed 和 rolledback。 | 
| transaction\_start\_time | timestamp | 交易的開始時間。 | 
| commit\_start\_time | timestamp | 遞交的開始時間。 | 
| commit\_end\_time | timestamp | 提交的結束時間。 | 
| blocks\_committed | bigint | 必須寫入為此遞交一部分的區塊數目。 | 
| undo\_transaction\_id | bigint | 復原交易的 ID (如果有任何交易已復原)。否則，此值為 -1。 | 

## 範例查詢
<a name="SYS_TRANSACTION_HISTORY-sample-queries"></a>

```
select * from sys_transaction_history order by transaction_start_time desc;
                
 user_id | transaction_id | isolation_level |   status   |   transaction_start_time   |     commit_start_time      |      commit_end_time       | blocks_committed | undo_transaction_id 
---------+----------------+-----------------+------------+----------------------------+----------------------------+----------------------------+------------------+---------------------     
     100 |           1310 | Serializable    | committed  | 2023-08-27 21:03:11.822205 | 2023-08-28 21:03:11.825287 | 2023-08-28 21:03:11.854883 |               17 |                  -1
     101 |           1345 | Serializable    | committed  | 2023-08-27 21:03:12.000278 | 2023-08-28 21:03:12.003736 | 2023-08-28 21:03:12.030061 |               17 |                  -1
     102 |           1367 | Serializable    | committed  | 2023-08-27 21:03:12.1532   | 2023-08-28 21:03:12.156124 | 2023-08-28 21:03:12.186468 |               17 |                  -1
     100 |           1370 | Serializable    | committed  | 2023-08-27 21:03:12.199316 | 2023-08-28 21:03:12.204854 | 2023-08-28 21:03:12.238186 |               24 |                  -1
     100 |           1408 | Serializable    | committed  | 2023-08-27 21:03:53.891107 | 2023-08-28 21:03:53.894825 | 2023-08-28 21:03:53.927465 |               17 |                  -1
     100 |           1409 | Serializable    | rolledback | 2023-08-27 21:03:53.936431 | 2000-01-01 00:00:00        | 2023-08-28 21:04:08.712532 |                0 |                1409
     101 |           1415 | Serializable    | committed  | 2023-08-27 21:04:24.283188 | 2023-08-28 21:04:24.289196 | 2023-08-28 21:04:24.374318 |               25 |                  -1
     101 |           1416 | Serializable    | committed  | 2023-08-27 21:04:24.38818  | 2023-08-28 21:04:24.391688 | 2023-08-28 21:04:24.415135 |               17 |                  -1
     100 |           1417 | Serializable    | rolledback | 2023-08-27 21:04:24.424252 | 2000-01-01 00:00:00        | 2023-08-28 21:04:28.354826 |                0 |                1417
     101 |           1418 | Serializable    | rolledback | 2023-08-27 21:04:24.425195 | 2000-01-01 00:00:00        | 2023-08-28 21:04:28.680355 |                0 |                1418
     100 |           1420 | Serializable    | committed  | 2023-08-27 21:04:28.697607 | 2023-08-28 21:04:28.702374 | 2023-08-28 21:04:28.735541 |               23 |                  -1
     101 |           1421 | Serializable    | committed  | 2023-08-27 21:04:28.744854 | 2023-08-28 21:04:28.749344 | 2023-08-28 21:04:28.779029 |               23 |                  -1
     101 |           1423 | Serializable    | committed  | 2023-08-27 21:04:28.78942  | 2023-08-28 21:04:28.791556 | 2023-08-28 21:04:28.817485 |               16 |                  -1
     100 |           1430 | Serializable    | committed  | 2023-08-27 21:04:28.917788 | 2023-08-28 21:04:28.919993 | 2023-08-28 21:04:28.944812 |               16 |                  -1
     102 |           1494 | Serializable    | committed  | 2023-08-27 21:04:37.029058 | 2023-08-28 21:04:37.033137 | 2023-08-28 21:04:37.062001 |               16 |                  -1
```