display_table_stats.twig 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <div id="tablestatistics">
  2. <fieldset>
  3. <legend>{% trans 'Information' %}</legend>
  4. {% if showtable['TABLE_COMMENT'] %}
  5. <p>
  6. <strong>{% trans 'Table comments:' %}</strong>
  7. {{ showtable['TABLE_COMMENT'] }}
  8. </p>
  9. {% endif %}
  10. <a id="showusage"></a>
  11. {% if not tbl_is_view and not db_is_system_schema %}
  12. <table id="tablespaceusage" class="width100 data">
  13. <caption class="tblHeaders">{% trans 'Space usage' %}</caption>
  14. <tbody>
  15. <tr>
  16. <th class="name">{% trans 'Data' %}</th>
  17. <td class="value">{{ data_size }}</td>
  18. <td class="unit">{{ data_unit }}</td>
  19. </tr>
  20. {% if index_size is defined %}
  21. <tr>
  22. <th class="name">{% trans 'Index' %}</th>
  23. <td class="value">{{ index_size }}</td>
  24. <td class="unit">{{ index_unit }}</td>
  25. </tr>
  26. {% endif %}
  27. {% if free_size is defined %}
  28. <tr>
  29. <th class="name">{% trans 'Overhead' %}</th>
  30. <td class="value">{{ free_size }}</td>
  31. <td class="unit">{{ free_unit }}</td>
  32. </tr>
  33. <tr>
  34. <th class="name">{% trans 'Effective' %}</th>
  35. <td class="value">{{ effect_size }}</td>
  36. <td class="unit">{{ effect_unit }}</td>
  37. </tr>
  38. {% endif %}
  39. {% if tot_size is defined and mergetable == false %}
  40. <tr>
  41. <th class="name">{% trans 'Total' %}</th>
  42. <td class="value">{{ tot_size }}</td>
  43. <td class="unit">{{ tot_unit }}</td>
  44. </tr>
  45. {% endif %}
  46. {# Optimize link if overhead #}
  47. {% if free_size is defined
  48. and (tbl_storage_engine == 'MYISAM'
  49. or tbl_storage_engine == 'ARIA'
  50. or tbl_storage_engine == 'MARIA'
  51. or tbl_storage_engine == 'BDB')
  52. or (tbl_storage_engine == 'INNODB' and innodb_file_per_table == true) %}
  53. <tr class="tblFooters print_ignore">
  54. <td colspan="3" class="center">
  55. <a href="sql.php" data-post="{{ url_query }}&amp;pos=0&amp;sql_query=
  56. {{- ('OPTIMIZE TABLE ' ~ backquote(table))|url_encode }}">
  57. {{ get_icon('b_tbloptimize', 'Optimize table'|trans) }}
  58. </a>
  59. </td>
  60. </tr>
  61. {% endif %}
  62. </tbody>
  63. </table>
  64. {% endif %}
  65. {% set avg_size = avg_size is defined ? avg_size : null %}
  66. {% set avg_unit = avg_unit is defined ? avg_unit : null %}
  67. <table id="tablerowstats" class="width100 data">
  68. <caption class="tblHeaders">{% trans 'Row statistics' %}</caption>
  69. <tbody>
  70. {% if showtable['Row_format'] is defined %}
  71. <tr>
  72. <th class="name">{% trans 'Format' %}</th>
  73. {% if showtable['Row_format'] == 'Fixed' %}
  74. <td class="value">{% trans 'static' %}</td>
  75. {% elseif showtable['Row_format'] == 'Dynamic' %}
  76. <td class="value">{% trans 'dynamic' %}</td>
  77. {% else %}
  78. <td class="value">{{ showtable['Row_format'] }}</td>
  79. {% endif %}
  80. </tr>
  81. {% endif %}
  82. {% if showtable['Create_options'] is not empty %}
  83. <tr>
  84. <th class="name">{% trans 'Options' %}</th>
  85. {% if showtable['Create_options'] == 'partitioned' %}
  86. <td class="value">{% trans 'partitioned' %}</td>
  87. {% else %}
  88. <td class="value">{{ showtable['Create_options'] }}</td>
  89. {% endif %}
  90. </tr>
  91. {% endif %}
  92. {% if table_collation is not empty %}
  93. <tr>
  94. <th class="name">{% trans 'Collation' %}</th>
  95. <td class="value">
  96. <dfn title="{{ table_collation.description }}">
  97. {{ table_collation.name }}
  98. </dfn>
  99. </td>
  100. </tr>
  101. {% endif %}
  102. {% if not is_innodb and showtable['Rows'] is defined %}
  103. <tr>
  104. <th class="name">{% trans 'Rows' %}</th>
  105. <td class="value">{{ format_number(showtable['Rows'], 0) }}</td>
  106. </tr>
  107. {% endif %}
  108. {% if not is_innodb
  109. and showtable['Avg_row_length'] is defined
  110. and showtable['Avg_row_length'] > 0 %}
  111. <tr>
  112. <th class="name">{% trans 'Row length' %}</th>
  113. {% set avg_row_length = format_byte_down(showtable['Avg_row_length'], 6, 1) %}
  114. <td class="value">{{ avg_row_length[0] }} {{ avg_row_length[1] }}</td>
  115. </tr>
  116. {% endif %}
  117. {% if not is_innodb
  118. and showtable['Data_length'] is defined
  119. and showtable['Rows'] is defined
  120. and showtable['Rows'] > 0
  121. and mergetable == false %}
  122. <tr>
  123. <th class="name">{% trans 'Row size' %}</th>
  124. <td class="value">{{ avg_size }} {{ avg_unit }}</td>
  125. </tr>
  126. {% endif %}
  127. {% if showtable['Auto_increment'] is defined %}
  128. <tr>
  129. <th class="name">{% trans 'Next autoindex' %}</th>
  130. <td class="value">{{ format_number(showtable['Auto_increment'], 0) }}</td>
  131. </tr>
  132. {% endif %}
  133. {% if showtable['Create_time'] is defined %}
  134. <tr>
  135. <th class="name">{% trans 'Creation' %}</th>
  136. <td class="value">{{ localised_date(showtable['Create_time']|date('U')) }}</td>
  137. </tr>
  138. {% endif %}
  139. {% if showtable['Update_time'] is defined %}
  140. <tr>
  141. <th class="name">{% trans 'Last update' %}</th>
  142. <td class="value">{{ localised_date(showtable['Update_time']|date('U')) }}</td>
  143. </tr>
  144. {% endif %}
  145. {% if showtable['Check_time'] is defined %}
  146. <tr>
  147. <th class="name">{% trans 'Last check' %}</th>
  148. <td class="value">{{ localised_date(showtable['Check_time']|date('U')) }}</td>
  149. </tr>
  150. {% endif %}
  151. </tbody>
  152. </table>
  153. </fieldset>
  154. </div>