0

SQL documentation states that

The database engine recreates the data, using the view's SQL statement, every time a user queries a view

How does data retrieval process from SQL views offers better performance as compared to execution of select query to retrieve data from tables.

Rubin Porwal
  • 3,736
  • 1
  • 23
  • 26
  • 1
    The answer to your question depends on the database you are using, the view you are using, etc. You should label this question with a database vendor. – Tim Biegeleisen Dec 22 '16 at 06:11
  • For a discussion of views in SQL Server and MySQL, you can see [here](http://stackoverflow.com/questions/10302615/mysql-views-performance) and [here](http://stackoverflow.com/questions/439056/is-a-view-faster-than-a-simple-query). – Tim Biegeleisen Dec 22 '16 at 06:12
  • 1
    **It doesn't** - plain and simple. Views are **not** designed / intended to boost performance - they're intended to present a caller a more suitable / more flexible / more customized **view** of his data. They're great for reporting or for other purposees - but they are **NOT** performance improvements – marc_s Dec 22 '16 at 07:46

2 Answers2

0

Basically Views are Used for Security purpose Than for performance,while Using Views you can restrict the users from Accessing a particular Table.

The only difference is Views can be saved and reused whenever required,than to rewrite the whole Query again.

Queen
  • 11
  • 1
0

Views are just queries with names.
It is like saving a code snippet (in the database level) so you won't have to write the same code again and again.
Views have nothing to do with performance.

Being that said -
There is a mechanism named "Materialized views", where in this case the query result is actually stored in a table so it can be used without executing the query again and again.
The Materialized views results might be refreshed in multiple manners -
on demand, on schedule, every time the base table is being updated etc.

David דודו Markovitz
  • 42,900
  • 6
  • 64
  • 88