Views in MySQL

MySQL supports views from version 5.x and almost views’ features conform to the SQL: 2003 standard. Queries of views in MySQL are processed in two ways:

  • MySQL creates a temporary table based on the query which defined the view and then execute the input query on this table.
  • MySQL first combines the input query and query which defined the view, then MySQL executes this query.

MySQL supports versioning system for views. Each time when the view is altered or replaced, a copy of the existing view is back up in arc (archive) folder which is resided in specific database folder. The name of back up file is view_name.frm-00001. If you later change the view again it will be named as view_name.frm-00002.

MySQL also allows you to create views of views. In the SELECT statement of view definition, you can reference to another views.

If the cached is enabled the query against view is stored in the cached. It increases the performance of query by pulling data from the buffering system instead of making calling to hard disk.