Looking possibly like indexing is part of the issue at the moment.
When I added an array_agg(id_1) in the group by, one of the 'DK' groups had 9, one had 16.
I wrote a script to scan the text dump and counted 25 records with the "name" field value of 'DK'
After the restore which includes the indexes, "count(*) from big_table where name = 'DK';" uses the index which starts
with"name" and returns 9.
Dropping that index and running it again returns 25.
I re-created the index...
create index on big_table (name, id_1, id_2);
...and count(*) goes back to returning 9 again.
and group by sees those 9 as one group and the other 16 as a different group.
Will get back to this sometime tomorrow as my brain has now melted.