One thing I might suggest is to queue up your inserts, then use the extended
insert syntax to populate several records at once in a single INSERT instead
of 12 separate ones. I believe you can alter the /etc/my.cnf file to play
more 'nice' as far as priorities and memory, but I've never touched it
> -Original Message-
> From: Ryan Marks [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 11, 2003 6:45 PM
> To: PHP-DB
> Subject: [PHP-DB] Cronjob
>
> Hello all,
>
> I have a cronjob that runs a PHP script against MySQL. The
> script takes 5
> minutes to process 4000 records (approximately 12 records per
> second). Here
> are the top two entries from top:
> PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME
> CPU COMMAND
> 8671 mysql 25 0 20172 19M 2000 R97.8 3.9 2:02
> 0 mysqld
> 8670 appmgr15 0 2088 2088 1424 S 2.2 0.4 0:03 0 php
>
> Is there a way that I can slow down the script so mysqld does
> not bog the
> machine down.
>
> Here is a snippet of code. The function is called by the cronjob.
>
> function rank_mailbox_current($company_ID){
> $query = "select app_ID from mailbox where company_ID =
> \"$company_ID\"
> and deleted_date = 0 order by mailbox.ID desc";
> $result=query_database($query);
>
> while ($row = mysql_fetch_assoc($result)){
> $app_ID = $row["app_ID"];
> $rank_of_app=rank_app($app_ID,$company_ID);
> }
> }
>
>
> Server: P-IV 2.4GHz, 512 DDRAM, RedHat 9
> PHP Version 4.3.1
> MySQL 4.0.3
>
> Thanks,
> Ryan
>
> --
> 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