# High Performance PostgreSQL for Rails: creating index (p. 60)

**URL:** <https://forum.devtalk.com/t/high-performance-postgresql-for-rails-creating-index-p-60/157588>\
**Category:** PragProg Customers\
**Tags:** book-high-performance-postgresql-for-rails, question\
**Created:** [3 June 2024 01:02 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-creating-index-p-60/157588 "2024-06-03T01:02:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abr](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/a/b782af/32.png) [@abr](https://forum.devtalk.com/u/abr)\
**Post date:** [3 June 2024 01:02 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-creating-index-p-60/157588/1 "2024-06-03T01:02:35Z")

</div>

Hi,

I’m reading chapter 3 (B8.0), in particular the part about cloning sequences and indexes to the scrubbed tables. This part confused me:

> Let’s take a look at the UNIQUE index on the users.email column. To create that  
> index again, you’d run the following statement to create on the users\_copy table:

```auto
-- Temporarily adding "2" to the index name,
-- so that it's unique (can remove the "2" later)
CREATE UNIQUE INDEX index_users_on_email2
ON users USING btree (email);

```

Would this not just create a new index on the original table, instead of the `users_copy` table like I want? Have I missed something, or is this a typo?

Cheers

---

<div class="post-metadata">

**Author:** ![andatki](https://forum.devtalk.com/user_avatar/forum.devtalk.com/andatki/32/5332_2.png) [@andatki](https://forum.devtalk.com/u/andatki)\
**Post date:** [3 June 2024 02:06 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-creating-index-p-60/157588/2 "2024-06-03T02:06:04Z")

</div>

Shoot. Good point. As written, yes it would create a second index on the `users` table using that new name with the “2” on the end. However, in this section we’re asking readers to create the index on the `users_copy` table.

In other words, the table name in the `CREATE INDEX` statement should reference the `users_copy` table, not the `users` table.

We’re getting close to the print time for the book, but I’ll ask the editor if we can get this in. Thanks for reporting it!

---

<div class="post-metadata">

**Author:** ![andatki](https://forum.devtalk.com/user_avatar/forum.devtalk.com/andatki/32/5332_2.png) [@andatki](https://forum.devtalk.com/u/andatki)\
**Post date:** [28 June 2024 01:48 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-creating-index-p-60/157588/3 "2024-06-28T01:48:32Z")

</div>

This should be fixed in the final version. Thank you for reporting it.

---

<div class="post-metadata">

**Author:** ![andatki](https://forum.devtalk.com/user_avatar/forum.devtalk.com/andatki/32/5332_2.png) [@andatki](https://forum.devtalk.com/u/andatki)\
**Post date:** [28 June 2024 01:48 UTC](https://forum.devtalk.com/t/high-performance-postgresql-for-rails-creating-index-p-60/157588/4 "2024-06-28T01:48:45Z")

</div>


