Deduplicating a Postgres table in situ
Three different ways that don’t need temporary tables
Published in
8 min readMar 28, 2024
Often in relational database systems (RDBMSs), you’ll come across tables that contain duplicate data that needs to be gotten rid of.
One obvious way of doing so is to create a temporary table using SELECT … DISTINCT on your source table, then dropping your source table, before finally…