

 从补丁 198 开始，Amazon Redshift 将不再支持创建新的 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\$1QUERY\$1EXPLAIN
<a name="SYS_QUERY_EXPLAIN"></a>

显示已提交供执行的查询的 EXPLAIN 计划。

SYS\$1QUERY\$1EXPLAIN 对所有用户均可见。超级用户可以查看所有行；普通用户只能查看其自己的数据。有关更多信息，请参阅 [系统表和视图中的数据可见性](cm_chap_system-tables.md#c_visibility-of-data)。

## 表列
<a name="SYS_QUERY_EXPLAIN-table-columns"></a>

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

## 示例查询
<a name="SYS_QUERY_EXPLAIN-sample-queries"></a>

以下示例是单个查询的 EXPLAIN 计划。

```
SELECT * FROM sys_query_explain WHERE query_id = 612635 ORDER BY plan_node_id;

 userid | query_id | child_query_sequence | plan_node_id | plan_parent_id |                                                                                                                                                                                                    plan_node                                                                                                                                                                                                     |                                                                                                                                                                                                    plan_info                                                                                                                                                                                                     
--------+----------+----------------------+--------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    100 |   612635 |                    1 |            1 |              0 | XN Limit  (cost=3604047533041.00..3604047533041.25 rows=100 width=20)                                                                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                                                                                                                                                                                 
    100 |   612635 |                    1 |            2 |              1 |   ->  XN Merge  (cost=3604047533041.00..3604047533148.02 rows=42809 width=20)                                                                                                                                                                                                                                                                                                                                    | Merge Key: sum(b.totalprice)                                                                                                                                                                                                                                                                                                                                                                                    
    100 |   612635 |                    1 |            3 |              2 |         ->  XN Network  (cost=3604047533041.00..3604047533148.02 rows=42809 width=20)                                                                                                                                                                                                                                                                                                                            |   Send to leader                                                                                                                                                                                                                                                                                                                                                                                                
    100 |   612635 |                    1 |            4 |              3 |               ->  XN Sort  (cost=3604047533041.00..3604047533148.02 rows=42809 width=20)                                                                                                                                                                                                                                                                                                                         | Sort Key: sum(b.totalprice)                                                                                                                                                                                                                                                                                                                                                                                     
    100 |   612635 |                    1 |            5 |              4 |                     ->  XN HashAggregate  (cost=2604047529640.76..2604047529747.78 rows=42809 width=20)                                                                                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                                                                                                 
    100 |   612635 |                    1 |            6 |              5 |                           ->  XN Hash Join DS_DIST_NONE  (cost=15104956.16..2602364653507.34 rows=336575226684 width=20)                                                                                                                                                                                                                                                                                         | Hash Cond: (("outer".listid = "inner".listid) AND ("outer".sellerid = "inner".sellerid))                                                                                                                                                                                                                                                                                                                        
    100 |   612635 |                    1 |            7 |              6 |                                 ->  XN Seq Scan on listing b  (cost=0.00..7884677.12 rows=788467712 width=24)                                                                                                                                                                                                                                                                                                    |                                                                                                                                                                                                                                                                                                                                                                                                                 
    100 |   612635 |                    1 |            8 |              6 |                                 ->  XN Hash  (cost=7063797.76..7063797.76 rows=706379776 width=8)                                                                                                                                                                                                                                                                                                                |                                                                                                                                                                                                                                                                                                                                                                                                                 
    100 |   612635 |                    1 |            9 |              8 |                                       ->  XN Seq Scan on sales a  (cost=0.00..7063797.76 rows=706379776 width=8)                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                                                                                                                                                                                 
(9 rows)
```