Book Image

MariaDB Cookbook

By : Daniel Bartholomew
Book Image

MariaDB Cookbook

By: Daniel Bartholomew

Overview of this book

Table of Contents (20 chapters)
MariaDB Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using the performance schema


Using the performance schema is similar to querying a table or set of tables.

Getting ready

Enable the performance schema as described in the Enabling the performance schema recipe earlier in this chapter.

How to do it...

  1. Connect to MariaDB using the mysql command-line client. List how many current connections the users have and how many connections they had in total (we might want to log in and out a few times with example users to populate this table):

    SELECT * FROM performance_schema.users;
    

    The preceding commands display an output similar to the following screenshot:

  2. Look up for the detailed information on all of the currently running user connection threads:

    SELECT * FROM performance_schema.threads 
        WHERE type="foreground"\G 
    

    The preceding commands display an output similar to the following screenshot:

  3. Add the following code to the [mysqld] section of our my.cnf or my.ini file and then restart MariaDB to disable the collection of user connection statistics...