I have a postgres table with 3 columns that has 4 million rows and growing. When I created the table I intended to create a btree index on one of the columns, but I forgot to do so. I can use the CREATE INDEX command to create the index now, but I think that will lock up the db. Since I have data coming in every second, I would like to avoid that. I noticed that there is an option called CONCURRENTLY. Is that what I should use? Does it have any other effects that I should be aware of?
Thanks!
Yes you can use CREATE INDEX CONCURRENTLY idx_xyz ON sometable(key_a, key_b);
However caveats apply: you have to look yourself, whether it succeded, and possibly re-try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With