Image by Author (Dalle-3)

Deduplicating a Postgres table in situ

Three different ways that don’t need temporary tables

Thomas Reid
Level Up Coding
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…

--

--

A data engineer , specialising in the AWS cloud with particular interest in AI, serverless and the energy, finance and insurance sectors