Huge Database Issue With wp_mainwp_stream_and meta wp_mainwp_stream

The two database tables below on all the satellite sites are getting extremely loaded up and we are getting complaints from customers because they’re hosting company is shutting them down because the database is too big.

How can these be cleared remotely or stop the massive increase?

wp_mainwp_stream_meta
wp_mainwp_stream

Hey @cher

Those two tables belong to the MainWP Child Reports plugin and they can be cleared from the Child Reports settings in the WP Admin of a child site (https://your-child-site.com/wp-admin/options-general.php?page=mainwp-reports-settings).

Unfortunately, it is not possible to remotely delete these entries via the MainWP Dashboard.

To reduce the size of the tables in the future, consider lowering the number of days for which the records are kept. This can be done on the same page at the top:

Wow so you have to go into each and every website and do this?

At this time, these settings cannot be controlled via the Dashboard.

So, unfortunately, you would have to change these settings in WP Admin on each of the child sites.

This is absolutely horrible. There are hundreds and hundreds of websites that are just getting clogged with database information that is not useful. Major major flaw in this reporting plugin.

Hi @bojan,

I’d think something should be possible with the Code Snippets or Bulk Settings Manager extensions?

BSM might be cumbersome due to potential issues with nonces, but I am looking into the code snippet possibility right now.

1 Like

@cher @josklever

Using the Code Snippets extension and this code snippet, you can remove all rows from wp_mainwp_stream_meta and wp_mainwp_stream tables.

global $wpdb;
$wpdb->query( "TRUNCATE TABLE {$wpdb->mainwp_stream}" ); 
$wpdb->query( "TRUNCATE TABLE {$wpdb->mainwp_streammeta}" );

Note that this will delete all records in these two tables, which means that the Pro Reports reports will not have any information about events prior to this deletion.

As always, please try the snippet on a subset of your child sites and make sure you have DB backups.

When running the script, make sure to select Return info from Child Sites.

Would be better to create a snippets that change the default setting from 100 days to 31 as most reports run monthly.

This snippet should do the trick.

global $wpdb;

$option = get_option( 'wp_mainwp_stream' );

if ( $option && isset( $option['general_records_ttl'] ) ) {
    $option['general_records_ttl'] = 31; // New desired value (e.g., 31 days)

    update_option( 'wp_mainwp_stream', $option );
}

As with the previous snippet, make sure to select Return info from Child Sites.

3 Likes