====== Kontrola indexů ======
===== Chybějící =====
SELECT rel.RDB$RELATION_NAME as TABLE_NAME FROM RDB$RELATIONS rel
WHERE COALESCE(rel.RDB$SYSTEM_FLAG, 0) = 0 AND coalesce(rel.RDB$RELATION_TYPE,0) = 0
and not exists (select ind.RDB$INDEX_NAME from RDB$INDICES ind where RDB$UNIQUE_FLAG=1 and ind.RDB$RELATION_NAME=rel.RDB$RELATION_NAME)
and not (rel.RDB$RELATION_NAME='COMMON_SYSLOG' or rel.RDB$RELATION_NAME='PROST_KAPACITY' or rel.RDB$RELATION_NAME='DOKUMENTY_CPOPIS' or rel.RDB$RELATION_NAME like '%CISMEMO%')
===== Seznam všech =====
SELECT rel.RDB$RELATION_NAME as TABLE_NAME, ind.RDB$INDEX_NAME AS INDEX_NAME, cast(list(trim(seg.RDB$FIELD_NAME)) as varchar(1024)) as INDEX_FIELDS FROM RDB$RELATIONS rel
join RDB$INDICES ind on RDB$UNIQUE_FLAG=1 and ind.RDB$RELATION_NAME=rel.RDB$RELATION_NAME
join RDB$INDEX_SEGMENTS seg on ind.RDB$INDEX_NAME=seg.RDB$INDEX_NAME
WHERE COALESCE(rel.RDB$SYSTEM_FLAG, 0) = 0 AND coalesce(rel.RDB$RELATION_TYPE,0) = 0
group by 1,2