Currently, when we archive, we initialize the
PluginsArchiver twice. Once for core and once for the plugins here: https://github.com/matomo-org/matomo/blob/3.12.0-b2/core/ArchiveProcessor/Loader.php#L101-L117
In the PluginsArchiver's constructor we then first cleanup any possible temp table that already exists ( https://github.com/matomo-org/matomo/blob/3.12.0-b2/core/ArchiveProcessor/PluginsArchiver.php#L70-L71) and then later create the temp table as soon as a
LogAggregator::generateQuery is called.
This means what we do is:
Cleanup temp table for segment ===> This is the step we want to prevent but only if we actually go into the plugins archiver again to archive plugin metrics
This will make segmenting again a bit faster as we avoid running the expensive segment query and avoid lots of inserts...