Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The docs states...</p> <p>(<a href="http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html" rel="nofollow">optimize reference</a>)</p> <blockquote> <p>OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows (tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns). Deleted rows are maintained in a linked list and subsequent INSERT operations reuse old row positions. You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file. After extensive changes to a table, this statement may also improve performance of statements that use the table, sometimes significantly.</p> </blockquote> <p>When operations have been performed performance is enhanced by using the 'OPTIMIZE' command.</p> <p>(<a href="http://dev.mysql.com/doc/refman/5.0/en/flush.html" rel="nofollow">flush reference</a>)</p> <blockquote> <p>FLUSH TABLES has several variant forms. FLUSH TABLE is a synonym for FLUSH TABLES, except that TABLE does not work with the WITH READ LOCK variant.</p> </blockquote> <p>Using the 'FLUSH TABLE' command vs. 'FLUSH TABLES' there is no READ LOCK performed.</p> <p>(<a href="http://dev.mysql.com/doc/refman/5.1/en/repair-table.html" rel="nofollow">repair reference</a>)</p> <blockquote> <p>Normally, you should never have to run REPAIR TABLE. However, if disaster strikes, this statement is very likely to get back all your data from a MyISAM table. If your tables become corrupted often, you should try to find the reason for it, to eliminate the need to use REPAIR TABLE. See Section C.5.4.2, “What to Do If MySQL Keeps Crashing”, and Section 13.5.4, “MyISAM Table Problems”.</p> </blockquote> <p>It is my understanding here that if the 'REPAIR TABLE' command is run consistantly the condition concerning large records created would be eliminated as constant maintances is performed. If I am wrong I would like to see benchmarks as my own attempts have not shown anything too detrimental, although the record sets have been under the 10k mark.</p> <p>Here is the pice of code that is being used and @codedev is asking about...</p> <pre><code>class db { protected static $dbconn; // rest of database class public function index($link, $database) { $obj = $this-&gt;query('SHOW TABLES'); $results = $this-&gt;results($obj); foreach ($results as $key =&gt; $value){ if (isset($value['Tables_in_'.$database])){ $this-&gt;query('REPAIR TABLE '.$value['Tables_in_'.$database]); $this-&gt;query('OPTIMIZE TABLE '.$value['Tables_in_'.$database]); $this-&gt;query('FLUSH TABLE '.$value['Tables_in_'.$database]); } } } public function __destruct() { $this-&gt;index($this-&gt;dbconn, $this-&gt;configuration['database']); $this-&gt;close(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload