Forum Discussion
Import or let SQL do heavy lifting?
Hi guys, just wondering if its better to do all the lookups in SQL view or import the related tables and do the relationships in the model?
For instance, I have a Journal table with about 2 million rows. each record has a reference to an emplyee table and returns the employee name.
I can write a view that does the lookup in SQl and pull it into my model
or pull both tables into the model and do the relationship and lookup in the model.
How do these 2 methods affect performance?
which way is more condusive for direct query or import mode?
thanks guys
i
SQL is no subsitution for DAX, that's for sure; but push as much work as possible to database for preparing fundamental dataset. That's my advice.
Hi IanCockcroft
There is no direct comparative relationship between the two methods.
Consider the optimization possibilities for a DirectQuery model. As the model issues query requests to the underlying datasource, datasource optimization is critical to delivering responsive model queries.
What you can do at the datasource layer:
- Relational data sources can be optimized to ensure the fastest possible refresh by pre-integrating data, applying appropriate indexes, defining table partitions that align to incremental refresh periods, and materializing calculations (in place of calculated model tables and columns) or adding calculation logic to views.
- Non-relational data sources can be pre-integrated with relational stores.
Because of the case-by-case analysis, you can use SQL Profiler to perform performance analysis on data models built using both methods.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
2 Replies
- CNENFRNLCommunity Champion
SQL is no subsitution for DAX, that's for sure; but push as much work as possible to database for preparing fundamental dataset. That's my advice.
- v-xulin-mstfCommunity Support
Hi IanCockcroft
There is no direct comparative relationship between the two methods.
Consider the optimization possibilities for a DirectQuery model. As the model issues query requests to the underlying datasource, datasource optimization is critical to delivering responsive model queries.
What you can do at the datasource layer:
- Relational data sources can be optimized to ensure the fastest possible refresh by pre-integrating data, applying appropriate indexes, defining table partitions that align to incremental refresh periods, and materializing calculations (in place of calculated model tables and columns) or adding calculation logic to views.
- Non-relational data sources can be pre-integrated with relational stores.
Because of the case-by-case analysis, you can use SQL Profiler to perform performance analysis on data models built using both methods.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!