cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

PowerBI performance with Databricks

Vetrivel
Contributor

We have integrated PowerBI with Databricks to generate reports. However, PowerBI generates over 8,000 lines of code, including numerous OR clauses, which cannot be modified at this time. This results in queries that take more than 4 minutes to execute and are automatically cancelled before a plan is generated. The time required for query optimization and file pruning further delays the process, preventing the plan from being generated. As a result, we are unable to use the report with Databricks, as queries containing numerous OR clauses are either taking an excessive amount of time to execute or failing altogether. 
Please note that we have already implemented optimization techniques within Databricks, and our data consists of small files, such as 1 file in the DIM table and 22 files in the FACT tables. Adjusting the size of the serverless SQL warehouse has not resolved the issue.

If anyone has successfully addressed this issue, please share your solution.

4 REPLIES 4

Sidhant07
Databricks Employee
Databricks Employee

Hi,

To address this issue, here are some suggestions:
  1. Use the BROADCAST hint to optimize the join between the DIM and FACT tables. This can help reduce the amount of data that needs to be processed and improve the performance of the query.
  2. Use the MERGE statement to combine the OR clauses into a single query. This can help reduce the number of queries that are generated and improve the performance of the query.
  3. Use the OPTIMIZE command to optimize the Delta tables. This can help improve the performance of the query by reducing the amount of data that needs to be read and processed.
  4. Use the VACUUM command to remove any deleted files from the Delta tables. This can help improve the performance of the query by reducing the amount of data that needs to be read and processed.
  5. Use the ZORDER command to optimize the layout of the Delta tables. This can help improve the performance of the query by reducing the amount of data that needs to be read and processed.

Vetrivel
Contributor

@Sidhant07 The issue is not related to the volume of data, as it is relatively small. Rather, the challenge lies in the time it takes to generate the plan in Databricks, which results in the process being automatically cancelled. Consequently, we are unable to retrieve the complete query from the query history. Additionally, we cannot modify the query generated by PowerBI at this time. We have already implemented liquid clustering for the FACT and DIM tables.

Vetrivel
Contributor

As per our analysis, “joins” are not a problem but the huge “where” clause with lot of “OR” conditions.

Vetrivel
Contributor

Attached is the sample query generated by Power BI. Without the OR conditions the query runs within seconds.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group