问题
I am designing the schema for fact table, but I am little bit unsure about using the ANYDATA/SQL_VARIANT to store measures. My reason for using this type is to reuse the column for measures of multiple reports based on same CUBE.
What are the pitfalls/brawbacks of using ANYDATA/SQL_VARIANT in terms of performance, scalability, maintainability etc.?
回答1:
You might want to look at this similar question. I would avoid these data types because:
- They may make your ETL process slower and more complicated because of the need to implicitly or explicitly CONVERT to other data types for comparisons, passing to functions etc.
- SQL_VARIANT (i.e. Microsoft SQL Server) cannot store all data types (admittedly, the ones it can't store are unlikely to be measures anyway, but the point remains)
- Tools and applications may not be able to process them efficiently or even at all
- They are 'unusual' (at least in my experience), and you should only implement unusual things when they have a very significant advantage, otherwise you add maintenance complexity for no benefit
- It isn't clear from your description what advantage you would gain from the data types but you seem to be looking for a generic measure data type and that probably isn't a good approach for the reasons outlined in the linked question above
来源:https://stackoverflow.com/questions/9770315/using-anydata-sql-variant-in-fact-table