Updated on 2024-07-19 GMT+08:00

ANALYZE

The Teradata SELECT command (short key SEL) is used to specify the table columns from which data is to be retrieved.

ANALYZE is used in GaussDB(DWS) for collecting optimizer statistics, which is used for improving query performance.

Input: ANALYZE with INSERT

1
2
INSERT INTO employee(empno,ename)  Values (1,'John');
COLLECT STAT on employee;

Output

1
2
3
INSERT INTO employee( empno, ename)                                            
SELECT 1 ,'John';
ANALYZE employee;

Input: ANALYZE with UPDATE

1
2
3
UPD employee SET ename = 'Jane'
        WHERE ename = 'John';
COLLECT STAT on employee;

Output

1
2
3
UPDATE employee SET ename = 'Jane'
 WHERE ename = 'John';
ANALYZE employee;

Input: ANALYZE with DELETE

1
2
DEL FROM employee WHERE ID > 10;
COLLECT STAT on employee;

Output

1
2
DELETE FROM employee WHERE ID > 10;
ANALYZE employee;