Is Query Folding happening in Power BI?

Поділитися
Вставка

КОМЕНТАРІ • 67

  • @Greg0Connell
    @Greg0Connell 4 роки тому +7

    If your query is folding, it's a pretty good sign you need to rewrite your query properly. As a general principle there are usually benefits in pushing those changes as far back into the ETL as possible. Why? Firstly, when YOU write the TSQL you can tune it, comment it, make the WHERE clause SARGable and make the layout of the TSQL readable for the poor sod who is going to inherit your lazy drag and drop ETL. Secondly, query folding can blow out the plan cache on the source database server. For example, in TSQL you might use getdate(). The M query can instead think it is ever so helpfully doing the same thing by pushing a literal value back to the source server. The plan cache sees this as a different query EVERY TIME IT RUNS and fills up the cache with thousands of almost identical plans that are never going to be used. Finally, Power BI is just the presentation layer. If you're building business logic, sooner or later someone else is going to want the same logic surfaced a different way. If your complex calculation is pushed back to your centralised source of truth, everyone has the benefit of it. Not just those who happen to consume it through Power BI.

    • @BernatAgulloRosello
      @BernatAgulloRosello 4 роки тому

      I don't think it's a good general rule. For most transformations better on source than inside powerBI

    • @Greg0Connell
      @Greg0Connell 4 роки тому +1

      @@BernatAgulloRosello That's exactly what I said.

    • @BernatAgulloRosello
      @BernatAgulloRosello 4 роки тому

      @@Greg0Connell then I think we're using "folding" in opposite meanings. Query folding means that all transformations fold into a single query. I think. Or that's what I understood from the video. Previously I had no idea what query folding means so I could be wrong.

    • @Greg0Connell
      @Greg0Connell 4 роки тому +1

      @@BernatAgulloRosello Key point is that with query folding, Power BI is rewriting your TSQL query for you, the general assumption being that it's better for the Power BI server if that processing is pushed back to the source. The principle is fine. The execution is not always optimal though. I am yet to see a single example of query folding, where a human couldn't have done a better job writing the TSQL themselves. You can see this for yourself if you capture the code being executed on the source (eg with a profiler trace or extended events). Folding scrambles it into a completely avoidable cryptic mess. It cares naught for things like SARGability and plan cache bloat. But humans do.
      So by all means push the processing back to the source. Just be wary of letting Power BI do it for you.

    • @alt-enter237
      @alt-enter237 4 роки тому +1

      @@Greg0Connell This dialogue is EXACTLY why I love the comments just as much as the original video. I learn so much from both. Thank you for the time/effort to post your comments. I don't understand all of it yet, but boy have you given me some stuff to think about.

  • @ingeborg-anne
    @ingeborg-anne 2 роки тому +2

    SOOOOOOOO much easier to understand this concept from how you explained it. I couldn't make heads nor tails of the explanation Microsoft gave me.

  • @mathew9665
    @mathew9665 4 роки тому +6

    I love this tips - However I would state that given all the effort to make using Power Query easy to learn and use (for 90% of tasks), it's a pity there has not been as much investment in making things like checking on Query Folding easy also

    • @aryanterrance6092
      @aryanterrance6092 3 роки тому

      you prolly dont give a shit but if you guys are stoned like me atm then you can stream all the latest movies and series on instaflixxer. Been binge watching with my girlfriend recently :)

    • @jonaslandyn6945
      @jonaslandyn6945 3 роки тому

      @Aryan Terrance Yup, I have been watching on instaflixxer for since november myself :D

  • @fspinacz
    @fspinacz 3 роки тому +4

    Yet another fabuloustic video from you guys! I truly appreciate the form, your enthusiasm and that funny spice you add to it ;) This is bananas!

  • @raquelalvear4693
    @raquelalvear4693 3 роки тому +1

    Hi there! I try to use this functionality but every time I try it opens a black window with sqldumper on it and it closes Power BI. do you know why this might happen? it worked once but not anymore... Thank you!!

  • @pabeader1941
    @pabeader1941 4 роки тому +3

    I'm not exactly sure how to express what is going through my mind right now. i'm completely flabbergasted, dumb-struck, aghast. I have been using the Show Native Query to rebuild a number of my transformations and now I find out that it isn't quite the tool I and 100s of others thought is was. I AM so glad that you did this video and that I decided to watch it. I almost didn't since I expected it to be just more of the same. Lucky for me I clicked on it anyway.

    • @cptdeadeye2112
      @cptdeadeye2112 4 роки тому

      I haven't even known about this, before.
      What are you using it for?

    • @pabeader1941
      @pabeader1941 4 роки тому +2

      @@cptdeadeye2112 I have a number of 'messy' data transforms on many of my data sources. The more I can push back on the server, the faster they process. Some of my data sources take 30+ transform steps, so the more I can offload, the better. I have documented as good as 2X less time to complete processing on a number of data refreshes. With this new knowledge I bet I can do even better.

  • @FrostSpike
    @FrostSpike 2 роки тому +1

    I've always known "Query Folding" as "Pushdown" with the intermediate query engine even creating temporary stored procedures and temporary tables on the source where possible (and given permission to do so).

  • @pthapa55
    @pthapa55 4 місяці тому

    Awesome video, thanks. I do have a question though, I am running a simple stored procedure and applied step for top 100 rows. When I go to check the Diagnose Step, it doesn't add a separate folder like you have in your video for the diagnose step. I was wondering why I can't see that. Is that because my source is not odata feed and I am using sql server as source?

  • @NareshOjha
    @NareshOjha 3 роки тому +1

    Hi Patrick - I am using SAP HANA database as my source, which tool shall I use to see the query folding logs similar to the Azure data studio which you are using for SQL server?

  • @AndrewRooks
    @AndrewRooks 2 роки тому

    Patrick, These Diagnostic Tools do not appear in Power BI Services within a DataFlow. How could I execute this for a DataFlow Query?
    Thanks Andrew

  • @benjaminjoseph101
    @benjaminjoseph101 4 роки тому +1

    Really useful. But what if I have a chain of queries that reference earlier ones? How do they fold?
    E.g. Suppose I have a query (A) which can be fully folded back to the server. I then reference it as the source in query B. Can query B also fully be folded back to the server or does folding stop at the end of query A and mean query B always has to happen on my local laptop?
    Appreciate any advice you guys have - I'm an old-fashioned Excel guy who is still only learning to wield this new superpower :-)

  • @abdulfiroz9
    @abdulfiroz9 8 місяців тому

    What about Amazon redshift, does it allow query folding

  • @mehdihammadi6145
    @mehdihammadi6145 4 роки тому +1

    I was just looking for an exemple on how to check if a query folding occures on non SQL Databases. Thank you Patrick

  • @TitansLacrosse34
    @TitansLacrosse34 3 роки тому +1

    Always helpful, thanks so much!

  • @NiedostepnyNick
    @NiedostepnyNick Рік тому

    How to do it in snowflake? It should be supported but in no circumstances can I get it to work😢

  • @paulomarcelo
    @paulomarcelo 4 роки тому +2

    6:17 Comércio Mineiro, Família Arquibaldo... Meu cérebro bugou, por alguns minutos achei que eu não tava mais em um canal gringo.

    • @GuyInACube
      @GuyInACube  4 роки тому +2

      Trying to keep it real! 👊

  • @sandeepchowdary6338
    @sandeepchowdary6338 2 роки тому

    Hello sir i didn't understand please explain any other way

  • @danneubauer6474
    @danneubauer6474 4 роки тому +3

    This is great, thanks Patrick!

  • @mikeczyzewski7187
    @mikeczyzewski7187 4 роки тому +1

    Awesome vid. Very helpful. I'm gonna go and see what kind of folding is taking place on some of my reports. Thanks!

    • @GuyInACube
      @GuyInACube  4 роки тому

      Awesome! Thanks for watching! 👊

  • @eljangoolak
    @eljangoolak Рік тому

    Hi Patrick, wonderful video. when I load data from Azure Databricks it seems even the source step doesn't have query folding, is it the case that Databricks doesn't support any query folding? or Is there a way to "Activate it"

  • @learnData-oo5yk
    @learnData-oo5yk 2 роки тому

    How to do that on sql profiler

  • @DanielTavares29
    @DanielTavares29 Рік тому

    6:18 "Comércio Mineiro" 🤪😍

  • @roshinisaac2643
    @roshinisaac2643 3 роки тому

    I am a beginner to query folding and would like to enable query folding to a data which is sourced to Power Query through OData. Please give your advice.

  • @dirkb.2801
    @dirkb.2801 2 роки тому

    Great Video. Thank you! One question: How can I find out if query folding is happening when querying an Exchange Online mailbox?

  • @aceboku5
    @aceboku5 4 роки тому

    Patrick...one thing to add. I didn't see the "Tools" on the menu bar. I had to go to File --> Options --> Preview Features --> and select "Query Diagnostics". Restart app....you are done. For anyone looking. Great video!

  • @wmc_videos
    @wmc_videos 2 роки тому

    This vid should be embedded in the query folding section within MS Learn. Good stuff!

  • @SocialMedia-io1tz
    @SocialMedia-io1tz 3 роки тому

    Hi
    I am trying to apply incremental refresh where source is SAP Hana
    but not able to do it,
    can you make a video for it?

  • @surajgupta-irl
    @surajgupta-irl 4 роки тому

    Hey Petrick, Thanks for video. I want know if MQuery is foldable query. I am using Mquery to extract my data from Azure Application Insights.

  • @BernatAgulloRosello
    @BernatAgulloRosello 4 роки тому +1

    I understand that Query Folding is a good thing, right?

    • @GuyInACube
      @GuyInACube  4 роки тому +7

      Yes! Helps to make sure the transformations happen at the data source instead of getting all the data back and having to do that transformation in Power BI Desktop / Gateway / or the service. The data source usually can do it more optimally then on the Power BI side. Less overhead and faster operations.

  • @rebeccaeriksen1656
    @rebeccaeriksen1656 2 роки тому

    What happens if the first few steps can be folded but subsequent steps cannot? Will it fold the first few steps, and let the mashup engine handle the rest, or will the mashup engine do all the steps?

  • @marcosviniciusreis7997
    @marcosviniciusreis7997 2 роки тому

    Great job, congrats! How to do this on direct query mode?

  • @sandykashyap
    @sandykashyap 3 роки тому

    Hi Patrick, I love these tips. I am trying with Azure Cost Management, but I am not sure I can get to select the diagnostic steps at all. I have not been able to say if the query folding is taking place actually

  • @ashrafhusain9351
    @ashrafhusain9351 2 роки тому

    Please tech slow

  • @khardu
    @khardu 4 роки тому +1

    Thank :)

  • @JohnsonVettuvelil
    @JohnsonVettuvelil 3 роки тому

    Excellent illustration! Thanks

  • @COk1ll3r
    @COk1ll3r 4 роки тому +1

    Very helpful, thanks.

    • @GuyInACube
      @GuyInACube  4 роки тому

      Glad it helped. Thanks for watching!👊

  • @rudielishernandez7547
    @rudielishernandez7547 3 роки тому

    Muchas gracias por compartir esta información 💪🏼🥰

  • @Ready_Set_Boom
    @Ready_Set_Boom 4 роки тому +1

    Yooooo

  • @kalyanivenugopal8578
    @kalyanivenugopal8578 4 роки тому

    How do we check if Query folding is happening when connecting Power BI to Salesforce datasource using Power BI Salesforce Object connector ? Is incremental refresh from power Bi possible when connecting to Salesforce ?

    • @GuyInACube
      @GuyInACube  4 роки тому

      We don't have access to salesforce. I don't know that it supports query folding to begin with. As the underlying connection with be API calls to the salesforce service, you could probably use Fiddler to see if the API calls are passing filters.

  • @Ready_Set_Boom
    @Ready_Set_Boom 4 роки тому

    What are some blogs and forums you all use?

  • @sam16379
    @sam16379 4 роки тому

    Thank you Patrick. If query folding is not happening for AWS Redshift as data source, anything can be done to enable it?

    • @GuyInACube
      @GuyInACube  4 роки тому

      Haven't played with that data source specifically. Have you tried pulling in a table and renaming one column to see if that folds? If it isn't happening, there isn't really anything you can do. Maybe go to the ODBC driver, but that's pretty extreme.

  • @akosiaxis
    @akosiaxis 4 роки тому

    Hey Patrick, where can I find a list of data sources that are supported by query folding?

    • @subanark
      @subanark 4 роки тому

      The better question is how much query folding is supported. Not, if it is or not supported. Basic query folding may only let you do simple filters, while more complex ones will let you do things like grouping. A good indication that strong folding is supported is if the data source supports direct query.

  • @FredKaffenberger
    @FredKaffenberger 4 роки тому

    "Insufficient permissions while starting the diagnostics listener. Consider running elevated." Is this a permanent aspect of the special tool or only while it's in preview?

    • @FredKaffenberger
      @FredKaffenberger 4 роки тому

      and no way to run the Microsoft Store version as elevated. But you can succeed with the downloaded version.

  • @kryptonmass36
    @kryptonmass36 3 роки тому

    thanks so much!

  • @pavelrehak5481
    @pavelrehak5481 4 роки тому +1

    Really cool!

    • @GuyInACube
      @GuyInACube  4 роки тому

      Appreciate that Pavel! Thanks for watching 👊

  • @jacquesstander1090
    @jacquesstander1090 2 роки тому

    Excellent!