

 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\$1LIMIT
<a name="r_STL_LIMIT"></a>

分析在 SELECT 查詢中使用 LIMIT 子句時發生的執行步驟。

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

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

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

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

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

為了要在 STL\$1LIMIT 中產生資料列，此範例會使用 LIMIT 子句，針對 VENUE 資料表執行下列查詢。

```
select * from venue
order by 1
limit 10;
```

```
 venueid |         venuename          |    venuecity    | venuestate | venueseats
---------+----------------------------+-----------------+------------+------------
       1 | Toyota Park                | Bridgeview      | IL         |          0
       2 | Columbus Crew Stadium      | Columbus        | OH         |          0
       3 | RFK Stadium                | Washington      | DC         |          0
       4 | CommunityAmerica Ballpark  | Kansas City     | KS         |          0
       5 | Gillette Stadium           | Foxborough      | MA         |      68756
       6 | New York Giants Stadium    | East Rutherford | NJ         |      80242
       7 | BMO Field                  | Toronto         | ON         |          0
       8 | The Home Depot Center      | Carson          | CA         |          0
       9 | Dick's Sporting Goods Park | Commerce City   | CO         |          0
      10 | Pizza Hut Park             | Frisco          | TX         |          0
(10 rows)
```

接著，執行下列查詢，以尋找您上次針對 VENUE 資料表所執行之查詢的查詢 ID。

```
select max(query)
from stl_query;
```

```
  max
--------
 127128
(1 row)
```

您可以選擇性地執行下列查詢，以驗證查詢 ID 對應至您先前執行的 LIMIT 查詢。

```
select query, trim(querytxt)
from stl_query
where query=127128;
```

```
 query  |                  btrim
--------+------------------------------------------
 127128 | select * from venue order by 1 limit 10;
(1 row)
```

最後，執行下列查詢，從 STL\$1LIMIT 資料表傳回 LIMIT 查詢的相關資訊。

```
select slice, segment, step, starttime, endtime, tasknum
from stl_limit
where query=127128
order by starttime, endtime;
```

```
  slice | segment | step |         starttime          |          endtime           | tasknum
 -------+---------+------+----------------------------+----------------------------+---------
      1 |       1 |    3 | 2013-09-06 22:56:43.608114 | 2013-09-06 22:56:43.609383 |      15
      0 |       1 |    3 | 2013-09-06 22:56:43.608708 | 2013-09-06 22:56:43.609521 |      15
  10000 |       2 |    2 | 2013-09-06 22:56:43.612506 | 2013-09-06 22:56:43.612668 |       0
(3 rows)
```