Question

I am just wondering what is the correct behaviour when creating concurrent indexes in Rails.

I am using this in my migration file:

disable_ddl_transaction!

def change
    add_index :table_name, :field_name, algorithm: :concurrently
end

This should create a postgres concurrent index.

My question is: When running rake db:migrate Is the correct behaviour to wait for the creation of the index? I mean, the migration will wait until the index is created? Or it should end and delegate postgres that responsibility?

P.S. It is a really big index.

Was it helpful?

Solution

I found out it is the correct behavior. Regardless the migration is waiting, the index will be created concurrently as expected.

Writes and reads are allowed in creation time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top