View Statistics

Is there a way to enable statistics on Views? I haven’t found anything about it in the documentation (yet), and google returns well, a bunch of stuff related to querying the information_schema about the stats and all the other stuff regarding statistics.

Hi,

Which kind of statistics you want? Generally by default, all views related information, you can get in information_schema.views table.
mysql> desc information_schema.VIEWS;
±---------------------±-------------±-----±----±--------±------+
| Field | Type | Null | Key | Default | Extra |
±---------------------±-------------±-----±----±--------±------+
| TABLE_CATALOG | varchar(512) | NO | | | |
| TABLE_SCHEMA | varchar(64) | NO | | | |
| TABLE_NAME | varchar(64) | NO | | | |
| VIEW_DEFINITION | longtext | NO | | NULL | |
| CHECK_OPTION | varchar(8) | NO | | | |
| IS_UPDATABLE | varchar(3) | NO | | | |
| DEFINER | varchar(77) | NO | | | |
| SECURITY_TYPE | varchar(7) | NO | | | |
| CHARACTER_SET_CLIENT | varchar(32) | NO | | | |
| COLLATION_CONNECTION | varchar(32) | NO | | | |
±---------------------±-------------±-----±----±--------±------+
10 rows in set (0.01 sec)

mysql>

I’m looking for usage statistics on views, similar to the statistics on tables that is shown in TABLE_STATISTICS.

Hi,

AFAIK, there is no any statistics table for views because they are not like physical tables but they are based on tables so you can check statistics of underlying tables of view.

Yeah, I was afraid of that. The reason I am looking for that is our Dev team is renaming tables and want to make sure that they have made all the changes in the code and were hoping to see something like 0 queries against that view. Thanks.