

 Amazon Redshift는 패치 198부터 새 Python UDF 생성을 더 이상 지원하지 않습니다. 기존 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/)을 참조하세요.

# SYS\_LOAD\_HISTORY
<a name="SYS_LOAD_HISTORY"></a>

SYS\_LOAD\_HISTORY를 사용하여 COPY 명령의 세부 정보를 봅니다. 각 행은 일부 필드에 대한 누적 통계가 있는 COPY 명령을 나타냅니다. 여기에는 실행 중인 COPY 명령과 완료된 COPY 명령이 모두 포함됩니다.

SYS\_LOAD\_HISTORY는 모든 사용자에게 표시됩니다. 수퍼유저는 모든 행을 볼 수 있지만 일반 사용자는 자체 데이터만 볼 수 있습니다. 자세한 내용은 [시스템 테이블 및 뷰에 있는 데이터의 가시성](cm_chap_system-tables.md#c_visibility-of-data) 섹션을 참조하세요.

## 테이블 열
<a name="SYS_LOAD_HISTORY-table-columns"></a>


| 열 이름  | 데이터 유형  | 설명  | 
| --- | --- | --- | 
| user\_id | 정수 | 사본을 제출한 사용자의 식별자입니다. | 
| query\_id | bigint | 사본의 쿼리 식별자입니다. | 
| transaction\_id | bigint | 트랜잭션 식별자입니다. | 
| session\_id | 정수 | 사본을 실행하는 프로세스의 프로세스 식별자입니다. | 
| database\_name | 텍스트 | 작업이 실행되었을 때 사용자가 연결된 데이터베이스의 이름입니다. | 
| status | 텍스트 | 복사본의 상태입니다. 유효한 값은 running, completed, aborted입니다. | 
| table\_name | 텍스트 | 복사할 테이블의 이름입니다. | 
| start\_time | timestamp | 복사가 시작된 시간입니다. | 
| end\_time | timestamp | 복사가 완료된 시간입니다. | 
| duration | bigint | COPY 명령에 소요된 시간(마이크로초)입니다. | 
| data\_source | 텍스트 | 복사할 파일 입력의 Amazon S3 위치입니다. | 
| file\_format | 텍스트 | 소스 파일 형식입니다. 형식으로는 csv, txt, json, avro, orc, parquet 등이 있습니다. | 
| loaded\_rows | bigint | 테이블에 복사된 행 수입니다. | 
| loaded\_bytes | bigint | 테이블에 복사된 바이트 수입니다. | 
| source\_file\_count | 정수 | 소스 파일의 파일 수입니다. | 
| source\_file\_bytes | bigint | 소스 파일의 바이트 수입니다. | 
| file\_count\_scanned | 정수 | Amazon S3에서 스캔한 파일 수입니다. | 
| file\_bytes\_scanned | bigint | Amazon S3의 파일에서 스캔한 바이트 수입니다. | 
| error\_count | bigint | 오류 수입니다. | 
| copy\_job\_id  | bigint  | 복사 작업 식별자입니다. 0은 작업 식별자가 없음을 나타냅니다. | 

## 샘플 쿼리
<a name="SYS_LOAD_HISTORY-sample-queries"></a>

다음 쿼리는 특정 copy 명령의 로드된 행, 바이트 수, 테이블 및 데이터 소스를 보여줍니다.

```
SELECT query_id,
       table_name,
       data_source,
       loaded_rows,
       loaded_bytes
FROM sys_load_history
WHERE query_id IN (6389,490791,441663,74374,72297)
ORDER BY query_id,
         data_source DESC;
```

샘플 출력은 다음과 같습니다.

```
 query_id |    table_name    |                               data_source                             | loaded_rows | loaded_bytes
----------+------------------+-----------------------------------------------------------------------+-------------+---------------
     6389 | store_returns    | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/store_returns/    |   287999764 | 1196240296158
    72297 | web_site         | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/web_site/         |          54 |         43808
    74374 | ship_mode        | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/ship_mode/        |          20 |          1320
   441663 | income_band      | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/income_band/      |          20 |          2152
   490791 | customer_address | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/customer_address/ |     6000000 |     722924305
```

다음 쿼리는 copy 명령의 로드된 행, 바이트 수, 테이블 및 데이터 소스를 보여줍니다.

```
SELECT query_id,
       table_name,
       data_source,
       loaded_rows,
       loaded_bytes
FROM sys_load_history
ORDER BY query_id DESC
LIMIT 10;
```

샘플 출력은 다음과 같습니다.

```
 query_id |       table_name       |                                 data_source                                 | loaded_rows |  loaded_bytes
----------+------------------------+-----------------------------------------------------------------------------+-------------+-----------------
   491058 | web_site               | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/web_site/               |          54 |           43808
   490947 | web_sales              | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/web_sales/              |   720000376 |  22971988122819
   490923 | web_returns            | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/web_returns/            |    71997522 |     96597496325
   490918 | web_page               | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/web_page/               |        3000 |            1320
   490907 | warehouse              | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/warehouse/              |          20 |            1320
   490902 | time_dim               | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/time_dim/               |       86400 |            1320
   490876 | store_sales            | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/store_sales/            |  2879987999 | 151666241887933
   490870 | store_returns          | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/store_returns/          |   287999764 |   1196405607941
   490865 | store                  | s3://load-test/data-sources/tpcds/2.8.0/textfile/1T/store/                  |        1002 |          365507
```

 다음 쿼리는 copy 명령의 일별 로드된 행 및 바이트 수를 보여줍니다.

```
SELECT date_trunc('day',start_time) AS exec_day,
       SUM(loaded_rows) AS loaded_rows,
       SUM(loaded_bytes) AS loaded_bytes
FROM sys_load_history
GROUP BY exec_day
ORDER BY exec_day DESC;
```

샘플 출력은 다음과 같습니다.

```
      exec_day       | loaded_rows |   loaded_bytes
---------------------+-------------+------------------
 2022-01-20 00:00:00 |  6347386005 |  258329473070606
 2022-01-19 00:00:00 | 19042158015 |  775198502204572
 2022-01-18 00:00:00 | 38084316030 | 1550294469446883
 2022-01-17 00:00:00 | 25389544020 | 1033271084791724
 2022-01-16 00:00:00 | 19042158015 |  775222736252792
 2022-01-15 00:00:00 | 19834245387 |  798122849155598
 2022-01-14 00:00:00 | 75376544688 | 3077040926571384
```