how to avoid Power BI incremental refresh duplicated queries in BigQuery?

Viewed 642

I implemented a incremental refresh in a report that gets a lot of data from Google BigQuery. The issue is that each incremental refresh makes duplicated queries, and one of them is pretty expensive.

As Chris Webb's described in his article, power BI makes two queries in order to import data from a SQL database; one that returns a limited number of rows just to discover the table schema and another to get the actual data.

In many SQL servers, this only compromise performance, but in BigQuery, where the charge is made for the amount of data processed, regardless of the number of resulting rows, this first query is costing us a lot, because query folding is not taking place.

here I have some experiments with smaller datasets to show what is happening:

"discovery query" history print

Notice that the "discovery query" above is processing 121.66 MB to return just one row, while the "data query" below, where the query folding is taking place, is processing just 7.35 MB.

"data query" history print

I have implemented Chris solution modifying my M code, but BigQuery are still receiving duplicated queries. Is there any way to avoid the "discovery query"??

1 Answers

the short answer is no, PowerBI will always send multiple Queries, actually it is not bad at all it is sending only two Queries in this case:).

your best option option is to use clustering to reduce the table scan for example in this Query

SELECT UNIT, StationName, Technology, DAY, Mwh FROM `test-187010.ReportingDataset.UNITARCHIVE` LIMIT 1000 OFFSET 0

the Query estimate that it will process 4.3 GB, but actually it use only 18.6 MB see the table partition and clustering here enter image description here

Related