Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
AKUMARKC
Regular Visitor

Best Practice. Using sql stored procedure vs importing data from sql server?

Hello,

 

My organization just started utilizing the PowerBI and there are some developments going on. The vendor who is helping us is writing a lot of SQL queries and stored procedures, on the other hand, I was using the import option for data connectivity. It would be great if you give your opinion on what would be the best industry practice and how you are doing?

 

I am wondering if there would be any performance issue on using one or the other.

 

Thank you!

8 REPLIES 8
Element115
Memorable Member
Memorable Member

@Anonymous fascinating!  You have highlighted the need for me to go deeper into SQL Server and learn more advanced techniques.  Thumbs-up all around! 😁

Anonymous
Not applicable

Your consultant may have being attempting to satisfy a use case for near real-time data and so was using direct query where he performs all the transformations in database rather than PBImport. And, respectfully, @Element115 is only considering one approach for running a stored procedure in PBI which does force you into import.  There are other ways your consultant and I know about.  

Indeed!  First time I see this. @Anonymous Could you please explain what @Offset is and why is it needed?  

Anonymous
Not applicable

Sometime that won't work with particular queries, though.  In that case it is best to create a linked server, and query through the linked server using OPENROWSET technique.  (It is normal for a SQL serer to have created a linked server to itself.) This delightful new query, presumes you have created a linked server and it works cleanly. (Please remeber the community strips characters from the SQL sometime, so work it out if so)
😶

MikeGIles_0-1607961436304.png

 

Anonymous
Not applicable

You'll need to use a procedure that uses a parameter for this to work as described.

Element115
Memorable Member
Memorable Member

@AKUMARKC 

If running native SQL statements and/or stored procedures: performance will depend on the DB config and its load.

 

If importing (assuming that the dataset size does not exceed the Power BI limit), once imported, your perf depends on the xVelocity engine (aka VertiPaq) and the resources of the platform on which you're running this (your desktop or the cloud for Power BI Service). But if within the size limits, once everything is imported, you will not have the time lag that comes from going over the network and the time it takes the DB to return the result set or sets everytime you hit the DB to load additional data.

 

Also, keep in mind 'import' is only 1 of the 3 modes available to get your data into Power BI. The other 2 are 'composite', and 'DirectQuery'. And stored procedures cannot be called in DirectQuery mode, and there are also restrictions as regards the type and complexity of SQL statements that can be used in DirectQuery mode.

Anonymous
Not applicable

A different approach to running stored procedures will support Direct Query. Consider creating a DQ with something like this as your SQL statement:
DECLARE @return_value INT
EXEC @return_value = pbi.Delightful_Prodcedure @Offset = -7
SELECT 'Return Value' = @return_value;

Anonymous
Not applicable

MikeGIles_0-1607947971796.png

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.