How does views in database improve it's performance. Is quering between views create good performan

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3160927%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3EHow%20does%20views%20in%20database%20improve%20it's%20performance.%20Is%20quering%20between%20views%20create%20good%20performan%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3160927%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EHi%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI'm%20working%20on%20an%20application%20where%20I%20have%20the%20following%20doubt%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E1.%20Does%20a%20view%20improve%20the%20performance%20of%20DB%20%3F(Was%20unable%20to%20understand%26nbsp%3B%20even%20after%20reading%20the%20below%20reference)%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E2.%20In%20case%20I%20create%202%20views%20and%20run%20a%20join%20query%20between%20them%2C%20will%20it%20affect%20the%20performance%20of%20the%20DB%20%3F%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E3.%20I'm%20using%20Azure%20SQL%20DB%20for%20this%20project%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EReference%20%3A%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22%5C%26quot%3Bhttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fviews%3Fview%3Dsql-server-ver15%5C%26quot%3B%22%20target%3D%22%5C%26quot%3B_blank%5C%26quot%3B%22%20rel%3D%22%5C%26quot%3Bnoopener%20nofollow%20noopener%20noreferrer%22%20noreferrer%3D%22%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fviews%3Fview%3Dsql-server-ver15%26lt%3B%5C%2FA%26gt%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22%5C%26quot%3Bhttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-indexed-views%3Fview%3Dsql-server-ver15%5C%26quot%3B%22%20target%3D%22%5C%26quot%3B_blank%5C%26quot%3B%22%20rel%3D%22%5C%26quot%3Bnoopener%20nofollow%20noopener%20noreferrer%22%20noreferrer%3D%22%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-indexed-views%3Fview%3Dsql-server-ver15%26lt%3B%5C%2FA%26gt%3B%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22%5C%26quot%3Bhttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-views%3Fview%3Dsql-server-ver15%5C%26quot%3B%22%20target%3D%22%5C%26quot%3B_blank%5C%26quot%3B%22%20rel%3D%22%5C%26quot%3Bnoopener%20nofollow%20noopener%20noreferrer%22%20noreferrer%3D%22%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-views%3Fview%3Dsql-server-ver15%26lt%3B%5C%2FA%26gt%3B%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EAny%20help%20on%20this%20is%20greatly%20appreciated!!%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3ERegads%2C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3Eblack%20baron%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EPS%3A%20If%20this%20post%20has%20helped%20you%2C%20please%20vote%20for%20it.%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3160927%22%20slang%3D%22en-US%22%3EHow%20does%20views%20in%20database%20improve%20it's%20performance.%20Is%20quering%20between%20views%20create%20good%20performan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3160927%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20working%20on%20an%20application%20where%20I%20have%20the%20following%20doubt%3A%3C%2FP%3E%3CP%3E1.%20Does%20a%20view%20improve%20the%20performance%20of%20DB%20%3F(Was%20unable%20to%20understand%26nbsp%3B%20even%20after%20reading%20the%20below%20reference)%3C%2FP%3E%3CP%3E2.%20In%20case%20I%20create%202%20views%20and%20run%20a%20join%20query%20between%20them%2C%20will%20it%20affect%20the%20performance%20of%20the%20DB%20%3F%3C%2FP%3E%3CP%3E3.%20I'm%20using%20Azure%20SQL%20DB%20for%20this%20project%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReference%20%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fviews%3Fview%3Dsql-server-ver15%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fviews%3Fview%3Dsql-server-ver15%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-indexed-views%3Fview%3Dsql-server-ver15%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-indexed-views%3Fview%3Dsql-server-ver15%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-views%3Fview%3Dsql-server-ver15%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fviews%2Fcreate-views%3Fview%3Dsql-server-ver15%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20on%20this%20is%20greatly%20appreciated!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegads%2C%3C%2FP%3E%3CP%3Eblack%20baron%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%3A%20If%20this%20post%20has%20helped%20you%2C%20please%20vote%20for%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

 

I'm working on an application where I have the following doubt:

1. Does a view improve the performance of DB ?(Was unable to understand  even after reading the below reference)

2. In case I create 2 views and run a join query between them, will it affect the performance of the DB ?

3. I'm using Azure SQL DB for this project

 

Reference : 

https://docs.microsoft.com/en-us/sql/relational-databases/views/views?view=sql-server-ver15

https://docs.microsoft.com/en-us/sql/relational-databases/views/create-indexed-views?view=sql-server... 

https://docs.microsoft.com/en-us/sql/relational-databases/views/create-views?view=sql-server-ver15 

 

 

Any help on this is greatly appreciated!!

 

 

Regads,

black baron

 

PS: If this post has helped you, please vote for it.

3 Replies

@blackbaron , a view is just a predefined query (like a macro) and has no effect on performance.

You can create an index on a view, but there are several limitations.

Better create index on the base table instead on a view; so that ad-hoc queries can also benefit of the index.

Thanks @olafhelper :)
This answer gave me a direction. Hoping to see some other viewpoints too