SQL Server query to Power Query - efficiency

zico8

Board Regular
Joined
Jul 13, 2015
Messages
227
Hi,

Tell me please how SQL database queries generated from MS Excel and loaded directly into Power Query works (via Data> Get Data> From Database> From SQL Server Database).
Does the query generated this way run slower and overload the database more than if I wrote a SQL query by hand?

Let's say that in the database I have a table with several hundred thousand indexes (records), but I need to download only 10, which I previously placed in a separate table in MS Excel spreadsheet.
The data from this table is firstly loaded into a new Power Query query, and then by connecting to the database and selecting the table I am interested in, I immediately merge it to the first query with my indexes via Right Outher.

The IT department reports to me that such a query puts a heavy load on the database. I see it also while refreshing the query in MS Excel, when it looks as if all records are taken from the database table at first, although only 10 is loaded into the sheet - as I wanted.

Is connecting to a SQL database this way is as efficient as writing a SQL query from hand? So what am I doing wrong?
 

Attachments

  • 1.PNG
    1.PNG
    25.9 KB · Views: 31
  • 2.PNG
    2.PNG
    34.2 KB · Views: 31
  • 3.PNG
    3.PNG
    19 KB · Views: 31

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Why not let VBA build the SQL Queries for you? Power Query is built for results not performance.
 
Upvote 0
Personally I would have created a view in SQL and then got Power Query to have downloaded that.
 
Upvote 0

Forum statistics

Threads
1,223,677
Messages
6,173,793
Members
452,534
Latest member
autodiscreet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top