Using ANYDATA/SQL_VARIANT in FACT table

假装没事ソ 提交于 2020-01-06 05:47:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!