I have table text_table
in PostgreSQL 12 database with only 2 columns: text1
and text2
.
There is an idx_text1
index on the text1
column.
For example:
text1 text2
----------------------
1 str1 one
2 str2 two
3 str3 three
4 str2 two
5 str1 seven
6 str4 seven
7 str3 three
How do I remove all duplicate rows (with exact match of values in both columns)?
In the example above, rows 4 and 7 (or 2 and 3) need to be deleted from the table.
I would like to find the fastest way with an SQL query.