Collecting Statistics on a UDF - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

You can collect statistics on deterministic UDFs.

For example, suppose you create the following UDF.

CREATE FUNCTION months_between(Date1 TIMESTAMP, Date2 TIMESTAMP)
RETURNS FLOAT
LANGUAGE C
NO SQL
DETERMINISTIC
SPECIFIC months_between_tt
EXTERNAL NAME 'CS!months_between_tt!$PGMPATH$/months_between_tt.c'
PARAMETER STYLE SQL;

The following request collects statistics on the UDF months_between().

COLLECT STATISTICS
COLUMN months_between(BEGIN(policy_duration),
END(policy_duration)) AS Stats_MthsBetweenBegAndEnd
ON Policy_Types;