Merging Matomo Analytics from one site into another


I’m trying to merge data from a Matomo site where I’ve imported data from Google Analytics into an existing site on a different Matomo installation.

What I’ve tried doing is exporting all of the archive tables (blob and numeric), re-assigning the site ID, and importing the SQL tables into the existing tables on the other Matomo installation. That worked, but the aggregated analytics (week/month/year) were way off, while the single day analytics were correct. I invalidated the archives and re-generated them on the original Matomo installation, which had the same issue, and that corrected the aggregate data.
However, doing the same on the second installation didn’t help, and all of the data was deleted (except for visits tracked using the container). Is there something I’m missing on how the analytics logs are stored?