Skip to content

Commit c1dc3d6

Browse files
committed
Drop invalid indexes concurrently when reindexing
The `DROP INDEX` query would lock the whole table with an `ACCESS EXCLUSIVE` lock and could cause queries to fail unexpectedly. Closes #1247
1 parent 3326dcb commit c1dc3d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/oban/plugins/reindexer.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ defmodule Oban.Plugins.Reindexer do
154154
AND NOT indisvalid
155155
AND starts_with(relname, 'oban_jobs')
156156
LOOP
157-
EXECUTE format('DROP INDEX %s.%s', rec.namespace, rec.relname);
157+
EXECUTE format('DROP INDEX CONCURRENTLY %s.%s', rec.namespace, rec.relname);
158158
END LOOP;
159159
END $$
160160
"""

0 commit comments

Comments
 (0)