usql.indexes (U-SQL)

Summary

Contains one row per index for the schemas of the current database context.

Note

Some of the values documented below, such as the values for non-clustered indices and column-store indices, are there for possible future use and are not currently used.

Column name Data type Description
name string Name of the index
object_id_guid Guid Identifier of the object on which the index is defined
index_id int Ordinal position (starting at 1) of the index within the object/table
type int Type of index:

1 = Clustered

2 = Nonclustered

5 = Clustered Columnstore
type_desc string Description of index type:

CLUSTERED

NONCLUSTERED

CLUSTERED COLUMNSTORE

Examples

The examples can be executed in Visual Studio with the Azure Data Lake Tools plug-in.

Query the usql.indexes view

USE TestReferenceDB;

OUTPUT usql.indexes
TO "/ReferenceGuide/CatalogViews/indexes.txt"
USING Outputters.Tsv(outputHeader:true);

Query the usql.indexes view with usql.objects view

@indexes =
    SELECT o.name AS objectName,
            i.*
    FROM usql.indexes AS i
    JOIN usql.objects AS o
    ON i.object_id_guid == o.object_id_guid;

OUTPUT @indexes
TO "/ReferenceGuide/CatalogViews/indexes_objects.txt"
USING Outputters.Tsv(outputHeader:true);  

See Also