

 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\_AUTO\_TABLE\_OPTIMIZATION
<a name="r_SYS_AUTO_TABLE_OPTIMIZATION"></a>

記錄 Amazon Redshift 對自動最佳化而定義的資料表執行的自動操作。

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

## 資料表欄
<a name="r_SYS_AUTO_TABLE_OPTIMIZATION-table-rows"></a>


| 欄名稱  | 資料類型  | Description  | 
| --- | --- | --- | 
| transaction\_id  | long | 交易識別碼。 | 
| session\_id  | int  | 執行更改命令之程序的工作階段識別碼。 | 
| table\_id  | int  | 資料表識別碼。 | 
| alter\_table\_type | character(32)  | 建議的類型。可能值為 distkey、sortkey 及 encode。 | 
| status  | character(128)  | 建議的完成狀態。可能值為 Start、Complete、Skipped、Abort、Checkpoint 以及 Failed。 | 
| event\_time  | timestamp  | 狀態欄的時間戳記。 | 
| alter\_from  | character(200)  | 套用建議之前，資料表的先前分散樣式和排序索引鍵。該值會被截斷為 200 個字元的增量。 | 

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

在下列範例中，結果中的列顯示 Amazon Redshift 所採取的動作。

```
SELECT table_id, alter_table_type, status, event_time, alter_from
FROM SYS_AUTO_TABLE_OPTIMIZATION;
                
 table_id |  alter_table_type   |                        status                        |         event_time          |  alter_from
----------+---------------------+------------------------------------------------------+-----------------------------+-----------------
   118082 | sortkey             | Start                                                | 2020-08-22 19:42:20.727049  | 
   118078 | sortkey             | Start                                                | 2020-08-22 19:43:54.728819  | 
   118082 | sortkey             | Start                                                | 2020-08-22 19:42:52.690264  | 
   118072 | sortkey             | Start                                                | 2020-08-22 19:44:14.793572  | 
   118082 | sortkey             | Failed                                               | 2020-08-22 19:42:20.728917  | 
   118078 | sortkey             | Complete                                             | 2020-08-22 19:43:54.792705  |  SORTKEY: None;
   118086 | sortkey             | Complete                                             | 2020-08-22 19:42:00.72635   |  SORTKEY: None;
   118082 | sortkey             | Complete                                             | 2020-08-22 19:43:34.728144  |  SORTKEY: None;
   118072 | sortkey             | Skipped:Retry exceeds the maximum limit for a table. | 2020-08-22 19:44:46.706155  | 
   118086 | sortkey             | Start                                                | 2020-08-22 19:42:00.685255  | 
   118082 | sortkey             | Start                                                | 2020-08-22 19:43:34.69531   | 
   118072 | sortkey             | Start                                                | 2020-08-22 19:44:46.703331  | 
   118082 | sortkey             | Checkpoint: progress 14.755079%                      | 2020-08-22 19:42:52.692828  | 
   118072 | sortkey             | Failed                                               | 2020-08-22 19:44:14.796071  |   
   116723 | sortkey             | Abort:This table is not AUTO.                        | 2020-10-28 05:12:58.479233  | 
   110203 | distkey             | Abort:This table is not AUTO.                        | 2020-10-28 05:45:54.67259   |
```