"Fossies" - the Fresh Open Source Software Archive

Member "phpMyAdmin-5.1.0-english/libraries/classes/Controllers/Server/Status/VariablesController.php" (24 Feb 2021, 28292 Bytes) of package /linux/www/phpMyAdmin-5.1.0-english.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "VariablesController.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.0.4-english_vs_5.1.0-english.

    1 <?php
    2 /**
    3  * Displays a list of server status variables
    4  */
    5 
    6 declare(strict_types=1);
    7 
    8 namespace PhpMyAdmin\Controllers\Server\Status;
    9 
   10 use PhpMyAdmin\DatabaseInterface;
   11 use PhpMyAdmin\Html\Generator;
   12 use PhpMyAdmin\Response;
   13 use PhpMyAdmin\Server\Status\Data;
   14 use PhpMyAdmin\Template;
   15 use PhpMyAdmin\Url;
   16 use function in_array;
   17 use function is_numeric;
   18 use function mb_strpos;
   19 
   20 class VariablesController extends AbstractController
   21 {
   22     /** @var DatabaseInterface */
   23     private $dbi;
   24 
   25     /**
   26      * @param Response          $response
   27      * @param Data              $data
   28      * @param DatabaseInterface $dbi
   29      */
   30     public function __construct($response, Template $template, $data, $dbi)
   31     {
   32         parent::__construct($response, $template, $data);
   33         $this->dbi = $dbi;
   34     }
   35 
   36     public function index(): void
   37     {
   38         global $err_url;
   39 
   40         $params = [
   41             'flush' => $_POST['flush'] ?? null,
   42             'filterAlert' => $_POST['filterAlert'] ?? null,
   43             'filterText' => $_POST['filterText'] ?? null,
   44             'filterCategory' => $_POST['filterCategory'] ?? null,
   45             'dontFormat' => $_POST['dontFormat'] ?? null,
   46         ];
   47         $err_url = Url::getFromRoute('/');
   48 
   49         if ($this->dbi->isSuperUser()) {
   50             $this->dbi->selectDb('mysql');
   51         }
   52 
   53         $this->addScriptFiles([
   54             'server/status/variables.js',
   55             'vendor/jquery/jquery.tablesorter.js',
   56             'server/status/sorter.js',
   57         ]);
   58 
   59         if (isset($params['flush'])) {
   60             $this->flush($params['flush']);
   61         }
   62 
   63         if ($this->data->dataLoaded) {
   64             $categories = [];
   65             foreach ($this->data->sections as $sectionId => $sectionName) {
   66                 if (! isset($this->data->sectionUsed[$sectionId])) {
   67                     continue;
   68                 }
   69 
   70                 $categories[$sectionId] = [
   71                     'id' => $sectionId,
   72                     'name' => $sectionName,
   73                     'is_selected' => false,
   74                 ];
   75                 if (empty($params['filterCategory'])
   76                     || $params['filterCategory'] !== $sectionId
   77                 ) {
   78                     continue;
   79                 }
   80 
   81                 $categories[$sectionId]['is_selected'] = true;
   82             }
   83 
   84             $links = [];
   85             foreach ($this->data->links as $sectionName => $sectionLinks) {
   86                 $links[$sectionName] = [
   87                     'name' => 'status_' . $sectionName,
   88                     'links' => $sectionLinks,
   89                 ];
   90             }
   91 
   92             $descriptions = $this->getDescriptions();
   93             $alerts = $this->getAlerts();
   94 
   95             $variables = [];
   96             foreach ($this->data->status as $name => $value) {
   97                 $variables[$name] = [
   98                     'name' => $name,
   99                     'value' => $value,
  100                     'is_numeric' => is_numeric($value),
  101                     'class' => $this->data->allocationMap[$name] ?? null,
  102                     'doc' => '',
  103                     'has_alert' => false,
  104                     'is_alert' => false,
  105                     'description' => $descriptions[$name] ?? '',
  106                     'description_doc' => [],
  107                 ];
  108 
  109                 // Fields containing % are calculated,
  110                 // they can not be described in MySQL documentation
  111                 if (mb_strpos($name, '%') === false) {
  112                     $variables[$name]['doc'] = Generator::linkToVarDocumentation(
  113                         $name,
  114                         $this->dbi->isMariaDB()
  115                     );
  116                 }
  117 
  118                 if (isset($alerts[$name])) {
  119                     $variables[$name]['has_alert'] = true;
  120                     if ($value > $alerts[$name]) {
  121                         $variables[$name]['is_alert'] = true;
  122                     }
  123                 }
  124 
  125                 if (! isset($this->data->links[$name])) {
  126                     continue;
  127                 }
  128 
  129                 foreach ($this->data->links[$name] as $linkName => $linkUrl) {
  130                     $variables[$name]['description_doc'][] = [
  131                         'name' => $linkName,
  132                         'url' => $linkUrl,
  133                     ];
  134                 }
  135             }
  136         }
  137 
  138         $this->render('server/status/variables/index', [
  139             'is_data_loaded' => $this->data->dataLoaded,
  140             'filter_text' => ! empty($params['filterText']) ? $params['filterText'] : '',
  141             'is_only_alerts' => ! empty($params['filterAlert']),
  142             'is_not_formatted' => ! empty($params['dontFormat']),
  143             'categories' => $categories ?? [],
  144             'links' => $links ?? [],
  145             'variables' => $variables ?? [],
  146         ]);
  147     }
  148 
  149     /**
  150      * Flush status variables if requested
  151      *
  152      * @param string $flush Variable name
  153      */
  154     private function flush(string $flush): void
  155     {
  156         $flushCommands = [
  157             'STATUS',
  158             'TABLES',
  159             'QUERY CACHE',
  160         ];
  161 
  162         if (! in_array($flush, $flushCommands)) {
  163             return;
  164         }
  165 
  166         $this->dbi->query('FLUSH ' . $flush . ';');
  167     }
  168 
  169     /**
  170      * @return array
  171      */
  172     private function getAlerts(): array
  173     {
  174         // name => max value before alert
  175         return [
  176             // lower is better
  177             // variable => max value
  178             'Aborted_clients' => 0,
  179             'Aborted_connects' => 0,
  180 
  181             'Binlog_cache_disk_use' => 0,
  182 
  183             'Created_tmp_disk_tables' => 0,
  184 
  185             'Handler_read_rnd' => 0,
  186             'Handler_read_rnd_next' => 0,
  187 
  188             'Innodb_buffer_pool_pages_dirty' => 0,
  189             'Innodb_buffer_pool_reads' => 0,
  190             'Innodb_buffer_pool_wait_free' => 0,
  191             'Innodb_log_waits' => 0,
  192             'Innodb_row_lock_time_avg' => 10, // ms
  193             'Innodb_row_lock_time_max' => 50, // ms
  194             'Innodb_row_lock_waits' => 0,
  195 
  196             'Slow_queries' => 0,
  197             'Delayed_errors' => 0,
  198             'Select_full_join' => 0,
  199             'Select_range_check' => 0,
  200             'Sort_merge_passes' => 0,
  201             'Opened_tables' => 0,
  202             'Table_locks_waited' => 0,
  203             'Qcache_lowmem_prunes' => 0,
  204 
  205             'Qcache_free_blocks' =>
  206                 isset($this->data->status['Qcache_total_blocks'])
  207                     ? $this->data->status['Qcache_total_blocks'] / 5
  208                     : 0,
  209             'Slow_launch_threads' => 0,
  210 
  211             // depends on Key_read_requests
  212             // normally lower then 1:0.01
  213             'Key_reads' => isset($this->data->status['Key_read_requests'])
  214                 ? 0.01 * $this->data->status['Key_read_requests'] : 0,
  215             // depends on Key_write_requests
  216             // normally nearly 1:1
  217             'Key_writes' => isset($this->data->status['Key_write_requests'])
  218                 ? 0.9 * $this->data->status['Key_write_requests'] : 0,
  219 
  220             'Key_buffer_fraction' => 0.5,
  221 
  222             // alert if more than 95% of thread cache is in use
  223             'Threads_cached' => isset($this->data->variables['thread_cache_size'])
  224                 ? 0.95 * $this->data->variables['thread_cache_size'] : 0,
  225 
  226             // higher is better
  227             // variable => min value
  228             //'Handler read key' => '> ',
  229         ];
  230     }
  231 
  232     /**
  233      * Returns a list of variable descriptions
  234      *
  235      * @return array
  236      */
  237     private function getDescriptions(): array
  238     {
  239         /**
  240          * Messages are built using the message name
  241          */
  242         return [
  243             'Aborted_clients' => __(
  244                 'The number of connections that were aborted because the client died'
  245                 . ' without closing the connection properly.'
  246             ),
  247             'Aborted_connects' => __(
  248                 'The number of failed attempts to connect to the MySQL server.'
  249             ),
  250             'Binlog_cache_disk_use' => __(
  251                 'The number of transactions that used the temporary binary log cache'
  252                 . ' but that exceeded the value of binlog_cache_size and used a'
  253                 . ' temporary file to store statements from the transaction.'
  254             ),
  255             'Binlog_cache_use' => __(
  256                 'The number of transactions that used the temporary binary log cache.'
  257             ),
  258             'Connections' => __(
  259                 'The number of connection attempts (successful or not)'
  260                 . ' to the MySQL server.'
  261             ),
  262             'Created_tmp_disk_tables' => __(
  263                 'The number of temporary tables on disk created automatically by'
  264                 . ' the server while executing statements. If'
  265                 . ' Created_tmp_disk_tables is big, you may want to increase the'
  266                 . ' tmp_table_size  value to cause temporary tables to be'
  267                 . ' memory-based instead of disk-based.'
  268             ),
  269             'Created_tmp_files' => __(
  270                 'How many temporary files mysqld has created.'
  271             ),
  272             'Created_tmp_tables' => __(
  273                 'The number of in-memory temporary tables created automatically'
  274                 . ' by the server while executing statements.'
  275             ),
  276             'Delayed_errors' => __(
  277                 'The number of rows written with INSERT DELAYED for which some'
  278                 . ' error occurred (probably duplicate key).'
  279             ),
  280             'Delayed_insert_threads' => __(
  281                 'The number of INSERT DELAYED handler threads in use. Every'
  282                 . ' different table on which one uses INSERT DELAYED gets'
  283                 . ' its own thread.'
  284             ),
  285             'Delayed_writes' => __(
  286                 'The number of INSERT DELAYED rows written.'
  287             ),
  288             'Flush_commands'  => __(
  289                 'The number of executed FLUSH statements.'
  290             ),
  291             'Handler_commit' => __(
  292                 'The number of internal COMMIT statements.'
  293             ),
  294             'Handler_delete' => __(
  295                 'The number of times a row was deleted from a table.'
  296             ),
  297             'Handler_discover' => __(
  298                 'The MySQL server can ask the NDB Cluster storage engine if it'
  299                 . ' knows about a table with a given name. This is called discovery.'
  300                 . ' Handler_discover indicates the number of time tables have been'
  301                 . ' discovered.'
  302             ),
  303             'Handler_read_first' => __(
  304                 'The number of times the first entry was read from an index. If this'
  305                 . ' is high, it suggests that the server is doing a lot of full'
  306                 . ' index scans; for example, SELECT col1 FROM foo, assuming that'
  307                 . ' col1 is indexed.'
  308             ),
  309             'Handler_read_key' => __(
  310                 'The number of requests to read a row based on a key. If this is'
  311                 . ' high, it is a good indication that your queries and tables'
  312                 . ' are properly indexed.'
  313             ),
  314             'Handler_read_next' => __(
  315                 'The number of requests to read the next row in key order. This is'
  316                 . ' incremented if you are querying an index column with a range'
  317                 . ' constraint or if you are doing an index scan.'
  318             ),
  319             'Handler_read_prev' => __(
  320                 'The number of requests to read the previous row in key order.'
  321                 . ' This read method is mainly used to optimize ORDER BY … DESC.'
  322             ),
  323             'Handler_read_rnd' => __(
  324                 'The number of requests to read a row based on a fixed position.'
  325                 . ' This is high if you are doing a lot of queries that require'
  326                 . ' sorting of the result. You probably have a lot of queries that'
  327                 . ' require MySQL to scan whole tables or you have joins that'
  328                 . ' don\'t use keys properly.'
  329             ),
  330             'Handler_read_rnd_next' => __(
  331                 'The number of requests to read the next row in the data file.'
  332                 . ' This is high if you are doing a lot of table scans. Generally'
  333                 . ' this suggests that your tables are not properly indexed or that'
  334                 . ' your queries are not written to take advantage of the indexes'
  335                 . ' you have.'
  336             ),
  337             'Handler_rollback' => __(
  338                 'The number of internal ROLLBACK statements.'
  339             ),
  340             'Handler_update' => __(
  341                 'The number of requests to update a row in a table.'
  342             ),
  343             'Handler_write' => __(
  344                 'The number of requests to insert a row in a table.'
  345             ),
  346             'Innodb_buffer_pool_pages_data' => __(
  347                 'The number of pages containing data (dirty or clean).'
  348             ),
  349             'Innodb_buffer_pool_pages_dirty' => __(
  350                 'The number of pages currently dirty.'
  351             ),
  352             'Innodb_buffer_pool_pages_flushed' => __(
  353                 'The number of buffer pool pages that have been requested'
  354                 . ' to be flushed.'
  355             ),
  356             'Innodb_buffer_pool_pages_free' => __(
  357                 'The number of free pages.'
  358             ),
  359             'Innodb_buffer_pool_pages_latched' => __(
  360                 'The number of latched pages in InnoDB buffer pool. These are pages'
  361                 . ' currently being read or written or that can\'t be flushed or'
  362                 . ' removed for some other reason.'
  363             ),
  364             'Innodb_buffer_pool_pages_misc' => __(
  365                 'The number of pages busy because they have been allocated for'
  366                 . ' administrative overhead such as row locks or the adaptive'
  367                 . ' hash index. This value can also be calculated as'
  368                 . ' Innodb_buffer_pool_pages_total - Innodb_buffer_pool_pages_free'
  369                 . ' - Innodb_buffer_pool_pages_data.'
  370             ),
  371             'Innodb_buffer_pool_pages_total' => __(
  372                 'Total size of buffer pool, in pages.'
  373             ),
  374             'Innodb_buffer_pool_read_ahead_rnd' => __(
  375                 'The number of "random" read-aheads InnoDB initiated. This happens'
  376                 . ' when a query is to scan a large portion of a table but in'
  377                 . ' random order.'
  378             ),
  379             'Innodb_buffer_pool_read_ahead_seq' => __(
  380                 'The number of sequential read-aheads InnoDB initiated. This'
  381                 . ' happens when InnoDB does a sequential full table scan.'
  382             ),
  383             'Innodb_buffer_pool_read_requests' => __(
  384                 'The number of logical read requests InnoDB has done.'
  385             ),
  386             'Innodb_buffer_pool_reads' => __(
  387                 'The number of logical reads that InnoDB could not satisfy'
  388                 . ' from buffer pool and had to do a single-page read.'
  389             ),
  390             'Innodb_buffer_pool_wait_free' => __(
  391                 'Normally, writes to the InnoDB buffer pool happen in the'
  392                 . ' background. However, if it\'s necessary to read or create a page'
  393                 . ' and no clean pages are available, it\'s necessary to wait for'
  394                 . ' pages to be flushed first. This counter counts instances of'
  395                 . ' these waits. If the buffer pool size was set properly, this'
  396                 . ' value should be small.'
  397             ),
  398             'Innodb_buffer_pool_write_requests' => __(
  399                 'The number writes done to the InnoDB buffer pool.'
  400             ),
  401             'Innodb_data_fsyncs' => __(
  402                 'The number of fsync() operations so far.'
  403             ),
  404             'Innodb_data_pending_fsyncs' => __(
  405                 'The current number of pending fsync() operations.'
  406             ),
  407             'Innodb_data_pending_reads' => __(
  408                 'The current number of pending reads.'
  409             ),
  410             'Innodb_data_pending_writes' => __(
  411                 'The current number of pending writes.'
  412             ),
  413             'Innodb_data_read' => __(
  414                 'The amount of data read so far, in bytes.'
  415             ),
  416             'Innodb_data_reads' => __(
  417                 'The total number of data reads.'
  418             ),
  419             'Innodb_data_writes' => __(
  420                 'The total number of data writes.'
  421             ),
  422             'Innodb_data_written' => __(
  423                 'The amount of data written so far, in bytes.'
  424             ),
  425             'Innodb_dblwr_pages_written' => __(
  426                 'The number of pages that have been written for'
  427                 . ' doublewrite operations.'
  428             ),
  429             'Innodb_dblwr_writes' => __(
  430                 'The number of doublewrite operations that have been performed.'
  431             ),
  432             'Innodb_log_waits' => __(
  433                 'The number of waits we had because log buffer was too small and'
  434                 . ' we had to wait for it to be flushed before continuing.'
  435             ),
  436             'Innodb_log_write_requests' => __(
  437                 'The number of log write requests.'
  438             ),
  439             'Innodb_log_writes' => __(
  440                 'The number of physical writes to the log file.'
  441             ),
  442             'Innodb_os_log_fsyncs' => __(
  443                 'The number of fsync() writes done to the log file.'
  444             ),
  445             'Innodb_os_log_pending_fsyncs' => __(
  446                 'The number of pending log file fsyncs.'
  447             ),
  448             'Innodb_os_log_pending_writes' => __(
  449                 'Pending log file writes.'
  450             ),
  451             'Innodb_os_log_written' => __(
  452                 'The number of bytes written to the log file.'
  453             ),
  454             'Innodb_pages_created' => __(
  455                 'The number of pages created.'
  456             ),
  457             'Innodb_page_size' => __(
  458                 'The compiled-in InnoDB page size (default 16KB). Many values are'
  459                 . ' counted in pages; the page size allows them to be easily'
  460                 . ' converted to bytes.'
  461             ),
  462             'Innodb_pages_read' => __(
  463                 'The number of pages read.'
  464             ),
  465             'Innodb_pages_written' => __(
  466                 'The number of pages written.'
  467             ),
  468             'Innodb_row_lock_current_waits' => __(
  469                 'The number of row locks currently being waited for.'
  470             ),
  471             'Innodb_row_lock_time_avg' => __(
  472                 'The average time to acquire a row lock, in milliseconds.'
  473             ),
  474             'Innodb_row_lock_time' => __(
  475                 'The total time spent in acquiring row locks, in milliseconds.'
  476             ),
  477             'Innodb_row_lock_time_max' => __(
  478                 'The maximum time to acquire a row lock, in milliseconds.'
  479             ),
  480             'Innodb_row_lock_waits' => __(
  481                 'The number of times a row lock had to be waited for.'
  482             ),
  483             'Innodb_rows_deleted' => __(
  484                 'The number of rows deleted from InnoDB tables.'
  485             ),
  486             'Innodb_rows_inserted' => __(
  487                 'The number of rows inserted in InnoDB tables.'
  488             ),
  489             'Innodb_rows_read' => __(
  490                 'The number of rows read from InnoDB tables.'
  491             ),
  492             'Innodb_rows_updated' => __(
  493                 'The number of rows updated in InnoDB tables.'
  494             ),
  495             'Key_blocks_not_flushed' => __(
  496                 'The number of key blocks in the key cache that have changed but'
  497                 . ' haven\'t yet been flushed to disk. It used to be known as'
  498                 . ' Not_flushed_key_blocks.'
  499             ),
  500             'Key_blocks_unused' => __(
  501                 'The number of unused blocks in the key cache. You can use this'
  502                 . ' value to determine how much of the key cache is in use.'
  503             ),
  504             'Key_blocks_used' => __(
  505                 'The number of used blocks in the key cache. This value is a'
  506                 . ' high-water mark that indicates the maximum number of blocks'
  507                 . ' that have ever been in use at one time.'
  508             ),
  509             'Key_buffer_fraction_%' => __(
  510                 'Percentage of used key cache (calculated value)'
  511             ),
  512             'Key_read_requests' => __(
  513                 'The number of requests to read a key block from the cache.'
  514             ),
  515             'Key_reads' => __(
  516                 'The number of physical reads of a key block from disk. If Key_reads'
  517                 . ' is big, then your key_buffer_size value is probably too small.'
  518                 . ' The cache miss rate can be calculated as'
  519                 . ' Key_reads/Key_read_requests.'
  520             ),
  521             'Key_read_ratio_%' => __(
  522                 'Key cache miss calculated as rate of physical reads compared'
  523                 . ' to read requests (calculated value)'
  524             ),
  525             'Key_write_requests' => __(
  526                 'The number of requests to write a key block to the cache.'
  527             ),
  528             'Key_writes' => __(
  529                 'The number of physical writes of a key block to disk.'
  530             ),
  531             'Key_write_ratio_%' => __(
  532                 'Percentage of physical writes compared'
  533                 . ' to write requests (calculated value)'
  534             ),
  535             'Last_query_cost' => __(
  536                 'The total cost of the last compiled query as computed by the query'
  537                 . ' optimizer. Useful for comparing the cost of different query'
  538                 . ' plans for the same query. The default value of 0 means that'
  539                 . ' no query has been compiled yet.'
  540             ),
  541             'Max_used_connections' => __(
  542                 'The maximum number of connections that have been in use'
  543                 . ' simultaneously since the server started.'
  544             ),
  545             'Not_flushed_delayed_rows' => __(
  546                 'The number of rows waiting to be written in INSERT DELAYED queues.'
  547             ),
  548             'Opened_tables' => __(
  549                 'The number of tables that have been opened. If opened tables is'
  550                 . ' big, your table cache value is probably too small.'
  551             ),
  552             'Open_files' => __(
  553                 'The number of files that are open.'
  554             ),
  555             'Open_streams' => __(
  556                 'The number of streams that are open (used mainly for logging).'
  557             ),
  558             'Open_tables' => __(
  559                 'The number of tables that are open.'
  560             ),
  561             'Qcache_free_blocks' => __(
  562                 'The number of free memory blocks in query cache. High numbers can'
  563                 . ' indicate fragmentation issues, which may be solved by issuing'
  564                 . ' a FLUSH QUERY CACHE statement.'
  565             ),
  566             'Qcache_free_memory' => __(
  567                 'The amount of free memory for query cache.'
  568             ),
  569             'Qcache_hits' => __(
  570                 'The number of cache hits.'
  571             ),
  572             'Qcache_inserts' => __(
  573                 'The number of queries added to the cache.'
  574             ),
  575             'Qcache_lowmem_prunes' => __(
  576                 'The number of queries that have been removed from the cache to'
  577                 . ' free up memory for caching new queries. This information can'
  578                 . ' help you tune the query cache size. The query cache uses a'
  579                 . ' least recently used (LRU) strategy to decide which queries'
  580                 . ' to remove from the cache.'
  581             ),
  582             'Qcache_not_cached' => __(
  583                 'The number of non-cached queries (not cachable, or not cached'
  584                 . ' due to the query_cache_type setting).'
  585             ),
  586             'Qcache_queries_in_cache' => __(
  587                 'The number of queries registered in the cache.'
  588             ),
  589             'Qcache_total_blocks' => __(
  590                 'The total number of blocks in the query cache.'
  591             ),
  592             'Rpl_status' => __(
  593                 'The status of failsafe replication (not yet implemented).'
  594             ),
  595             'Select_full_join' => __(
  596                 'The number of joins that do not use indexes. If this value is'
  597                 . ' not 0, you should carefully check the indexes of your tables.'
  598             ),
  599             'Select_full_range_join' => __(
  600                 'The number of joins that used a range search on a reference table.'
  601             ),
  602             'Select_range_check' => __(
  603                 'The number of joins without keys that check for key usage after'
  604                 . ' each row. (If this is not 0, you should carefully check the'
  605                 . ' indexes of your tables.)'
  606             ),
  607             'Select_range' => __(
  608                 'The number of joins that used ranges on the first table. (It\'s'
  609                 . ' normally not critical even if this is big.)'
  610             ),
  611             'Select_scan' => __(
  612                 'The number of joins that did a full scan of the first table.'
  613             ),
  614             'Slave_open_temp_tables' => __(
  615                 'The number of temporary tables currently'
  616                 . ' open by the slave SQL thread.'
  617             ),
  618             'Slave_retried_transactions' => __(
  619                 'Total (since startup) number of times the replication slave SQL'
  620                 . ' thread has retried transactions.'
  621             ),
  622             'Slave_running' => __(
  623                 'This is ON if this server is a slave that is connected to a master.'
  624             ),
  625             'Slow_launch_threads' => __(
  626                 'The number of threads that have taken more than slow_launch_time'
  627                 . ' seconds to create.'
  628             ),
  629             'Slow_queries' => __(
  630                 'The number of queries that have taken more than long_query_time'
  631                 . ' seconds.'
  632             ),
  633             'Sort_merge_passes' => __(
  634                 'The number of merge passes the sort algorithm has had to do.'
  635                 . ' If this value is large, you should consider increasing the'
  636                 . ' value of the sort_buffer_size system variable.'
  637             ),
  638             'Sort_range' => __(
  639                 'The number of sorts that were done with ranges.'
  640             ),
  641             'Sort_rows' => __(
  642                 'The number of sorted rows.'
  643             ),
  644             'Sort_scan' => __(
  645                 'The number of sorts that were done by scanning the table.'
  646             ),
  647             'Table_locks_immediate' => __(
  648                 'The number of times that a table lock was acquired immediately.'
  649             ),
  650             'Table_locks_waited' => __(
  651                 'The number of times that a table lock could not be acquired'
  652                 . ' immediately and a wait was needed. If this is high, and you have'
  653                 . ' performance problems, you should first optimize your queries,'
  654                 . ' and then either split your table or tables or use replication.'
  655             ),
  656             'Threads_cached' => __(
  657                 'The number of threads in the thread cache. The cache hit rate can'
  658                 . ' be calculated as Threads_created/Connections. If this value is'
  659                 . ' red you should raise your thread_cache_size.'
  660             ),
  661             'Threads_connected' => __(
  662                 'The number of currently open connections.'
  663             ),
  664             'Threads_created' => __(
  665                 'The number of threads created to handle connections. If'
  666                 . ' Threads_created is big, you may want to increase the'
  667                 . ' thread_cache_size value. (Normally this doesn\'t give a notable'
  668                 . ' performance improvement if you have a good thread'
  669                 . ' implementation.)'
  670             ),
  671             'Threads_cache_hitrate_%' => __(
  672                 'Thread cache hit rate (calculated value)'
  673             ),
  674             'Threads_running' => __(
  675                 'The number of threads that are not sleeping.'
  676             ),
  677         ];
  678     }
  679 }