none
Providing Non-Primary Key Information RRS feed

  • Question

  • Hello,

    Using library functions like Table.AddKey and Type.AddTableKey, it’s possible to annotate tables with information about their primary and non-primary keys. I’m trying to better understand when it’s advantageous to provide information about non-primary keys.

    For non-primary keys, is there an expectation that the values in their columns are unique or is it appropriate to tag non-unique secondary keys and/or foreign keys?

    If a non-primary key is tagged, how is this information used? If non-primary keys are to be unique, I can imagine that an operation might use that knowledge to decide to use an algorithm optimized for unique values. If non-primary keys aren’t expected to be unique, I’m not sure what operations might do with that data—maybe something like using it in query folding to order joins predicates on key columns before non-key columns?

    Thank you,
    Ben


    Tuesday, December 10, 2019 7:22 PM

Answers

  • Hi Ben. If I had to guess, I would imagine that this allows M to model non-primary keys in data sources (such as SQL). This non-primary-key info could potentially be useful when folding, for example.

    Ehren

    Friday, December 20, 2019 5:36 PM
    Owner

All replies