README.md in pgslice-0.2.3 vs README.md in pgslice-0.3.0

- old
+ new

@@ -252,14 +252,21 @@ ```sh pgslice unswap <table> ``` -## App Changes +## App Considerations This set up allows you to read and write with the original table name with no knowledge it’s partitioned. However, there are a few things to be aware of. +### Writes + +If you use `INSERT` statements with a `RETURNING` clause (as frameworks like Rails do), you’ll no longer receive the id of the newly inserted record(s) back. If you need this, you can either: + +1. Insert directly into the partition +2. Get the value after the insert with `SELECT CURRVAL('sequence_name')` + ### Reads When possible, queries should include the column you partition on to limit the number of partitions the database needs to check. For instance, if you partition on `created_at`, try to include it in queries: ```sql @@ -275,17 +282,10 @@ ```sql SHOW constraint_exclusion; ``` -### Writes - -If you use `INSERT` statements with a `RETURNING` clause (as frameworks like Rails do), you’ll no longer receive the id of the newly inserted record back. If you need this, you can either: - -1. Insert directly into the partition -2. Get the value after the insert with `SELECT CURRVAL('sequence_name')` - ## One Off Tasks You can also use pgslice to reduce the size of a table without partitioning by creating a new table, filling it with a subset of records, and swapping it in. ```sh @@ -306,9 +306,18 @@ ```sh gem install specific_install gem specific_install ankane/pgslice ``` + +## Docker + +```sh +docker build -t pgslice . +alias pgslice="docker run --rm -e PGSLICE_URL pgslice" +``` + +This will give you the `pgslice` command. ## Reference - [PostgreSQL Manual](https://www.postgresql.org/docs/current/static/ddl-partitioning.html) - [PostgreSQL Wiki](https://wiki.postgresql.org/wiki/Table_partitioning)