Les tables d’une base MySql se fragmentent, surtout celles qui subissent beaucoup de modifications. Comme la fragmentation d’un disque dur, cela provoque des ralentissemnets sur les accés base. Il faut donc optimiser les tables.
Pour réorganiser les lignes fragmentées et éliminer l’espace perdu par les effacements et les modifications de lignes, vous pouvez exécuter l’utilitaire myisamchk
en mode de restauration :
shell> myisamchk -r tbl_name
Vous pouvez optimiser une table de la même façon que vous le faîtes avec la commande SQL OPTIMIZE TABLE
. OPTIMIZE TABLE effectue une réparation de la table, et une analyse des index, puis trie l’arbre d’index pour accélérer les recherches de clés.
Pour optimiser en automatique vos tables, voici un script PHP que vous pourrez mettre en Cron. Ce script optimise seulement les tables qui en ont besoin. Inutile en effet d’optimiser toutes les tables de vos bases.
< ?php
echo '' . "\n\n";
set_time_limit( 160 );
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
//Connection variables (A MODIFIER):
$h = 'localhost';
$u = 'root';
$p = "MON_PASSWORD";
//
$dummy_db = 'mysql';
/*The php->mysql API needs to connect to a database even when executing scripts like this.
If you got an error from this(permissions),
just replace this with the name of your database*/
$db_link = mysql_connect($h,$u,$p);
$res = mysql_db_query($dummy_db, 'SHOW DATABASES', $db_link) or die('Could not connect: ' . mysql_error());
echo 'Found '. mysql_num_rows( $res ) . ' databases' . "\n";
$dbs = array();
while ( $rec = mysql_fetch_array($res) )
{
$dbs [] = $rec [0];
}
foreach ( $dbs as $db_name )
{
echo "Database : $db_name \n\n";
$res = mysql_db_query($dummy_db, "SHOW TABLE STATUS FROM `" . $db_name . "`", $db_link) or die('Query : ' . mysql_error());
$to_optimize = array();
while ( $rec = mysql_fetch_array($res) )
{
if ( $rec['Data_free'] > 0 )
{
$to_optimize [] = $rec['Name'];
echo $rec['Name'] . ' needs optimization' . "\n";
}
}
if ( count ( $to_optimize ) > 0 )
{
foreach ( $to_optimize as $tbl )
{
mysql_db_query($db_name, "OPTIMIZE TABLE `" . $tbl ."`", $db_link );
}
}
}
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 6);
echo 'Parsed in ' . $total_time . ' secs' . "\n\n";
?>
posicionamiento web
Regards for helping out, superb info.
Metrofin
metformin https://metformin.pro/
metformin price in mexico
Metrofin
where can i get metformin https://metformin.pro/
metformin canada brand name
온라인홀덤
The Texas Hold’em Information Community in Korea https://machmark.io
巨乳ラブドール
A thoughtful insight and ideas I will use on my blog. You’ve obviously spent some time on this. Congratulations
senegal vs england
Could not disagree with the main ideas. Wonder how things will develop over the coming years.
reparaciones electricas
I imagine so. Very good stuff, I agree totally.
luz energia solar
Amazing! Your site has quite a few comment posts. How did you get all of these bloggers to look at your site I’m envious! I’m still studying all about posting articles on the net. I’m going to view pages on your website to get a better understanding how to attract more people. Thank you!
portugal vs spain live stream
You are good writer. Thank you.
デリバリー リアル ドール
Makes sense to me.
Pharmacy
canada prescriptions online https://noprescriptioncanada.shop/
on line pharmacy with no perscriptions
Products with good discounts
A wholly agreeable point of view, I think primarily based on my own experience with this that your points are well made, and your analysis on target.
شركات شحن من جدة الي الأردن
This is something that will need all of our combined efforts to address.
CNN Live Stream - 24/7 News TV Streaming
How long does it take you to write an article like this?
john spencer ellis location
While this issue can vexed most people, my thought is that there has to be a middle or common ground that we all can find. I do value that you’ve added pertinent and sound commentary here though. Thank you!
chuong trinh dinh cu canada
Great resources and tips for families here.
Innovation Center
Like the way you’ve outlined things. Easy to follow. Not cluttered.
m3gan streaming
Keep it up!. I usually don’t post in Blogs but your blog forced me to, amazing work.. beautiful A rise in An increase in An increase in.
Best Iptv Provider
I like your style!
Marketing Bobby
Clear, concise and easy to access.
men's health clinic for ED treatment
Please let us know when you plan to publish your book!
buy cipro online
where can i buy cipro online
buy cipro
free codes for mtg arena
It’s a comprehensive, yet fast read.
lifelike sex dolls
Thanks for a Interesting item; I enjoyed it very much. Regards Sang Magistrale
the whale
Your resources are well developed.
EdPills
medicine for impotence https://edpills.science/
best ed treatment
reformas online precios
When we look at these issues, we know that they are the key ones for our time.
presupuestos instalaciones fontaneria pisos
Hiya, I am really glad I have found this information. Nowadays bloggers publish only about gossip and net stuff and this is actually frustrating.
read this forum
Simply wish to say the frankness in your article is surprising.
DrugOver
epinephrine over the counter https://drugsoverthecounter.com/
over the counter antihistamine
best hemorrhoid treatment over the counter
over the counter muscle relaxers
over the counter antihistamine
smoking shops
Incredible will alter your life right!
interior decor
Having an interior designer is incredibly important since they have the knowledge and experience to help transform a space into something functional and aesthetically pleasing. Interior designers know how to balance colour, texture, furniture, and other design elements to create the desired look. They are creative problem solvers and can work their magic in any space from small closets to large outdoor decks. With an expert’s eye for detail, your own ideas can be refined and executed perfectly, elevating your space both functionally and aesthetically. Thank you for providing this content and helping us recognize the importance of hiring an interior designer!
over the counter antidepressants
best over the counter appetite suppressant
over the counter uti medicine
blue quartz stone
I really believe you will do well in the future I appreciate everything you have added to my knowledge base.
air conditioning
Thank you for this great piece of content. Best Regards
birthday cakes
Easily, the post is really the greatest on this laudable topic. I concur with your conclusions and will thirstily look forward to your future updates. Saying thank will not just be sufficient, for the wonderful c lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Solid work and much success in your business enterprise!
buy rdp online
With this issue, it’s important to have someone like you with something to say that really matters.
home decor ideas
With this issue, it’s important to have someone like you with something to say that really matters.
tours to turkey
Easily, the post is really the greatest on this laudable topic. I concur with your conclusions and will thirstily look forward to your future updates. Saying thank will not just be sufficient, for the wonderful c lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Solid work and much success in your business enterprise!
cbowl
I really love this article.
Jikudpol
earch our drug database. drug information and news for professionals and consumers.
https://avodart.science/ cost avodart no prescription
Actual trends of drug. Some trends of drugs.
Jikudpol
Read information now. Best and news about drug.
https://mobic.store how can i get generic mobic price
Everything what you want to know about pills. Generic Name.
EdOnline
Medscape Drugs & Diseases. Read information now.
https://edonlinefast.com
drug information and news for professionals and consumers. Long-Term Effects.
FastCanadian
Medicament prescribing information. Long-Term Effects.
https://canadianfast.com/
Medscape Drugs & Diseases. Drug information.
FastCanadian
Long-Term Effects. Long-Term Effects.
https://canadianfast.com/
Commonly Used Drugs Charts. Commonly Used Drugs Charts.
online drugstore coupon
online canadian pharcharmy
FastCanadian
Read here. Get here.
https://canadianfast.com/
Comprehensive side effect and adverse reaction information. Cautions.
FastCanadian
Get here. Comprehensive side effect and adverse reaction information.
https://canadianfast.com/
Some trends of drugs. Actual trends of drug.
trailer repair shop
Begin sensation outstanding today by living the life that you have actually always wanted!