

 Amazon Redshift は、パッチ 198 以降、新しい Python UDF の作成をサポートしなくなります。既存の 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/ja_jp/redshift/latest/dg/r_SVV_DISKUSAGE.html)

## サンプルクエリ
<a name="r_SVV_DISKUSAGE-sample-queries"></a>

SVV\$1DISKUSAGE には割り当て済みディスクブロックにつき 1 つの行が含まれるため、すべての行を選択するクエリを実行すると非常に多数の行が返される可能性があります。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 に対応する最後の 3 行は、非表示のメタデータ列用です。) 

```
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)
```