[development] optimize table in cron

Piotr Krukowiecki piotr at mallorn.ii.uj.edu.pl
Mon Dec 5 09:06:49 UTC 2005


On Mon, Dec 05, 2005 at 09:19:18AM +0100, B?r Kessels wrote:
> Op maandag 05 december 2005 07:42, schreef Dries Buytaert:
> > On 05 Dec 2005, at 04:29, David K Norman wrote:
> > > Has it ever been discussed to run a query to optimize some of the more
> > > active tables in MySQL during cron.php runs? For example 'OPTIMIZE
> > > TABLE
> > > watchdog;'
> >
> > OPTIMIZE TABLE is a MySQL-ism; it's not ANSI SQL.
> 
> MySQL.inc is not included in the module hooks AFAIK. so adding a hook_cron to 
> mysql.inc is not an option. 
> 
> This could be added in a conditional structure to dba.module

There are some task that should/could be done automatically by drupal
core itself. Besides OPTIMIZE TABLE it'd be nice to making backups 
(database mainly, but maybe files too?) and for PostgreSQL running VACUUM
(http://www.postgresql.org/docs/current/static/maintenance.html)

There are some issues to remember with VACUUM:

- there's autovacuum in 8.1 so we would need to check if it's enabled
- vacuuming could be done by host. I don't know if hosts do vacuuming or
  not
- it should be sheduled at low usage time
- we should make sure not to vacuum the same database from two different
  sites using that database.

Those issues would require at least some page with settings were you
could enable/disable vaccuming and shedule it's time and frequency.


-- 
Piotrek
irc: #debian.pl
Mors Drosophilis melanogastribus!


More information about the development mailing list