简体   繁体   中英

where views are stored in Mysql

I have some questions on views -

  1. Where views are created/stored in Mysql? Or they are only virtual and deleted after some time period?

  2. When the data of views is refresh? (It refresh automatically when we insert data in actual table or we have to update view each time?)

  3. Use of views is good or we should fire the queries each time?

  1. Views are pure metadata. MySQL doesn't copy any data during the creating of a view, and it's also it is not deleted after a time.
  2. When you run a select on a view, mysql (or any other database) runs the query defined at creation time.
  3. There's no performance difference (or almos not different) between running a query on a table or on a view.

Some databases, such as oracle, support something called materialised views . These views, do copy the data, so they have to be refreshed, so the data doesn't become stale.

Leaving this as it turned up in Google results.

To see view definitions in MySQL you can use this query:

SELECT * FROM information_schema.VIEWS;

Regards,

James

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM