Depending on the actual similarity (vertex distribution in particular), you could probably get away with groups over gridded centroids, e.g.
SELECT
ARRAY_AGG(id) AS ids,
ST_Union(geom) AS geom
FROM
data1
GROUP BY
ST_SnapToGrid(ST_Centroid(geom), <grid_size>)
;
where you just need to find a suitable <grid_size>
- start small (say, 0.0001
for degree based CRS), and increase slowly.