Whilst this may not be as effective a delete statement (it could take marginally longer to process), it does save precious memory - which means a lot when using boost in very large systems...
Basically we could use the $sql_where variable from the initial select statement, which is still available at this point, to selectively delete from the poller_output_boost table. This does away with the need of creating a temporary table and inserting all of the data into that table, freeing up that little more memory for the boost data itself:
Code: Select all
/* remove the entries from the table */
if ($ok_to_delete) {
if (!$single_local_data_id) {
/* delete the records in bulk */
db_execute("DELETE FROM `poller_output_boost` $sql_where");
} else {
db_execute("DELETE FROM `poller_output_boost`
WHERE local_data_id=$orig_local_data_id");
}
}
This should only delete those records that have been committed to RRD files within this boost_process_poller_output - thus effectively achieving the same result as deleting anything existing in $results (since $results is simply the result of a SELECT statement using this same $sql_where).
Any thoughts or comments appreciated.
[Edit]
Performance-wise this doesn't seem to affect too much in testing:
Using a direct DELETE (preserving memory):
02/17/2009 04:21:31 PM - SYSTEM BOOST STATS: Time:1807.6645 RRDUpdates:2808330
Using rcaston temporary table:
02/17/2009 02:16:14 PM - SYSTEM BOOST STATS: Time:1808.7236 RRDUpdates:2804983