Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating docs. Added Example to README file

  • Loading branch information...
commit cf3ef9a3487fae6d92f7223730bddd64001ee5bd 1 parent 59efeb1
@keithf4 authored
Showing with 18 additions and 3 deletions.
  1. +15 −0 README.md
  2. +3 −3 doc/pg_partman.md
View
15 README.md
@@ -5,6 +5,21 @@ Still in early development, so not actually in extension format yet. Run install
cd pg_partman
psql < install.sql
+EXAMPLE
+-------
+
+First create a parent table with an appropriate column type for the partitioning you will do. Here's one with a columns that can be used for either
+
+ CREATE schema test;
+ CREATE TABLE test.part_test (col1 serial, col2 text, col3 timestamptz DEFAULT now());
+
+If you're looking to do time-based partitioning, and will only be inserting new data, time-static is an appropriate choice. Just run the create_parent() function with the appropriate parameters
+
+ SELECT part.create_parent('test.part_test', 'col3', 'time-static', 'daily');
+
+This will turn your table into a parent table and premake 3 future partitions. To make new partitions for time-based partitioning, run the run_maintenance() function. Ideally, you'd run this as a cronjob to keep new partitions premade in preparation of new data.
+
+This should be enough to get you started. Please see the partman.md file in the doc folder for more information on the types of partitioning supported and what the columns in the create_parent() function mean.
LICENSE AND COPYRIGHT
-------------------
View
6 doc/pg_partman.md
@@ -11,9 +11,9 @@ Extension to help make managing time or serial id based table partitioning easie
* Third column (p_type) is one of 4 values to set the partitioning type that will be used
> **time-static** - Trigger function inserts only into specifically named partitions (handles data for current partition, 2 partitions ahead and 1 behind). Cannot handle inserts to parent table outside the hard-coded time window. Function is kept up to date by run_maintenance() function. Ideal for high TPS tables that get inserts of new data only.
- > **time-dynamic** - Trigger function can insert into any child partition based on the value of the control column. More flexible but not as efficient as time-static. Be aware that if the appropriate partition doesn't yet exist for the data inserted, the insert will fail. This applies for data before the lowest partition and higher than the greatest premade partition.
- > **id-static** - Same functionality as time-static but for a numeric range instead of time. When the id value has reached 50% of the max value for that partition, it will automatically create the next partition in sequence if it doesn't yet exist. Does NOT require run_maintenance() function to be run separately.
- > **id-dynamic** - Same functionality and limitations as time-dynamic but for a numeric range instead of time. Uses same 50% rule as id-static to create future partitions. Does NOT require run_maintenance() function to be run separately.
+ > **time-dynamic** - Trigger function can insert into any child partition based on the value of the control column. More flexible but not as efficient as time-static. Be aware that if the appropriate partition doesn't yet exist for the data inserted, the insert will fail. This applies for data before the lowest partition and higher than the greatest premade partition.
+ > **id-static** - Same functionality as time-static but for a numeric range instead of time. When the id value has reached 50% of the max value for that partition, it will automatically create the next partition in sequence if it doesn't yet exist. Does NOT require run_maintenance() function to create new partitions.
+ > **id-dynamic** - Same functionality and limitations as time-dynamic but for a numeric range instead of time. Uses same 50% rule as id-static to create future partitions. Does NOT require run_maintenance() function to create new partitions.
* Fourth parameter (p_interval) is the time or numeric range interval for each partition. Supported values are:
Please sign in to comment.
Something went wrong with that request. Please try again.