

 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/)を参照してください。

# SYS\_MV\_REFRESH\_HISTORY
<a name="SYS_MV_REFRESH_HISTORY"></a>

結果には、すべてのマテリアライズドビューの更新履歴に関する情報が含まれます。結果には、手動や自動などの更新タイプ、および最新の更新のステータスが含まれます。

SYS\_MV\_REFRESH\_HISTORY はすべてのユーザーに表示されます。スーパーユーザーはすべての行を表示できますが、通常のユーザーは自分のデータのみを表示できます。詳細については、「[システムテーブルとビューのデータの可視性](cm_chap_system-tables.md#c_visibility-of-data)」を参照してください。

## テーブルの列
<a name="SYS_MV_REFRESH_HISTORY-table-columns"></a>


| 列名  | データ型  | 説明  | 
| --- | --- | --- | 
| user\_id | integer | 更新を送信したユーザーの識別子。 | 
| session\_id | integer | マテリアライズドビューの更新を実行するプロセスのプロセス識別子。 | 
| transaction\_id | bigint | トランザクション識別子。 | 
| database\_name | char(128) | マテリアライズドビューを含むデータベース。 | 
| schema\_name | char(128) | マテリアライズドビューのスキーマ。 | 
| mv\_id | bigint | マテリアライズドビューのオブジェクト ID。 | 
| mv\_name | char(128) | マテリアライズドビューの名前。 | 
| refresh\_type | char(32) | 更新のタイプ (手動または自動など)。 | 
| ステータス | text | 更新のステータス。ステータスの詳細については、[SVL\_MV\_REFRESH\_STATUS](r_SVL_MV_REFRESH_STATUS.md) のステータス列を参照してください。 | 
| start\_time | timestamp | 更新の開始時間。 | 
| end\_time | timestamp | 更新の終了時間。 | 
| duration | bigint | マテリアライズドビューの更新にかかった時間 (マイクロ秒単位)。 | 
| consumer\_account | char(12) | 更新を開始したコンシューマークラスターの AWS アカウント ID。このフィールドは、データ共有設定でコンシューマークラスターから更新が開始されるときに入力されます。 | 
| consumer\_region | char(32) | 更新を開始したコンシューマークラスターの AWS リージョン。このフィールドは、データ共有設定でコンシューマークラスターから更新が開始されるときに入力されます。 | 
| consumer\_namespace | char(36) | 更新を開始したコンシューマークラスターの名前空間の識別子。このフィールドは、データ共有設定でコンシューマークラスターから更新が開始されるときに入力されます。 | 

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

次のクエリは、マテリアライズドビューの更新履歴を表示します。

```
SELECT user_id, 
     session_id, 
     transaction_id, 
     database_name, 
     schema_name, 
     mv_id, 
     mv_name,
     refresh_type,
     status,
     start_time,
     end_time,
     duration,
     consumer_account,
     consumer_region,
     consumer_namespace
     from sys_mv_refresh_history;
```

このクエリは、次のサンプル出力を返します。

```
 user_id | session_id | transaction_id | database_name | schema_name                | mv_id  |  mv_name           |  refresh_type  |  status                                                                                              |  start_time                |  end_time                  |  duration | consumer_account | consumer_region | consumer_namespace
---------+------------+----------------+---------------+----------------------------+--------+--------------------+----------------+------------------------------------------------------------------------------------------------------+----------------------------+----------------------------+-----------+------------------+-----------------+------------------------------------
       1 | 1073815659 |          15066 | dev           | test_stl_mv_refresh_schema | 203762 | mv_incremental     | Manual         | MV was already updated                                                                               | 2023-10-26 15:59:20.952179 | 2023-10-26 15:59:20.952866 |      687 |                  |                 |
       1 | 1073815659 |          15068 | dev           | test_stl_mv_refresh_schema | 203771 | mv_nonincremental  | Manual         | MV was already updated                                                                               | 2023-10-26 15:59:21.008049 | 2023-10-26 15:59:21.008658 |      609 |                  |                 |
       1 | 1073815659 |          15070 | ext_db        | producer_schema            | 203779 | producer_mv        | Manual         | Refresh successfully updated MV incrementally                                                        | 2023-10-26 15:59:21.064252 | 2023-10-26 15:59:21.064885 |      633 | 0123456789       | us-east-1       | 623d8ff2-4391-4381-83d7-177caa6767af
       1 | 1073815659 |          15074 | dev           | test_stl_mv_refresh_schema | 203762 | mv_incremental     | Manual         | Refresh successfully updated MV incrementally                                                        | 2023-10-26 15:59:29.693329 | 2023-10-26 15:59:43.482842 | 13789513 |                  |                 |
       1 | 1073815659 |          15076 | dev           | test_stl_mv_refresh_schema | 203771 | mv_nonincremental  | Manual         | Refresh successfully recomputed MV from scratch                                                      | 2023-10-26 15:59:43.550184 | 2023-10-26 15:59:47.880833 |  4330649 |                  |                 |
       1 | 1073815659 |          15078 | dev           | test_stl_mv_refresh_schema | 203779 | mv_refresh_error   | Manual         | Refresh failed due to an internal error                                                              | 2023-10-26 15:59:47.949052 | 2023-10-26 15:59:52.494681 |  4545629 |                  |                 |
       1 | 1073815659 |          15071 | dev           | test_stl_mv_refresh_schema | 203778 | mv_test            | Manual         | Cascade refresh failed because materialized view test_stl_mv_refresh_schema.child was not refreshed. | 2023-10-26 15:30:21.432252 | 2023-10-26 15:30:21.432252 |      532 |                  |                 |
       1 | 1073815659 |          15071 | dev           | test_stl_mv_refresh_schema | 203761 | child              | Manual         | Refresh failed due to an internal error.                                                             | 2023-10-26 15:30:21.432252 | 2023-10-26 15:30:21.432252 |      532 |                  |                 |
       1 | 1073815659 |          15069 | dev           | test_stl_mv_refresh_schema | 203778 | mv_test            | Manual         | Cascade refresh skipped because materialized view test_stl_mv_refresh_schema.child was not refreshed.| 2023-10-26 15:21:43.550369 | 2023-10-26 15:21:43.550369 |      633
       1 | 1073815659 |          15069 | dev           | test_stl_mv_refresh_schema | 203761 | child              | Manual         | Refresh failed due to an internal error.                                                             | 2023-10-26 15:21:43.550369 | 2023-10-26 15:21:43.550369 |      633
(10 rows)
```