Collecting Statistics on a UDF - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2024-12-13
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
jbg1472252759029
lifecycle
latest
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;