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

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:

-- 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

1 Like

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!

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