

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 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/)。

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

# 主要和並行擴展叢集的 SVCS 檢視
<a name="svcs_views"></a>

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

**Topics**
+ [SVCS\$1ALERT\$1EVENT\$1LOG](r_SVCS_ALERT_EVENT_LOG.md)
+ [SVCS\$1COMPILE](r_SVCS_COMPILE.md)
+ [SVCS\$1CONCURRENCY\$1SCALING\$1USAGE](r_SVCS_CONCURRENCY_SCALING_USAGE.md)
+ [SVCS\$1EXPLAIN](r_SVCS_EXPLAIN.md)
+ [SVCS\$1PLAN\$1INFO](r_SVCS_PLAN_INFO.md)
+ [SVCS\$1QUERY\$1SUMMARY](r_SVCS_QUERY_SUMMARY.md)
+ [SVCS\$1S3LIST](r_SVCS_S3LIST.md)
+ [SVCS\$1S3LOG](r_SVCS_S3LOG.md)
+ [SVCS\$1S3PARTITION\$1SUMMARY](r_SVCS_S3PARTITION_SUMMARY.md)
+ [SVCS\$1S3QUERY\$1SUMMARY](r_SVCS_S3QUERY_SUMMARY.md)
+ [SVCS\$1STREAM\$1SEGS](r_SVCS_STREAM_SEGS.md)
+ [SVCS\$1UNLOAD\$1LOG](r_SVCS_UNLOAD_LOG.md)

# SVCS\$1ALERT\$1EVENT\$1LOG
<a name="r_SVCS_ALERT_EVENT_LOG"></a>

當查詢最佳化器識別可能表示效能問題的狀況時，請記錄一個提醒。此檢視衍生自 STL\$1ALERT\$1EVENT\$1LOG 系統資料表，但不會顯示執行於並行擴展叢集之查詢的分割層級。使用 SVCS\$1ALERT\$1EVENT\$1LOG 資料表來識別提升查詢效能的機會。

查詢包含多個區段，每個區段包含一或多個步驟。如需詳細資訊，請參閱[查詢處理](c-query-processing.md)。

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

所有使用者都可看見 SVCS\$1ALERT\$1EVENT\$1LOG。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="r_SVCS_ALERT_EVENT_LOG-table-columns"></a>

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

## 使用須知
<a name="r_SVCS_ALERT_EVENT_LOG-usage-notes"></a>

您可以使用 SVCS\$1ALERT\$1EVENT\$1LOG，識別查詢中的潛在問題，然後遵循[調校查詢效能](c-optimizing-query-performance.md)中的實務，來最佳化資料庫設計並重新撰寫查詢。SVCS\$1ALERT\$1EVENT\$1LOG 會記錄下列提醒：
+ **找不到統計資訊** 

  找不到統計資訊。在進行資料載入或重要更新之後執行 ANALYZE，並使用 STATUPDATE 與 COPY 操作搭配。如需詳細資訊，請參閱[設計查詢的 Amazon Redshift 最佳實務](c_designing-queries-best-practices.md)。
+ **巢狀迴圈**

  巢狀迴路通常是 Cartesian 產品。評估您的查詢，以確保所有參與資料表均已有效聯結。
+ **選擇性相當高的篩選條件**

  傳回的資料列與已掃描資料列的比率低於 0.05。已掃描資料列是 `rows_pre_user_filter `的值，而傳回的資料列則是 [STL\$1SCAN](r_STL_SCAN.md) 系統資料表中的資料列值。表示查詢正在掃描例外狀況大量的資料列來決定結果集。這可能是由於找不到排序索引鍵或其不正確所致。如需詳細資訊，請參閱[排序索引鍵](t_Sorting_data.md)。
+ **過多的幽靈資料列**

  掃描已略過相當多標示為已刪除但未清空的資料列，或已插入但未遞交的資料列。如需詳細資訊，請參閱[清空資料表](t_Reclaiming_storage_space202.md)。
+ **大型分佈**

  已重新配送超過 1,000,000 個資料列，進行雜湊聯結或彙整。如需詳細資訊，請參閱[分配資料以實現查詢最佳化](t_Distributing_data.md)。
+ **大型廣播**

  已播送超過 1,000,000 個資料列，進行雜湊聯結。如需詳細資訊，請參閱[分配資料以實現查詢最佳化](t_Distributing_data.md)。
+ **序列執行**

   已在查詢計劃中指出 DS\$1DIST\$1ALL\$1INNER 重新配送樣式，其會強制序列執行，因為整個內部資料表已重新配送至單一節點。如需詳細資訊，請參閱[分配資料以實現查詢最佳化](t_Distributing_data.md)。

## 範例查詢
<a name="r_SVCS_ALERT_EVENT_LOG-sample-queries"></a>

下列查詢顯示四個查詢的提醒事件。

```
SELECT query, substring(event,0,25) as event, 
substring(solution,0,25) as solution, 
trim(event_time) as event_time from svcs_alert_event_log order by query;

 query |             event             |          solution            |     event_time      
-------+-------------------------------+------------------------------+---------------------
  6567 | Missing query planner statist | Run the ANALYZE command      | 2014-01-03 18:20:58
  7450 | Scanned a large number of del | Run the VACUUM command to rec| 2014-01-03 21:19:31
  8406 | Nested Loop Join in the query | Review the join predicates to| 2014-01-04 00:34:22
 29512 | Very selective query filter:r | Review the choice of sort key| 2014-01-06 22:00:00

(4 rows)
```

# SVCS\$1COMPILE
<a name="r_SVCS_COMPILE"></a>

記錄查詢之每個查詢區段的編譯時間和位置，包括執行於擴展叢集的查詢以及執行於主要叢集的查詢。

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

所有使用者都可看見 SVCS\$1COMPILE。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

如需 SCL\$1COMPILE 的相關資訊，請參閱 [SVL\$1COMPILE](r_SVL_COMPILE.md)。

## 資料表欄
<a name="r_SVCS_COMPILE-table-rows"></a>

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

## 範例查詢
<a name="r_SVCS_COMPILE-sample-queries"></a>

在此範例中，查詢 35878 和 35879 執行相同的 SQL 陳述式。查詢 35878 的編譯欄位針對四個查詢區段顯示 `1`，此值表示該區段已編譯。查詢 35879 在每個區段的編譯欄位中顯示 `0`，表示該區段不需要重新編譯。

```
select userid, xid,  pid, query, segment, locus,  
datediff(ms, starttime, endtime) as duration, compile 
from svcs_compile 
where query = 35878 or query = 35879
order by query, segment;

 userid |  xid   |  pid  | query | segment | locus | duration | compile
--------+--------+-------+-------+---------+-------+----------+---------
    100 | 112780 | 23028 | 35878 |       0 |     1 |        0 |       0
    100 | 112780 | 23028 | 35878 |       1 |     1 |        0 |       0
    100 | 112780 | 23028 | 35878 |       2 |     1 |        0 |       0
    100 | 112780 | 23028 | 35878 |       3 |     1 |        0 |       0
    100 | 112780 | 23028 | 35878 |       4 |     1 |        0 |       0
    100 | 112780 | 23028 | 35878 |       5 |     1 |        0 |       0
    100 | 112780 | 23028 | 35878 |       6 |     1 |     1380 |       1
    100 | 112780 | 23028 | 35878 |       7 |     1 |     1085 |       1
    100 | 112780 | 23028 | 35878 |       8 |     1 |     1197 |       1
    100 | 112780 | 23028 | 35878 |       9 |     2 |      905 |       1
    100 | 112782 | 23028 | 35879 |       0 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       1 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       2 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       3 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       4 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       5 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       6 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       7 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       8 |     1 |        0 |       0
    100 | 112782 | 23028 | 35879 |       9 |     2 |        0 |       0
(20 rows)
```

# SVCS\$1CONCURRENCY\$1SCALING\$1USAGE
<a name="r_SVCS_CONCURRENCY_SCALING_USAGE"></a>

記錄並行擴展的用量期間。每個用量期間都是連續的持續時間，個別並行擴展叢集在此期間主動處理查詢。

SVCS\$1CONCURRENCY\$1SCALING\$1USAGE 超級使用者可以看到此表格。資料庫超級使用者可選擇將它開啟供所有使用者檢視。

## 資料表欄
<a name="r_SVCS_CONCURRENCY_SCALING_USAGE-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_CONCURRENCY_SCALING_USAGE-sample-queries"></a>

若要以秒為單位檢視特定期間的用量持續時間，請輸入以下查詢：

```
select * from svcs_concurrency_scaling_usage order by start_time;

start_time | end_time | queries | usage_in_seconds
----------------------------+----------------------------+---------+------------------
2019-02-14 18:43:53.01063 | 2019-02-14 19:16:49.781649 | 48 | 1977
```

# SVCS\$1EXPLAIN
<a name="r_SVCS_EXPLAIN"></a>

顯示已提交供執行之用的查詢的 EXPLAIN 計劃。

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

所有使用者都可看見 SVCS\$1EXPLAIN。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="r_SVCS_EXPLAIN-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_EXPLAIN-sample-queries"></a>

考慮彙總聯結查詢的下列 EXPLAIN 輸出：

```
explain select avg(datediff(day, listtime, saletime)) as avgwait
from sales, listing where sales.listid = listing.listid;
                                  QUERY PLAN
                                  
------------------------------------------------------------------------------
 XN Aggregate  (cost=6350.30..6350.31 rows=1 width=16)
  ->  XN Hash Join DS_DIST_NONE  (cost=47.08..6340.89 rows=3766 width=16)
        Hash Cond: ("outer".listid = "inner".listid)
        -> XN Seq Scan on listing  (cost=0.00..1924.97 rows=192497 width=12)
        -> XN Hash  (cost=37.66..37.66 rows=3766 width=12)
              -> XN Seq Scan on sales  (cost=0.00..37.66 rows=3766 width=12)
(6 rows)
```

如果執行此查詢且其查詢 ID 為 10，則您可以使用 SVCS\$1EXPLAIN 資料表，來查看 EXPLAIN 命令所傳回相同類型的資訊：

```
select query,nodeid,parentid,substring(plannode from 1 for 30),
substring(info from 1 for 20) from svcs_explain
where query=10 order by 1,2;

query| nodeid |parentid|           substring            |    substring
-----+--------+--------+--------------------------------+-------------------
10   |      1 |      0 |XN Aggregate  (cost=6717.61..6  |
10   |      2 |      1 |  -> XN Merge Join DS_DIST_NO| Merge Cond:("outer"
10   |      3 |      2 |       -> XN Seq Scan on lis |
10   |      4 |      2 |       -> XN Seq Scan on sal |
(4 rows)
```

請考處下列查詢：

```
select event.eventid, sum(pricepaid)
from event, sales
where event.eventid=sales.eventid
group by event.eventid order by 2 desc;

eventid |   sum
--------+----------
    289 | 51846.00
   7895 | 51049.00
   1602 | 50301.00
    851 | 49956.00
   7315 | 49823.00
...
```

 如果此查詢的 ID 為 15，則下列系統資料表查詢會傳回已執行的計劃節點。在此情況下，會保留節點的順序，以顯示執行的實際順序：

```
select query,nodeid,parentid,substring(plannode from 1 for 56)
from svcs_explain where query=15 order by 1, 2 desc;

query|nodeid|parentid|                          substring
-----+------+--------+--------------------------------------------------------
15   |    8 |      7 |                                -> XN Seq Scan on eve
15   |    7 |      5 |                          -> XN Hash(cost=87.98..87.9
15   |    6 |      5 |                          -> XN Seq Scan on sales(cos
15   |    5 |      4 |                    -> XN Hash Join DS_DIST_OUTER(cos
15   |    4 |      3 |              -> XN HashAggregate(cost=862286577.07..
15   |    3 |      2 |        -> XN Sort(cost=1000862287175.47..10008622871
15   |    2 |      1 |  -> XN Network(cost=1000862287175.47..1000862287197.
15   |    1 |      0 |XN Merge(cost=1000862287175.47..1000862287197.46 rows=87
(8 rows)
```

下列查詢會擷取包含視窗函數之任何查詢計劃的查詢 ID：

```
select query, trim(plannode) from svcs_explain
where plannode like '%Window%';

query|                                     btrim
-----+------------------------------------------------------------------------
26   | -> XN Window(cost=1000985348268.57..1000985351256.98 rows=170 width=33)
27   | -> XN Window(cost=1000985348268.57..1000985351256.98 rows=170 width=33)
(2 rows)
```

# SVCS\$1PLAN\$1INFO
<a name="r_SVCS_PLAN_INFO"></a>

使用 SVCS\$1PLAN\$1INFO 資料表，以一組資料列查看查詢的 EXPLAIN 輸出。這是查看查詢計劃的其他方法。

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

所有使用者都可看見 SVCS\$1PLAN\$1INFO。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="r_SVCS_PLAN_INFO-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_PLAN_INFO-sample-queries"></a>

下列範例會比較藉由使用 EXPLAIN 命令，以及藉由查詢 SVCS\$1PLAN\$1INFO 所傳回之簡單 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\$1QUERY\$1SUMMARY
<a name="r_SVCS_QUERY_SUMMARY"></a>

您可以使用 SVCS\$1QUERY\$1SUMMARY 檢視來尋找查詢執行的一般相關資訊。

 請留意，SVCS\$1QUERY\$1SUMMARY 中的資訊是從所有節點彙總而來。

**注意**  
 SVCS\$1QUERY\$1SUMMARY 檢視僅包含 Amazon Redshift 所完成查詢的相關資訊，不包含其他公用程式和 DDL 命令的相關資訊。如需 Amazon Redshift 所完成全部陳述式的完整清單和相關資訊 (包含 DDL 和公用程式命令)，則可查詢 SVL\$1STATEMENTTEXT 檢視。  
字首為 SVCS 的系統檢視可提供查詢的詳細資訊，包括主要叢集與並行擴展叢集上的查詢。這些檢視類似字首為 SVL 的檢視，差別在於 SVL 檢視僅提供執行於主要叢集之查詢的資訊。

所有使用者都可看見 SVCS\$1QUERY\$1SUMMARY。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

此資料表中的部份或所有資料也會在 SYS 監控檢視 [SYS\$1QUERY\$1DETAIL](SYS_QUERY_DETAIL.md) 中找到。SYS 監視檢視中的資料會格式化為更易於使用和理解。我們建議您使用 SYS 監控檢視進行查詢。

如需 SVL\$1QUERY\$1SUMMARY 的相關資訊，請參閱 [SVL\$1QUERY\$1SUMMARY](r_SVL_QUERY_SUMMARY.md)。

## 資料表欄
<a name="r_SVCS_QUERY_SUMMARY-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_QUERY_SUMMARY-sample-queries"></a>

 **檢視查詢步驟的處理資訊** 

下列查詢顯示查詢 87 每個步驟的基本處理資訊：

```
select query, stm, seg, step, rows, bytes
from svcs_query_summary
where query = 87
order by query, seg, step;
```

此查詢會擷取查詢 87 的相關處理資訊，如下範例輸出所示：

```
 query | stm | seg | step |  rows  |  bytes
-------+-----+-----+------+--------+---------
87     |   0 |   0 |    0 |     90 |    1890 
87     |   0 |   0 |    2 |     90 |     360 
87     |   0 |   1 |    0 |     90 |     360 
87     |   0 |   1 |    2 |     90 |    1440 
87     |   1 |   2 |    0 | 210494 | 4209880 
87     |   1 |   2 |    3 |  89500 |       0 
87     |   1 |   2 |    6 |      4 |      96 
87     |   2 |   3 |    0 |      4 |      96 
87     |   2 |   3 |    1 |      4 |      96 
87     |   2 |   4 |    0 |      4 |      96 
87     |   2 |   4 |    1 |      1 |      24 
87     |   3 |   5 |    0 |      1 |      24 
87     |   3 |   5 |    4 |      0 |       0 
(13 rows)
```

 **判斷查詢步驟是否溢出至磁碟** 

下列查詢顯示查詢 ID 為 1025 的任何查詢步驟 (請參閱 [SVL\$1QLOG](r_SVL_QLOG.md) 檢視來了解如何取得查詢的查詢 ID) 是否溢出至磁碟或查詢完全在記憶體內執行：

```
select query, step, rows, workmem, label, is_diskbased
from svcs_query_summary
where query = 1025
order by workmem desc;
```

此查詢傳回下列範例輸出：

```
query| step|  rows  |  workmem   |  label        | is_diskbased
-----+-----+--------+-----------+---------------+--------------
1025 |  0  |16000000|  141557760 |scan tbl=9     | f
1025 |  2  |16000000|  135266304 |hash tbl=142   | t
1025 |  0  |16000000|  128974848 |scan tbl=116536| f
1025 |  2  |16000000|  122683392 |dist           | f
(4 rows)
```

透過掃描 IS\$1DISKBASED 的值，您可以檢視哪一個查詢步驟使用磁碟。針對查詢 1025，雜湊步驟在磁碟上執行。步驟可能在包含雜湊、彙總或排序步驟的磁碟上執行。若要只檢視磁碟型的查詢步驟，將 **and is\$1diskbased = 't'** 子句新增至以上範例的 SQL 陳述式。

# SVCS\$1S3LIST
<a name="r_SVCS_S3LIST"></a>

使用 SVCS\$1S3LIST 檢視以取得有關區段層級的 Amazon Redshift Spectrum 查詢詳細資訊。一個區段可以執行一個外部資料表掃描。此檢視衍生自 SVL\$1S3LIST 系統檢視，但不會顯示執行於並行擴展叢集之查詢的分割層級。

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

所有使用者都可看見 SVCS\$1S3LIST。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

如需 SVL\$1S3LIST 的相關資訊，請參閱 [SVL\$1S3LIST](r_SVL_S3LIST.md)。

## 資料表欄
<a name="r_SVCS_S3LIST-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_S3LIST-sample-query"></a>

以下範例會查詢前次查詢執行的 SVCS\$1S3LIST。

```
select * 
from svcs_s3list 
where query = pg_last_query_id() 
order by query,segment;
```

# SVCS\$1S3LOG
<a name="r_SVCS_S3LOG"></a>

使用 SVCS\$1S3LOG 檢視以取得有關區段層級的 Redshift Spectrum 查詢的疑難排解詳細資訊。一個區段可以執行一個外部資料表掃描。此檢視衍生自 SVL\$1S3LOG 系統檢視，但不會顯示執行於並行擴展叢集之查詢的分割層級。

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

所有使用者都可看見 SVCS\$1S3LOG。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

如需 SVL\$1S3LOG 的相關資訊，請參閱 [SVL\$1S3LOG](r_SVL_S3LOG.md)。

## 資料表欄
<a name="r_SVCS_S3LOG-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_S3LOG-sample-query"></a>

以下範例會查詢前次執行查詢的 SVCS\$1S3LOG。

```
select * 
from svcs_s3log 
where query = pg_last_query_id() 
order by query,segment;
```

# SVCS\$1S3PARTITION\$1SUMMARY
<a name="r_SVCS_S3PARTITION_SUMMARY"></a>

使用 SVCS\$1S3PARTITION\$1SUMMARY 檢視來取得區段層級的 Redshift Spectrum 查詢分割處理的摘要。一個區段可以執行一個外部資料表掃描。

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

所有使用者都可看見 SVCS\$1S3PARTITION\$1SUMMARY。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

如需 SVL\$1S3PARTITION 的相關資訊，請參閱 [SVL\$1S3PARTITION](r_SVL_S3PARTITION.md)。

## 資料表欄
<a name="r_SVCS_S3PARTITION_SUMMARY-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_S3PARTITION_SUMMARY-sample-query"></a>

以下範例會取得前次執行查詢的分割區掃描詳細資訊。

```
select query, segment, assignment, min_starttime, max_endtime, min_duration, avg_duration 
from svcs_s3partition_summary 
where query = pg_last_query_id() 
order by query,segment;
```

# SVCS\$1S3QUERY\$1SUMMARY
<a name="r_SVCS_S3QUERY_SUMMARY"></a>

使用 SVCS\$1S3QUERY\$1SUMMARY 檢視以取得在系統上執行之所有 Redshift Spectrum 查詢 (S3 查詢) 摘要。一個區段可以執行一個外部資料表掃描。

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

所有使用者都可看見 SVCS\$1S3QUERY\$1SUMMARY。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

如需 SVL\$1S3QUERY 的相關資訊，請參閱 [SVL\$1S3QUERY](r_SVL_S3QUERY.md)。

## 資料表欄
<a name="r_SVCS_S3QUERY_SUMMARY-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_S3QUERY_SUMMARY-sample-query"></a>

以下範例會取得前次執行查詢的掃描步驟詳細資訊。

```
select query, segment, elapsed, s3_scanned_rows, s3_scanned_bytes, s3query_returned_rows, s3query_returned_bytes, files 
from svcs_s3query_summary 
where query = pg_last_query_id() 
order by query,segment;
```

```
query | segment | elapsed | s3_scanned_rows | s3_scanned_bytes | s3query_returned_rows | s3query_returned_bytes | files
------+---------+---------+-----------------+------------------+-----------------------+------------------------+------               
 4587 |       2 |   67811 |               0 |                0 |                     0 |                      0 |     0
 4587 |       2 |  591568 |          172462 |         11260097 |                  8513 |                 170260 |     1
 4587 |       2 |  216849 |               0 |                0 |                     0 |                      0 |     0
 4587 |       2 |  216671 |               0 |                0 |                     0 |                      0 |     0
```

# SVCS\$1STREAM\$1SEGS
<a name="r_SVCS_STREAM_SEGS"></a>

列出串流與並行區段之間的關係。

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

所有使用者都可看見 SVCS\$1STREAM\$1SEGS。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="r_SVCS_STREAM_SEGS-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_STREAM_SEGS-sample-queries"></a>

若要針對最新查詢檢視串流與並行區段之間的關係，請輸入下列查詢：

```
select *
from svcs_stream_segs
where query = pg_last_query_id();

 query | stream | segment
-------+--------+---------
    10 |      1 |       2
    10 |      0 |       0
    10 |      2 |       4
    10 |      1 |       3
    10 |      0 |       1
(5 rows)
```

# SVCS\$1UNLOAD\$1LOG
<a name="r_SVCS_UNLOAD_LOG"></a>

使用 SVCS\$1UNLOAD\$1LOG 來取得 UNLOAD 操作的詳細資訊。

SVCS\$1UNLOAD\$1LOG 會針對 UNLOAD 陳述式所建立的每一個檔案記錄一個資料列。例如，若 UNLOAD 建立 12 個檔案，則 SVCS\$1UNLOAD\$1LOG 包含 12 個對應資料列。此檢視衍生自 STL\$1UNLOAD\$1LOG 系統資料表，但不會顯示執行於並行擴展叢集之查詢的分割層級。

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

所有使用者都可看見 SVCS\$1UNLOAD\$1LOG。超級使用者可以看見所有資料列；一般使用者只能看見自己的資料。如需詳細資訊，請參閱[系統資料表和檢視中資料的可見性](cm_chap_system-tables.md#c_visibility-of-data)。

## 資料表欄
<a name="r_SVCS_UNLOAD_LOG-table-columns"></a>

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

## 範例查詢
<a name="r_SVCS_UNLOAD_LOG-sample-query"></a>

若要取得已由 UNLOAD 命令寫入至 Amazon S3 的檔案清單，您可以在 UNLOAD 完成之後呼叫 Amazon S3 清單操作；不過，根據您發出呼叫的速度，清單可能不完整，因為 Amazon S3 清單操作最終會保持一致。若要立即取得完整、授權的清單，請查詢 SVCS\$1UNLOAD\$1LOG。

下列查詢會傳回已由 UNLOAD 針對前一個執行的查詢建立之檔案的路徑名稱：

```
select query, substring(path,0,40) as path
from svcs_unload_log
where query = pg_last_query_id()
order by path;
```

此命令會傳回下列範例輸出：

```
 
 query |             path
 ------+---------------------------------------------
  2320 | s3://amzn-s3-demo-bucket/venue0000_part_00
  2320 | s3://amzn-s3-demo-bucket/venue0001_part_00
  2320 | s3://amzn-s3-demo-bucket/venue0002_part_00
  2320 | s3://amzn-s3-demo-bucket/venue0003_part_00
(4 rows)
```