How much more efficient is a query from a view in a database than from a table?

Suppose I have a table A creating a view V from this table.

Then I make a few queries from B. I wonder if V will be rebuilt every time it is requested? or will it be built only once and stored somewhere in memory using the DBMS for the following queries (which, in my opinion, looks like a query from a table)?

+5
source share
4 answers

In general, no. V is a transitional rowset, which is calculated by the query request. Since you can apply additional WHERE and ORDER BY criteria when querying from a view, the execution plan for two queries to the same view can be completely different. The database usually cannot reuse the results of the previous query for the view in order to satisfy the next query against this view.

, , Materialized Views, . , , , . , Materialize Views SELECT, INSERT, UPDATE DELETE.

, . , ( , ), , .

+2

MySQL - .

MySQL , . .

"" , Oracle Microsoft SQL Server. SQL MySQL , .

- MySQL, , , FlexViews. , , MySQL, . , :

  • FlexViews PHP , , . , FlexViews .
  • SELECT.
  • , FlexViews, . , .
+1

, , , (), . , 1- , (, , ), , , , , , -.

Pinal Dave SQL ( , ). , - .

0

Mysql . ( Oracle, Oracle). mysql .

, JOIN BUFFER.

, -

global join_buffer_size = 314572800;

. , ( ), .

-1

All Articles