Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Auto select on PI - response (4) by graebige

$
0
0

Sorry,
I made myself not very clear - I would like to know how to find what clumn is a metric or dimension in any given table.
Once I know that I could run the following SQL to compare pre-post and could setup a batch that runs every night and is screening others table schemas.
thoughts?
 
SELECT
                 SUM(SKEWCALC .NUMBEROFROWS) AS TOTALROWS
                , MIN(SKEWCALC .NUMBEROFROWS) AS MINROWSONAMP
                , MAX(SKEWCALC .NUMBEROFROWS) AS MAXROWSONAMP
                , AVG(SKEWCALC .NUMBEROFROWS) AS AVGROWSONAMP
                , 100 - ( AVG (SKEWCALC. NUMBEROFROWS)/ MAX (SKEWCALC. NUMBEROFROWS) * 100 ) AS SKEWFACTOR
FROM
                (
                                 SELECT
                                                 HASHAMP (HASHBUCKET (HASHROW(
                                                         [your_PI&your_new_PI]
                                                     ))) AS AMPNUMBER ,
                                                 CAST(COUNT(*) AS DECIMAL(18,0)) AS NUMBEROFROWS

                                 FROM
                                                 [your_table_name]
                                 GROUP BY 1
                ) AS SKEWCALC ;
              


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>