Not the answer you need?
Register and ask your own question!

View Statistics

jbgriffithjbgriffith EntrantCurrent User Role Beginner
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.

Comments

  • niljoshiniljoshi MySQL Sage Inactive User Role Beginner
    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>
  • jbgriffithjbgriffith Entrant Current User Role Beginner
    I'm looking for usage statistics on views, similar to the statistics on tables that is shown in TABLE_STATISTICS.
  • niljoshiniljoshi MySQL Sage Inactive User Role Beginner
    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.
  • jbgriffithjbgriffith Entrant Current User Role Beginner
    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.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.