Is there performance gain when using View's in SQL?

5

The View 's are virtual tables, resulting from SQL queries, as in the example:

CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

From this, we can update or delete a View , but we can not edit the data directly in them.

Are there any performance gains when using them, or is the use only related to code reduction in application queries?

    
asked by anonymous 15.07.2014 / 17:57

2 answers

5

Creating a View in itself, does not produce gain in performance. However, there are a few things you can do to improve your performance:

  • In SQL Server you can create indexes for the View, improving its performance.
  • In Oracle, you can create Materialized Views, which also provides performance gains.
  • 15.07.2014 / 18:16
    2

    The reuse of the code and in some cases of performance are gained because the encapsulated SQL of the view is already compiled.

        
    15.07.2014 / 18:32