Is there a way that this unique index has allowed duplicate rows? I thought maybe there are some extra space characters, but I can't find them.
=> select *, length(keyword), length(country), length(language) from keyword where id in (4588076, 4951423);
id | keyword | seed_id | source | search_count | country | language | volume | cpc | competition | modified_on | violation | revenue | length | length | length
---------+---------------------+---------+--------+--------------+---------+----------+--------+------+-------------+-------------+-----------+---------+--------+--------+--------
4588076 | power wallet review | | SPYFU | 0 | | | 70 | 0.11 | 0.31 | | | | 19 | |
4951423 | power wallet review | | SPYFU | 2 | | | 70 | 0.11 | 0.31 | | | | 19 | |
(2 rows)
The index is
"keyword_keyword_country_language" UNIQUE, btree (keyword, country, language)
PostgreSQL 9.5.3
OK I was planning to remove the other two columns, but I thought I would test the keyword
column and found this:
=> select k1.id, k1.keyword, k2.id, k2.keyword, k1.keyword=k2.keyword from keyword k1, keyword k2 where k1.id=4588076 and k2.id=4951423;
id | keyword | id | keyword | ?column?
---------+---------------------+---------+---------------------+----------
4588076 | power wallet review | 4951423 | power wallet review | f