# 6.10 Query folding

Source: https://ravindrabagale.com/mr/powerbi/ch06-power-query-essentials/6-10-query-folding.html
Language: mr (Marathi with English technical terms)

Power Query तुमच्या काही steps source च्या language मध्ये, उदा. SQL मध्ये, बदलून ते काम source कडून करून घेतो; याला query folding म्हणतात. सर्व rows download करून locally process करण्याऐवजी result आणता येतो.

SQL Server, Oracle किंवा अनेक OData sources सारख्या query समजणाऱ्या sources मध्ये folding शक्य.

Flat Excel / CSV files मध्ये database सारखं query folding नसतं.

Filters, columns काढणं, rename, साधे joins, Group By सहसा fold होऊ शकतात.

Index किंवा काही custom functions folding थांबवू शकतात. Connector आणि expression नुसार तपासा.

Step वर right-click › View Native Query enabled असेल तर generated query पाहा. Grey असेल तर आधीचे steps आणि उपलब्ध diagnostics तपासा; प्रत्येक connector साठी grey म्हणजे folding नाही असा निष्कर्ष काढू नका. Supported Power Query experiences मध्ये step folding indicatorsही मिळतात.

हे महत्त्वाचं का?

मोठा refresh जलद होतो. DirectQuery आणि efficient incremental refresh साठी source पर्यंत filters पोहोचणं महत्त्वाचं असतं. Filters व column selection सुरुवातीला आणि non-folding काम शक्यतो शेवटी ठेवा.

अधिक माहिती: Microsoft Learn — Query folding indicators.

Microsoft documentation नुसार step folding indicators हे Power Query Online मध्ये उपलब्ध आहेत; Desktop मध्ये ते दिसतील असं गृहित धरू नका.

रवींद्र बागले यांची tip

सगळे steps fold होतात असं गृहित धरू नका. Native query, index किंवा custom function नंतर तपासा. Incremental refresh आधी date filters source पर्यंत जातात का हे विशेष तपासा.
