mssql indexes analyse WIP

This commit is contained in:
Jan Prochazka
2021-08-14 09:36:22 +02:00
parent 71e1ea5736
commit 3c0bc69662
5 changed files with 42 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
module.exports = `
select i.object_id as objectId, i.name as constraintName, i.type_desc, i.is_unique as isUnique,i.index_id, i.is_unique_constraint from sys.indexes i
where i.is_primary_key=0
and i.is_hypothetical=0 and indexproperty(i.object_id, i.name, 'IsStatistics') = 0
and objectproperty(i.object_id, 'IsUserTable') = 1
and i.index_id between 1 and 254
--and i.name not in
-- (select o.name from sysobjects o
-- where o.parent_obj = i.object_id
-- and objectproperty(o.id, N'isConstraint') = 1.0)
and i.object_id =OBJECT_ID_CONDITION
`;