

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

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

# SVV\$1DISKUSAGE
<a name="r_SVV_DISKUSAGE"></a>

Amazon Redshift 透過繫結 STV\$1TBL\$1PERM 和 STV\$1BLOCKLIST 資料表來建立 SVV\$1DISKUSAGE 系統畫面。SVV\$1DISKUSAGE 檢視包含資料庫中該資料表之資料分配的相關資訊。

使用彙總查詢與 SVV\$1DISKUSAGE (如下範例所示) 以判斷每個資料庫、資料表、分割或欄位所配置的磁碟區塊數。每個資料區塊都使用 1 MB。您也可以使用 [STV\$1PARTITIONS](r_STV_PARTITIONS.md) 來檢視磁碟使用率的摘要資訊。

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

**注意**  
只有在查詢已佈建的叢集時，才能使用此檢視。

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

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

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

SVV\$1DISKUSAGE 在每個配置的磁碟區塊上包含一個資料列，因此選取所有資料列的查詢可能會傳回數量非常大的資料列。建議僅適用彙總查詢搭配 SVV\$1DISKUSAGE。

傳回於 USERS 資料表中欄位 6 (EMAIL 欄位) 配置的區塊數上限：

```
select db_id, trim(name) as tablename, max(blocknum)
from svv_diskusage
where name='users' and col=6
group by db_id, name;

db_id  | tablename | max
--------+-----------+-----
175857 | users     |   2
(1 row)
```

下列查詢會為名為 SALESNEW 的大型 10 個欄位的資料表中所有欄位傳回類似結果。(欄位 10 到 12 的最後三列會供隱藏的中繼資料欄位使用。) 

```
select db_id, trim(name) as tablename, col, tbl, max(blocknum)
from svv_diskusage
where name='salesnew'
group by db_id, name, col, tbl
order by db_id, name, col, tbl;

db_id  | tablename  | col |  tbl   | max
--------+------------+-----+--------+-----
175857 | salesnew   |   0 | 187605 | 154
175857 | salesnew   |   1 | 187605 | 154
175857 | salesnew   |   2 | 187605 | 154
175857 | salesnew   |   3 | 187605 | 154
175857 | salesnew   |   4 | 187605 | 154
175857 | salesnew   |   5 | 187605 |  79
175857 | salesnew   |   6 | 187605 |  79
175857 | salesnew   |   7 | 187605 | 302
175857 | salesnew   |   8 | 187605 | 302
175857 | salesnew   |   9 | 187605 | 302
175857 | salesnew   |  10 | 187605 |   3
175857 | salesnew   |  11 | 187605 |   2
175857 | salesnew   |  12 | 187605 | 296
(13 rows)
```