I got it…
<?php
/*
yacka yacka yacks
*/
function simpleDP(){
global $wpdb;
$wpdb->query(“DELETE FROM $wpdb->posts
USING $wpdb->posts, $wpdb->posts as vtable
WHERE ($wpdb->posts.ID > vtable.ID)
AND ($wpdb->posts.post_title=vtable.post_title)”);
}
add_action(‘publish_post’, ‘simpleDP’);
function OptimizeDaDatabase(){
global $wpdb;
$wpdb->query(“OPTIMIZE TABLE $wpdb->wp_smartfeed”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->ak_twitter”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->comments”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->links”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->options”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->postmeta”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->posts”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->term_relationships”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->term_taxonomy”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->terms”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->users”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wp_smartfeed”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wpo_campaign”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wpo_campaign_category”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wpo_campaign_feed”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wpo_campaign_post”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wpo_campaign_word”);
$wpdb->query(“OPTIMIZE TABLE $wpdb->wpo_log”);
}
add_action(‘publish_post’, ‘OptimizeDaDatabase’);
?>
and optimizes the tables at the same time.