How often is a database update updated in MySQL?

Suppose I have a view in MySQL:

CREATE VIEW blah AS SELECT columnA FROM tableA 

How often is this view updated from the base table, tableA?

+6
source share
1 answer

Instantly. Views really do not exist as separate copies of data; instead, they exist as instructions for rewriting queries.

That is, when you select columnA from blah , MySQL internally overwrites this as select columnA from tableA .

In systems that support materialized representations, the database is responsible for maintaining their relevance.

(Note that when a query is complex enough, MySQL will only internally materialize the view for the duration of the query. This is an implementation detail and is best considered a defect in the MySQL query optimizer. EXPLAIN can be used to see when this happens, but you will probably notice terrible performance.)

+8
source

Source: https://habr.com/ru/post/897500/


All Articles