Re: [PHP-DB] Optimize Tables

2004-05-03 Thread Ng Hwee Hwee
Thanx for this enlightening insight about cron jobs...

just a question.. when i run Optimize.php, i realise that you will echo some
statements. where will these statements be shown? since you put  " >
/dev/null "  instead of  " > /dev/null 2>&1 ", does it mean that your echo
statements will be reflected in an email to me?

thanx.. i'm totally new to cron jobs, but thanx to sebastian's link on
crontab, i'm a little bit more knowledgable now! haha.. would appreciate
more insights! thanx!


- Original Message - 
From: "Uzi Klein" <[EMAIL PROTECTED]>
To: "'Ng Hwee Hwee'" <[EMAIL PROTECTED]>; "'DBList'" <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 6:32 PM
Subject: RE: [PHP-DB] Optimize Tables


> Use a cron job
>
> Like:
>
> 0   0   *   *   *   php Optimize.php > /dev/null
>
>
> This is an example for optimizing every table in all databases on your
mysql
> server.
>
> Optimize.php :
>
>  $db = mysql_connect("host", "user", "pass");
> $sql = "SHOW DATABASES";
> $dbs_result = mysql_query($sql, $db);
> if(mysql_num_rows($dbs_result))
> {
> while($dbs_row=mysql_fetch_assoc($dbs_result))
> {
> $database =  $dbs_row["Database"];
> echo "\n\nOptimizing database $database : \n";
> mysql_select_db($database, $db);
> $sql = "SHOW TABLE STATUS";
> $tbls_result = mysql_query($sql, $db);
> if(mysql_num_rows($tbls_result))
> {
> while($tbls_row=mysql_fetch_assoc($tbls_result))
> {
> $TableName = "`".$tbls_row["Name"]."`";
> $sql = "REPAIR TABLE ".$TableName;
> echo "\n".$sql;
> mysql_query($sql, $db);
> $sql = "OPTIMIZE TABLE ".$TableName;
>             echo "\n".$sql;
> mysql_query($sql, $db);
> }
> }
> }
> }
> echo "\n\n";
> mysql_close($db);
> ?>
>
>
> -Original Message-
> From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 03, 2004 11:19
> To: DBList
> Subject: [PHP-DB] Optimize Tables
>
> Hi,
>
> Is there a way to create a schedule to optimise my MySQL tables
> automatically? The overhead of some of my tables can reach 355,548 bytes
> over 3 working days!
>
> Please help me!
>
> Thanks.
> Hwee
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Optimize Tables

2004-05-03 Thread IMAC, Sebastian Mangelkramer
Am Montag, 3. Mai 2004 11:50 schrieb Ng Hwee Hwee:
> sorry, what do you mean by _cron_  job?
unix-operating-system offers you a great thing called "cron-job`s"
like "sheduled-tasks" under windows.

4 more information follow this link
http://weather.ou.edu/~billston/crontab/

sebastian


>
> I'm hoping to optimise my tables, for example on, every Monday 9.30am.
>
> by the way, is there a problem if I optimise my tables too frequently? i
> mean, i was told not to defragment or format my harddisk too often cos it
> will cause wear and tear to the hardware.. does this apply to
> optimisation of tables? will this be bad for my server then?
>
> thank you so much.
>
> - Original Message -
> From: "Dynamix" <[EMAIL PROTECTED]>
> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; "DBList" <[EMAIL PROTECTED]>
> Sent: Monday, May 03, 2004 4:29 PM
> Subject: Re: [PHP-DB] Optimize Tables
>
> > yep, check http://www.phpclasses.org/browse/package/1527.html
> >
> > And you can run this using a cron job, so it just fit with your needs.
> >
> > Regards,
> > Hatem
> >
> > - Original Message -
> > From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> > To: "DBList" <[EMAIL PROTECTED]>
> > Sent: Monday, May 03, 2004 11:19 AM
> > Subject: [PHP-DB] Optimize Tables
> >
> >
> > Hi,
> >
> > Is there a way to create a schedule to optimise my MySQL tables
> > automatically? The overhead of some of my tables can reach 355,548
> > bytes over 3 working days!
> >
> > Please help me!
> >
> > Thanks.
> > Hwee
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Sebastian Mangelkramer

IMAC - Information & Management Consulting
Blarerstraße 56,   D-78462 Konstanz
Tel. +49 (0)7531 - 90 39-12
Fax +49 (0)7531 - 90 39-47
E-Mail: [EMAIL PROTECTED]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Optimize Tables

2004-05-03 Thread Ng Hwee Hwee
sorry, what do you mean by _cron_  job?

I'm hoping to optimise my tables, for example on, every Monday 9.30am.

by the way, is there a problem if I optimise my tables too frequently? i
mean, i was told not to defragment or format my harddisk too often cos it
will cause wear and tear to the hardware.. does this apply to optimisation
of tables? will this be bad for my server then?

thank you so much.

- Original Message - 
From: "Dynamix" <[EMAIL PROTECTED]>
To: "Ng Hwee Hwee" <[EMAIL PROTECTED]>; "DBList" <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 4:29 PM
Subject: Re: [PHP-DB] Optimize Tables


> yep, check http://www.phpclasses.org/browse/package/1527.html
>
> And you can run this using a cron job, so it just fit with your needs.
>
> Regards,
> Hatem
>
> - Original Message - 
> From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
> To: "DBList" <[EMAIL PROTECTED]>
> Sent: Monday, May 03, 2004 11:19 AM
> Subject: [PHP-DB] Optimize Tables
>
>
> Hi,
>
> Is there a way to create a schedule to optimise my MySQL tables
> automatically? The overhead of some of my tables can reach 355,548 bytes
> over 3 working days!
>
> Please help me!
>
> Thanks.
> Hwee
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Optimize Tables

2004-05-03 Thread Uzi Klein
Use a cron job

Like:

0   0   *   *   *   php Optimize.php > /dev/null


This is an example for optimizing every table in all databases on your mysql
server.

Optimize.php : 




-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 03, 2004 11:19
To: DBList
Subject: [PHP-DB] Optimize Tables

Hi,

Is there a way to create a schedule to optimise my MySQL tables
automatically? The overhead of some of my tables can reach 355,548 bytes
over 3 working days!

Please help me!

Thanks.
Hwee

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Optimize Tables

2004-05-03 Thread Dynamix
yep, check http://www.phpclasses.org/browse/package/1527.html

And you can run this using a cron job, so it just fit with your needs.

Regards,
Hatem

- Original Message - 
From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
To: "DBList" <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 11:19 AM
Subject: [PHP-DB] Optimize Tables


Hi,

Is there a way to create a schedule to optimise my MySQL tables
automatically? The overhead of some of my tables can reach 355,548 bytes
over 3 working days!

Please help me!

Thanks.
Hwee

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Optimize Tables

2004-05-03 Thread Ng Hwee Hwee
Hi,

Is there a way to create a schedule to optimise my MySQL tables automatically? The 
overhead of some of my tables can reach 355,548 bytes over 3 working days!

Please help me!

Thanks.
Hwee