1
irmtfan
server seems to be down by running a script
  • 2006/5/19 2:27

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


i wrote a very little script to delete all unreaded pms after 30 days.running this with cronjob everyday:

define("user""");
define("pass""");
define("host""localhost");
define("db""");

$cxn mysql_connect(host ,userpass);
mysql_select_db(db);

$delete_time time() - ( 30 24 60 60 );  // 30 days/month * 24 hrs/day
// * 60 minutes/hour * 60 seconds/min.

$sql "DELETE from `xoops_priv_msgs` WHERE `read_msg` = '0' AND `msg_time` < '$delete_time'";
//This script would delete everything older than 30 days that has been not read.

$result mysql_query($sql$cxn);
?>



xoops_priv_msgs table size is about 300 Mb.
what can i do to prevent server heavy loading?

2
McNaz
Re: server seems to be down by running a script
  • 2006/5/19 8:18

  • McNaz

  • Just can't stay away

  • Posts: 574

  • Since: 2003/4/21


I wonder if adding an index to column msg_time would speed up your query?

3
irmtfan
Re: server seems to be down by running a script
  • 2006/5/19 14:36

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Thanks...
and how to add this index?
im realy newbie

4
Will_H
Re: server seems to be down by running a script
  • 2006/5/19 14:40

  • Will_H

  • Friend of XOOPS

  • Posts: 1786

  • Since: 2004/10/10


I wonder if it would be easier to route the task to the default XOOPS pruner.

Login

Who's Online

289 user(s) are online (54 user(s) are browsing Support Forums)


Members: 0


Guests: 289


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits