Skip to content

Commit f4cc254

Browse files
Yahav BiranBiran
andauthored
In the case of a large table (billions of rows), creating an index may acquire an exclusive lock on the original table hence adding CONCURRENTLY (#391)
Co-authored-by: Biran <[email protected]>
1 parent e2c41fb commit f4cc254

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/pg_partman_howto_native.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ CREATE TABLE public.original_table (
415415
, col3 timestamptz DEFAULT now() not null
416416
, col4 text);
417417
418-
CREATE INDEX ON public.original_table (col3);
418+
CREATE INDEX CONCURRENTLY ON public.original_table (col3);
419+
419420
420421
INSERT INTO public.original_table (col2, col3, col4) VALUES ('stuff', generate_series(now() - '1 week'::interval, now(), '5 minutes'::interval), 'stuff');
421422
```
@@ -428,6 +429,7 @@ CREATE TABLE public.new_partitioned_table (
428429
, col4 text) PARTITION BY RANGE (col3);
429430
430431
CREATE INDEX ON public.new_partitioned_table (col3);
432+
431433
```
432434
You'll notice I did not set "col1" as a primary key here. That is because we cannot.
433435
```

0 commit comments

Comments
 (0)