List all unused domains for a Firebird database

2019-03-29 15:46发布

Is there a quick way to list all Firebird domains defined for a database that are actually not used by any field ? I have a large database with many tables and many domains and it seems that a lot of them are not anymore used, so I guess it's time for a cleanup !

I think this is possible by querying the RDB$... system tables, but I'm unsure how to do this.

标签: firebird
1条回答
迷人小祖宗
2楼-- · 2019-03-29 16:39
SELECT
  f.rdb$field_name
FROM
  rdb$fields f
  LEFT JOIN rdb$relation_fields rf
    ON rf.rdb$field_source = f.rdb$field_name
WHERE
  rf.rdb$field_name IS NULL
  AND
  COALESCE(f.rdb$system_flag, 0) = 0
查看更多
登录 后发表回答