Columnstore dmv sys.column_store_segments some columns always NULL Azure Database

Arthur Olcot 5 Reputation points
2024-12-02T16:30:23.0233333+00:00

Within an Azure SQL database, I have a clustered column store index (many millions of records), with a number of columns of which are mainly INT based.

When I interrogate the dmv sys.column_store_segments, the columns [has_nulls], [min_data_id] and [max_data_id] are always NULL. I'm mainly bothered about the min/max data id's so that I can try and tune our indexes/workload accordingly.

I have enough permissions, tried rebuilding the partitions etc, nothing seems to affect it. Querying it seems fine so trying to understand why the dmv's are like this and cannot find anything anywhere that could indicate why these are always NULL.

Current SKU is a serverless gen5 up to 6 vcores.

Any thoughts/answers/ideas welcome!

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. Arthur Olcot 5 Reputation points
    2024-12-03T11:37:03.4466667+00:00

    Ok I've finally found the issue and it looks like a bug in the dmv's themselves by not correctly handling valid table names that need to have delimiters adding to make it a valid identifier.

    See column definition code from within the sys.column_store_segments view:

    (case when has_perms_by_name(OBJECT_SCHEMA_NAME(p.idmajor) + '.' + OBJECT_NAME(p.idmajor), 'OBJECT', 'SELECT') = 1 then s.min_data_id else NULL end) as min_data_id
    

    Can clearly see that we need QUOTENAME() in there to correctly generate the object identifier as without it, and when using tablenames that need delimiting, it will always return NULL.

    This isn't the only column/view with this issue/pattern. I can see the same issue in sys.column_store_dictionaries. May well be other dmv's not related to columnstore with a similar issue where the correctly delimiting of table names is not happening

    @Erland Sommarskog i don't have a means to raise this as a bug with MS, any advice on how to get this raised within MS to address in a future release?

    Thanks

    1 person found this answer helpful.

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.