

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

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

# STV\_LOAD\_STATE
<a name="r_STV_LOAD_STATE"></a>

使用 STV\_LOAD\_STATE 資料表以尋找有關進行中的 COPY 陳述式目前狀態的資訊。

COPY 命令會在每載入一百萬筆記錄之後更新此資料表。

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

## 資料表欄
<a name="r_STV_LOAD_STATE-table-columns2"></a>


| 欄名稱  | 資料類型  | 說明  | 
| --- | --- | --- | 
| userid | integer | 產生項目之使用者的 ID。 | 
| session | integer | 執行此載入處理程序的工作階段 PID。 | 
| query  | integer  | 查詢 ID。可用於聯結其他系統資料表與檢視。 | 
| 分割  | integer  | 節點分割數量。 | 
| pid  | integer  | 處理程序 ID。工作階段中的所有查詢都是在相同的處理程序中執行，所以若您在相同的工作階段中執行一系列查詢，則此值通常會保持不變。 | 
| recordtime  | timestamp | 記錄被記錄的時間。 | 
| bytes\_to\_load | bigint | 此分割要載入的位元組總數。如果要載入的資料已壓縮，此數值為 0  | 
| bytes\_loaded | bigint | 此分割要載入的位元組數。如果要載入的資料已壓縮，此數值為資料解壓縮之後載入的位元組數。 | 
| bytes\_to\_load\_compressed | bigint | 此分割要載入的已壓縮資料的位元組總數。如果要載入的資料未壓縮，此數值為 0。 | 
| bytes\_loaded\_compressed | bigint  | 此分割要載入的已壓縮資料的位元組數。如果要載入的資料未壓縮，此數值為 0。 | 
| lines  | integer | 此分割要載入的行數。 | 
| num\_files | integer | 此分割要載入的檔案數。 | 
| num\_files\_complete | integer  | 此分割要載入的檔案數。 | 
| current\_file | character(256)  | 此分割要載入的檔案名稱。 | 
| pct\_complete | integer | 此分割已完成載入的資料百分比。 | 

## 範例查詢
<a name="r_STV_LOAD_STATE-sample-query2"></a>

若要檢視 COPY 命令的每個分割的進度，請輸入下列查詢。此範例使用 PG\_LAST\_COPY\_ID() 函式擷取最後一個 COPY 命令的資訊。

```
select slice , bytes_loaded, bytes_to_load , pct_complete from stv_load_state where query = pg_last_copy_id();

 slice | bytes_loaded | bytes_to_load | pct_complete 
-------+--------------+---------------+--------------
     2 |            0 |             0 |            0
     3 |     12840898 |      39104640 |           32
(2 rows)
```