

 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/)。

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

# STL\$1VACUUM
<a name="r_STL_VACUUM"></a>

顯示已清空之資料表的資料列和區塊統計資訊。

此檢視顯示每個清空操作啟動和完成時特有的資訊，並示範執行此操作的優點。如需執行此命令之需求的相關資訊，請參閱 [VACUUM](r_VACUUM_command.md) 命令說明。

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

此資料表中的部份或所有資料也會在 SYS 監控檢視 [SYS\$1VACUUM\$1HISTORY](SYS_VACUUM_HISTORY.md) 中找到。SYS 監視檢視中的資料會格式化為更易於使用和理解。我們建議您使用 SYS 監控檢視進行查詢。

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

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/r_STL_VACUUM.html)

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

下列查詢報告資料表 108313 的清空統計資訊。在一系列插入和刪除之後已清空此資料表。

```
select xid, table_id, status, rows, sortedrows, blocks, eventtime,
                reclaimable_rows, reclaimable_space_mb
from stl_vacuum where table_id=108313 order by eventtime;

 xid   | table_id | status                  | rows | sortedrows | blocks |  eventtime           | reclaimable_rows | reclaimable_space_mb 
-------+----------+-------------------------+------+------------+--------+----------------------+------------------+----------------------
 14294 |   108313 | Started                 | 1950 |        408 |     28 |  2016-05-19 17:36:01 |              984 |                   17          
 14294 |   108313 | Finished                |  966 |        966 |     11 |  2016-05-19 18:26:13 |                0 |                    0 
 15126 |   108313 | Skipped(sorted>=95%)    |  966 |        966 |     11 |  2016-05-19 18:26:38 |                0 |                    0
```

在 VACUUM 開始時，資料表包含 1,950 列，儲存在 28 個 1 MB 區塊中。Amazon Redshift 估計，透過清空操作可以回收 984 個磁碟空間，即 17 個磁碟空間區塊。

在「已完成」狀態的列中，ROWS 欄顯示的值為 966，而 BLOCKS 欄的值從 28 下降為 11。清空回收了估計的磁碟空間量，清空操作完成後沒有剩餘可回收的列或空間。

在排序階段 (交易 15126) 中，清空能夠略過資料表，因為已依排序索引鍵順序插入資料列。

下列範例會在大型 INSERT 操作之後顯示 SALES 資料表 (此範例中的資料表 110116) 上 SORT ONLY 清空的統計資訊：

```
vacuum sort only sales;

select xid, table_id, status, rows, sortedrows, blocks, eventtime
from stl_vacuum order by xid, table_id, eventtime;

xid |table_id|     status      | rows  |sortedrows|blocks|     eventtime
----+--------+-----------------+-------+----------+------+--------------------
...
2925| 110116 |Started Sort Only|1379648|   172456 |  132 | 2011-02-24 16:25:21...
2925| 110116 |Finished         |1379648|  1379648 |  132 | 2011-02-24 16:26:28...
```