Postgres: PARTITION BY HASH fillfactor

87 Views Asked by At

I want to create a table where I want to partition by hash on one column and then set fillfactor=80

The script looks like below

CREATE TABLE test1 
(
  col1 int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  col2 varchar NULL,
  col3 date   null
)
PARTITION BY HASH (col3);

create table p1 
  partition of test1 
  WITH (fillfactor=80);

But I am getting below error

ERROR:  syntax error at or near "WITH"

LINE 13: WITH (fillfactor=80);

Is it possible to do partition by hash and set fillfactor? Or is there an another way to set fillfactor. Please help

1

There are 1 best solutions below

0
On BEST ANSWER

You are missing the for values part of the partition definition:

create table p1 
  partition of test1 
  FOR VALUES WITH (MODULUS 4, REMAINDER 0);
  WITH (fillfactor=80);