List most referenced tables (by FK) in Teradata

This query shows tables referenced by foreign keys with number of this references.

See also:


SELECT ParentDB || '.' || ParentTable AS TableName,
       COUNT(*) AS NumberOfReferences,
       COUNT(DISTINCT ChildDB || '.' || ChildTable) AS ReferencingTables
FROM    DBC.All_RI_ParentsV
GROUP BY    TableName
ORDER BY    NumberOfReferences DESC;


  • TableName - table name with database name
  • NumberOfReferences - references to this table
  • ReferencingTables - number of references to this table from diffrent tables


  • One row represents one table
  • Scope of rows: all tables that have at least one reference
  • Ordered by number of references descending

Sample results

There are no comments. Click here to write the first comment.