

 Amazon Redshift will no longer support the creation of new Python UDFs starting Patch 198. Existing Python UDFs will continue to function until June 30, 2026. For more information, see the [ blog post ](https://amazonaws-china.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/). 

# SYS\$1MV\$1REFRESH\$1HISTORY
<a name="SYS_MV_REFRESH_HISTORY"></a>

The results include information about the refresh history of all materialized views. The results include the refresh type, such as manual or auto, and the status of the most recent refresh. 

SYS\$1MV\$1REFRESH\$1HISTORY is visible to all users. Superusers can see all rows; regular users can see only their own data. For more information, see [Visibility of data in system tables and views](cm_chap_system-tables.md#c_visibility-of-data).

## Table columns
<a name="SYS_MV_REFRESH_HISTORY-table-columns"></a>

[\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/en_us/redshift/latest/dg/SYS_MV_REFRESH_HISTORY.html)

## Sample queries
<a name="SYS_MV_REFRESH_HISTORY-sample-queries"></a>

The following query shows the refresh history for materialized views.

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

The query returns the following sample output:

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