# Restore fails - could not create unique index

**URL:** https://meta.discourse.org/t/restore-fails-could-not-create-unique-index/151380
**Category:** Self-hosting
**Created:** [13 במאי,‏ 2020,‏ 8:29pm UTC](https://meta.discourse.org/t/restore-fails-could-not-create-unique-index/151380 "2020-05-13T20:29:04Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![Wingtip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wingtip/32/102039_2.png) [@Wingtip](https://meta.discourse.org/u/Wingtip)
#### Post date: [18 במאי,‏ 2020,‏ 6:21pm UTC](https://meta.discourse.org/t/restore-fails-could-not-create-unique-index/151380/17 "2020-05-18T18:21:48Z")

</div>

Removing those two duplicates was successful, but subsequently rebuilding indices threw up new errors. Is this a major problem? How do we fix, delete that search 3433 row?

```plaintext
[1] pry(main)> IncomingReferer.find(44231).destroy
=> #<IncomingReferer:0x000055734c65d8e8 id: 44231, path: "/m/search", incoming_domain_id: 4>
[2] pry(main)> IncomingReferer.find(42228).destroy
=> #<IncomingReferer:0x000055734cd81a70 id: 42228, path: "/m/search", incoming_domain_id: 26>

```

```plaintext
postgres=# \connect discourse
You are now connected to database "discourse" as user "postgres".
discourse=# REINDEX SCHEMA CONCURRENTLY public;
WARNING: cannot reindex invalid index "public.incoming_referers_pkey_ccnew" concurrently, skipping
WARNING: cannot reindex invalid index "public.index_incoming_referers_on_path_and_incoming_domain_id_ccnew" concurrently, skipping
WARNING: cannot reindex invalid index "pg_toast.pg_toast_2782645_index_ccnew" concurrently, skipping
ERROR: could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id_ccnew1"
DETAIL: Key (path, incoming_domain_id)=(/search/, 3433) is duplicated.
CONTEXT: parallel worker

```

---

_[View the full topic](https://meta.discourse.org/t/restore-fails-could-not-create-unique-index/151380)._
