Monitoring COPY Loads using Meta
functions
Two
meta-functions return COPY metrics for the number of accepted or rejected rows
from a COPY statement:
- GET_NUM_ACCEPTED_ROWS
Returns the number of rows loaded into the database for the last completed load for the current session.
Do not
use it as a value in an INSERT query.
The
number of accepted rows is not available for a load that is currently in
process. Check the LOAD_STREAMS
system table for its status.
Also, this meta-function
supports only loads from STDIN or a single file on the initiator. You cannot
use GET_NUM_ACCEPTED_ROWS for multi-node loads.
- GET_NUM_REJECTED_ROWS
Returns the number of rows that were rejected during the last completed load for
the current session.
Do not
use it as a value in an INSERT query.
The
number of rejected rows is not available for a load that is currently in
process. Check the LOAD_STREAMS system
table for its status.
Also, this meta-function
supports only loads from STDIN or a single file on the initiator. You cannot
use GET_NUM_REJECTED_ROWS for multi-node loads.
sukul1=> COPY USER_30_DAY_TABLES.EMPLOYEE_1
sukul1-> (
sukul1(> NAME,
sukul1(> AGE NULL '***',
sukul1(> JOINING_DATE FILLER VARCHAR(10),
sukul1(> JOINING_YEAR AS
TO_NUMBER(TO_CHAR(TO_DATE(JOINING_DATE,'YYYY-MM-DD'),'YYYY')),
sukul1(> SALARY
sukul1(> )
sukul1-> FROM LOCAL
'/home/sukul1/employeedet3.dat'
sukul1-> FIXEDWIDTH COLSIZES(19,3,10,6)
sukul1-> SKIP 1
sukul1-> DIRECT;
Rows
Loaded
-------------
1
(1 row)
sukul1=> select * from
USER_30_DAY_TABLES.EMPLOYEE_1;
NAME | AGE | JOINING_YEAR
| SALARY
---------------------+-----+--------------+--------
SAURAV,GANGULY |
| 2010 | 200000
(1 row)
sukul1=> select get_num_accepted_rows();
get_num_accepted_rows
-----------------------
1
(1 row)
sukul1=> select get_num_rejected_rows();
get_num_rejected_rows
-----------------------
0
(1 row)
No comments:
Post a Comment