• Grassohopper

    I'am sorry but I disagree with you. I still think that it's not normal.

    If you look at the tblIndexUsageInfo table you will see that if the table as one index you will have one line with the index name,

    If the table has two index you will have four line two for each index,

    If the table have three indexes you will have nine line three for each indexes and so on.

    More important you will see that the user_seeks, user_scans etc value are the same and are repeated.

    This is due to a cross join because it miss the "and spi.index_id=si.index_id" statement for the join on dm_db_index_usage_stats.

    If you look at

    select * from sys.dm_db_index_usage_stats

    where database_id='9' (put the database_id you wish)

    you will clearly see that there is only one and unique index_id for each object_id (table) and one and unique values for user_seeks, user_scans etc....

    for example here what it gives you without the correct join a select on tblIndexUsageInfo:

    tablename indexname seeks scans lookups update

    ---------- ------------------------------ ------ ------ ------- ------

    extract_sd IX_extract_sd_wan 0 0 0 11714

    extract_sd IX_extract_sd_wan 0 0 0 46838

    extract_sd IX_extract_sd_wan 46837 5 0 11714

    extract_sd IX_extractsd_exsd_honoraire 0 0 0 11714

    extract_sd IX_extractsd_exsd_honoraire 0 0 0 46838

    extract_sd IX_extractsd_exsd_honoraire 46837 5 0 11714

    extract_sd PK_Extract_sd 0 0 0 11714

    extract_sd PK_Extract_sd 0 0 0 46838

    extract_sd PK_Extract_sd 46837 5 0 11714

    with the correct join you will have

    tablename indexname seeks scans lookups update

    ---------- ------------------------------ ------ ------ ------- ------

    extract_sd IX_extract_sd_wan 46837 5 0 11714

    extract_sd IX_extractsd_exsd_honoraire 0 0 0 11714

    extract_sd PK_Extract_sd 0 0 0 46838

    regards

    Kristof

    Kristof