Obsah

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