

 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/)。

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

# STL\$1NESTLOOP
<a name="r_STL_NESTLOOP"></a>

分析查詢的巢狀迴路聯結執行步驟。

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

**注意**  
STL\$1NESTLOOP 僅包含在主佈建叢集上執行的查詢。但不包含在並行擴縮叢集上或無伺服器命名空間上執行的查詢。若要存取在主要叢集、並行擴縮叢集和無伺服器命名空間上執行的查詢說明計畫，建議您使用 SYS 監控檢視 [SYS\$1QUERY\$1DETAIL](SYS_QUERY_DETAIL.md)。SYS 監視檢視中的資料會格式化為更易於使用和理解。

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

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

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

由於下列查詢會忽略聯結 CATEGORY 資料表，因此它會產生局部 Cartesian 產品，而我們不建議這樣做。在這裡顯示它，是為了說明巢狀迴路。

```
select count(event.eventname), event.eventname, category.catname, date.caldate
from event, category, date
where event.dateid = date.dateid
group by event.eventname, category.catname, date.caldate;
```

下列查詢會將來自前一個查詢的結果顯示在 STL\$1NESTLOOP 檢視中。

```
select query, slice, segment as seg, step, 
datediff(msec, starttime, endtime) as duration, tasknum, rows, tbl
from stl_nestloop
where query = pg_last_query_id();
```

```
 query | slice | seg | step | duration | tasknum | rows  | tbl
-------+-------+-----+------+----------+---------+-------+-----
  6028 |     0 |   4 |    5 |       41 |      22 | 24277 | 240
  6028 |     1 |   4 |    5 |       26 |      23 | 24189 | 240
  6028 |     3 |   4 |    5 |       25 |      23 | 24376 | 240
  6028 |     2 |   4 |    5 |       54 |      22 | 23936 | 240
```