

 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\_RESTORE\_STATE
<a name="SYS_RESTORE_STATE"></a>

Use SYS\_RESTORE\_STATE to monitor the migration progress of each table during a classic resize. This is specifically applicable when the target node type is RG or RA3. For more information about classic resize to RG or RA3 nodes, see [Classic resize](https://docs.amazonaws.cn/redshift/latest/mgmt/managing-cluster-operations.html#classic-resize-faster).

SYS\_RESTORE\_STATE is visible only to superusers. 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_RESTORE_STATE-table-columns"></a>


| Column name  | Data type  | Description  | 
| --- | --- | --- | 
| user\_id | integer | The identifier of the user who submitted the query. | 
| database\_name | char(64) | The name of the database of the table. | 
| schema\_id | integer | The schema ID of the table. | 
| table\_id | integer | The ID of the table. | 
| table\_name | char(128) | The name of the table. | 
| redistribution\_status | char(128) | The status of redistribution progress of the table. Possible values are Completed, In progress, and Pending. | 
| percentage\_redistributed | float | The percentage of the redistribution progress of the table. Possible values are from 0 to 100%. For example, a value of 25 indicates that 25% of the data is redistributed. | 
| redistribution\_type | char(32) | The redistribution type for the table. Either KEY conversion or an EVEN rebalancing task. For more information about distribution styles, see [Distribution styles](https://docs.amazonaws.cn/redshift/latest/dg/c_choosing_dist_sort.html). | 

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

The following query returns records for running and queued queries.

```
SELECT * FROM sys_restore_state;
```

Sample output.

```
 userid | database_name | schema_id | table_id |   table_name   | redistribution_status | precentage_redistributed |   redistribution_type
--------+---------------+-----------+----------+----------------+-----------------------+--------------------------+-------------------------
    1   |     test1     |   124865  |  124878  | customer_key_4 |         Pending       |      0                   |  Rebalance Disteven Table
    1   |      dev      |   124865  |  124874  | customer_key_3 |         Pending       |      0                   |  Rebalance Disteven Table
    1   |      dev      |   124865  |  124870  | customer_key_2 |        Completed      |     100                  |  Rebalance Disteven Table
    1   |      dev      |   124865  |  124866  | customer_key_1 |       In progress     |     13.52                |  Restore Distkey Table
```

The following gives you the data-processing status.

```
SELECT
    redistribution_status, ROUND(SUM(block_count) / 1024.0, 2) AS total_size_gb
FROM sys_restore_state sys inner join stv_tbl_perm stv
    on sys.table_id = stv.id
GROUP BY sys.redistribution_status;
```

Sample output.

```
 redistribution_status | total_size_gb 
-----------------------+---------------
 Completed             |          0.07
 Pending               |          0.71
 In progress           |          0.20
(3 rows)
```