Is this query sufficient to determine that a custom field is not currently used in any JIRA issues in an instance?
select *
from customfield cf
where not exists
(select * from customfieldvalue cfv where cfv.CUSTOMFIELD = cf.ID)
And is this sufficient to see that it was never used historically?
select *
from customfield cf
where not exists
(select * from customfieldvalue cfv where cfv.CUSTOMFIELD = cf.ID)
and not exists
(select * from changeitem ci where ci.FIELDTYPE = 'custom' and ci.FIELD = cf.cfname)