選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

SVCS_PLAN_INFO

焦點模式
SVCS_PLAN_INFO - Amazon Redshift

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 SVCS_PLAN_INFO 資料表,以一組資料列查看查詢的 EXPLAIN 輸出。這是查看查詢計劃的其他方法。

注意

字首為 SVCS 的系統檢視可提供查詢的詳細資訊,包括主要叢集與並行擴展叢集上的查詢。這些檢視類似字首為 STL 的資料表,差別在於 STL 資料表僅提供執行於主要叢集之查詢的資訊。

所有使用者都可看見 SVCS_PLAN_INFO。超級使用者可以看見所有資料列;一般使用者只能看見自己的資料。如需詳細資訊,請參閱系統資料表和檢視中資料的可見性

資料表欄

欄名稱 資料類型 描述
userid integer 產生項目的使用者之 ID。
query integer 查詢 ID。查詢欄可用於加入其他系統表格與檢視。
nodeid integer 計劃節點識別碼,其中節點會在查詢執行時映射至一個或多個步驟。
segment integer 識別查詢區段的號碼。
step integer 識別查詢步驟的號碼。
locus integer 執行步驟的位置。若在運算節點上則為 0,若在領導者節點上則為 1。
plannode integer 計劃節點的列舉值。請查看下表以取得 plannode 的列舉值。(SVCS_EXPLAIN 中的 PLANNODE 資料欄包含計劃節點文字。)
startupcost double precision 傳回此步驟之第一列的預估相對成本。
totalcost double precision 執行步驟的預估相對成本。
rows bigint 步驟將產生之資料列的預估數目。
位元組 bigint 步驟將產生之位元組的預估數目。

範例查詢

下列範例會比較藉由使用 EXPLAIN 命令,以及藉由查詢 SVCS_PLAN_INFO 所傳回之簡單 SELECT 查詢的查詢計劃。

explain select * from category; QUERY PLAN ------------------------------------------------------------- XN Seq Scan on category (cost=0.00..0.11 rows=11 width=49) (1 row) select * from category; catid | catgroup | catname | catdesc -------+----------+-----------+-------------------------------------------- 1 | Sports | MLB | Major League Baseball 3 | Sports | NFL | National Football League 5 | Sports | MLS | Major League Soccer ... select * from svcs_plan_info where query=256; query | nodeid | segment | step | locus | plannode | startupcost | totalcost | rows | bytes -------+--------+---------+------+-------+----------+-------------+-----------+------+------- 256 | 1 | 0 | 1 | 0 | 104 | 0 | 0.11 | 11 | 539 256 | 1 | 0 | 0 | 0 | 104 | 0 | 0.11 | 11 | 539 (2 rows)

在此範例中,PLANNODE 104 指的是 CATEGORY 資料表的循序掃描。

select distinct eventname from event order by 1; eventname ------------------------------------------------------------------------ .38 Special 3 Doors Down 70s Soul Jam A Bronx Tale ... explain select distinct eventname from event order by 1; QUERY PLAN ------------------------------------------------------------------------------------- XN Merge (cost=1000000000136.38..1000000000137.82 rows=576 width=17) Merge Key: eventname -> XN Network (cost=1000000000136.38..1000000000137.82 rows=576 width=17) Send to leader -> XN Sort (cost=1000000000136.38..1000000000137.82 rows=576 width=17) Sort Key: eventname -> XN Unique (cost=0.00..109.98 rows=576 width=17) -> XN Seq Scan on event (cost=0.00..87.98 rows=8798 width=17) (8 rows) select * from svcs_plan_info where query=240 order by nodeid desc; query | nodeid | segment | step | locus | plannode | startupcost | totalcost | rows | bytes -------+--------+---------+------+-------+----------+------------------+------------------+------+-------- 240 | 5 | 0 | 0 | 0 | 104 | 0 | 87.98 | 8798 | 149566 240 | 5 | 0 | 1 | 0 | 104 | 0 | 87.98 | 8798 | 149566 240 | 4 | 0 | 2 | 0 | 117 | 0 | 109.975 | 576 | 9792 240 | 4 | 0 | 3 | 0 | 117 | 0 | 109.975 | 576 | 9792 240 | 4 | 1 | 0 | 0 | 117 | 0 | 109.975 | 576 | 9792 240 | 4 | 1 | 1 | 0 | 117 | 0 | 109.975 | 576 | 9792 240 | 3 | 1 | 2 | 0 | 114 | 1000000000136.38 | 1000000000137.82 | 576 | 9792 240 | 3 | 2 | 0 | 0 | 114 | 1000000000136.38 | 1000000000137.82 | 576 | 9792 240 | 2 | 2 | 1 | 0 | 123 | 1000000000136.38 | 1000000000137.82 | 576 | 9792 240 | 1 | 3 | 0 | 0 | 122 | 1000000000136.38 | 1000000000137.82 | 576 | 9792 (10 rows)

下一個主題:

SVCS_QUERY_SUMMARY

上一個主題:

SVCS_EXPLAIN

在本頁面

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。