Possible error in column index type

Jun 18, 2009 at 8:07 PM

Hello,

Internals viewer reports clustered index as 'Heap' in the key grid. For example, in the AdventureWorks2008 database, table dbo.DatabaseLog, index PK_DatabaseLog_DatabaseLogID is non-clustered. In the key grid appears labeled as 'Clustered'. Conversely, in table HumanResources.Department, index PK_Department_DepartmentID is clustered and is labeled as 'Heap'.

Thanks (wonderful tool! :-)).

Xosé Antonio Rubal

 

Apr 25, 2011 at 8:36 AM

Enum used is the same for pages and indexes. Int values are wrong for indexes.

 

    [Flags]
    public enum IndexTypes
    {
        Heap = 1,
        Clustered = 2,
        NonClustered = 4,
        Leaf = 8,
        Node = 16,
        TableClustered = 32,
        NonClusteredLeaf = NonClustered | Leaf
    }

I changed in source code the mapping in AllocationUnitLayer.cs

 

int index_type = Convert.ToInt32(row["index_type"]);
                        if (index_type == 0)
                            layer.IndexType = IndexTypes.Heap;
                        else if (index_type == 1)
                            layer.IndexType = IndexTypes.Clustered;
                        else if (index_type == 2)
                            layer.IndexType = IndexTypes.NonClustered;
                        else
                            //the previous code I've found here
                            layer.IndexType = (IndexTypes)index_type;