postgresql Postgres Tip and Tricks Delete duplicate records from postgres table


Example

DELETE 
    FROM <SCHEMA_NAME>.<Table_NAME> 
WHERE 
    ctid NOT IN
        (
        SELECT 
            MAX(ctid) 
        FROM 
            <SCHEMA_NAME>.<TABLE_NAME> 
        GROUP BY 
            <SCHEMA_NAME>.<TABLE_NAME>.*
        )
;