README.md in pgslice-0.4.0 vs README.md in pgslice-0.4.1

- old
+ new

@@ -90,12 +90,24 @@ ```sh pgslice prep visits created_at month ``` ```sql +-- Postgres 10 + BEGIN; +CREATE TABLE visits_intermediate (LIKE visits INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING STORAGE INCLUDING COMMENTS) PARTITION BY RANGE (created_at); + +COMMENT ON TABLE visits_intermediate is 'column:created_at,period:day'; + +COMMIT; + +-- Postgres 9.6 and below + +BEGIN; + CREATE TABLE visits_intermediate (LIKE visits INCLUDING ALL); CREATE FUNCTION visits_insert_trigger() RETURNS trigger AS $$ BEGIN @@ -115,12 +127,38 @@ ```sh pgslice add_partitions visits --intermediate --past 1 --future 1 ``` ```sql +-- Postgres 10 + BEGIN; +CREATE TABLE visits_201608 PARTITION OF visits_intermediate FOR VALUES FROM ('2016-08-01') TO ('2016-09-01'); + +ALTER TABLE visits_201608 ADD PRIMARY KEY (id); + +CREATE INDEX ON visits_201608 USING btree (user_id); + +CREATE TABLE visits_201609 PARTITION OF visits_intermediate FOR VALUES FROM ('2016-09-01') TO ('2016-10-01'); + +ALTER TABLE visits_201609 ADD PRIMARY KEY (id); + +CREATE INDEX ON visits_201609 USING btree (user_id); + +CREATE TABLE visits_201610 PARTITION OF visits_intermediate FOR VALUES FROM ('2016-10-01') TO ('2016-11-01'); + +ALTER TABLE visits_201610 ADD PRIMARY KEY (id); + +CREATE INDEX ON visits_201610 USING btree (user_id); + +COMMIT; + +-- Postgres 9.6 and below + +BEGIN; + CREATE TABLE visits_201608 (CHECK (created_at >= '2016-08-01'::date AND created_at < '2016-09-01'::date)) INHERITS (visits_intermediate); ALTER TABLE visits_201608 ADD PRIMARY KEY (id); @@ -337,10 +375,10 @@ To use master, run: ```sh gem install specific_install -gem specific_install ankane/pgslice +gem specific_install https://github.com/ankane/pgslice.git ``` ## Docker ```sh