I am trying to dissolve polygons based on a column type using PostGIS 10.4. I am pre-compiling tables, so time requirements are not really an issue. ST_Union does almost everything that I want straight out of the box. However, the ST_Union is has left lots of artifact lines inside the polygon as seen in the pictures below. Is anyone aware of a way to remove the lines inside the polygons? I am not sure if there is a better way to make the union call or rather to clean the polygons up after the union.
INSERT into new_table (count_field, geom)
SELECT count_comp, ST_Union(geom) as geom
FROM old_table
GROUP BY count_field;

ST_NumInteriorRingsand see if they have plenty. you can get the outer ring as linestring withST_ExteriorRingor a set of all rings withST_DumpRings(useST_MakePolygonwith either to get back polygons). this get's more complicated if any of those rings are invalid. see this excellent blog on the topic. – geozelot Jun 16 '18 at 09:58