Advance query editor or Create view in Sql

Hi ,

I want to know the best practice for the below asked question:

Should i create view on sql or use advance query editor to fire query on sql server.
which give me best performance or it will be same any approach will be good.

I mean should i use below option
image

or i create view and just use
Select * from [view];

Thanks,
Anurag

Hi @Anurag,

Read this article.

I hope this is helplful.

1 Like

@Anurag ALWAYS use a View. A View acts as a layer between your Physical table and the client tool. You can make all the changes in a view and then import it inside Power Query whereas if you directly query a Physical table then if tomorrow you want to add a new column then you will have to modify the physical table or do it in Power Query (which may not support native query)

A view with a Schema allows your DBA to know that there is a view that is using some tables in the model to fetch the data for a project, this prevents them from modifying/removing the tables before reaching out to you.

With a SQL query you will have to use Value.NativeQuery function explicitly.

1 Like

I am agree with your point here but just one more question which is bothering me here does view give me better performances vs putting sql query in power bi.

Or both are equal in performance.

Thanks,
Anurag

Hi @Anurag. Your DBA should be able to answer this for your specific environment. As a general rule of thumb, I’d go for the view, as SQL Server will cache the execution plan for the view and reuse it, whereas a text query will need to have a new query plan created each time it’s executed.
Greg

1 Like