README.md in pgdexter-0.1.6 vs README.md in pgdexter-0.2.0

- old
+ new

@@ -9,11 +9,12 @@ ## Installation First, install [HypoPG](https://github.com/dalibo/hypopg) on your database server. This doesn’t require a restart. ```sh -curl -L https://github.com/dalibo/hypopg/archive/1.0.0.tar.gz | tar -x +cd /tmp +curl -L https://github.com/dalibo/hypopg/archive/1.0.0.tar.gz | tar xz cd hypopg-1.0.0 make make install # may need sudo ``` @@ -36,11 +37,11 @@ ## How to Use Dexter needs a connection to your database and a log file to process. ```sh -tail -F -n +1 <log-file> | dexter <connection-string> +tail -F -n +1 <log-file> | dexter <connection-options> ``` This finds slow queries and generates output like: ``` @@ -61,42 +62,54 @@ 2017-06-25T17:52:22+00:00 Index found: ratings (user_id) 2017-06-25T17:52:22+00:00 Creating index: CREATE INDEX CONCURRENTLY ON "ratings" ("user_id") 2017-06-25T17:52:37+00:00 Index created: 15243 ms ``` -## Connection String +## Connection Options -The connection string is a URI with the format: +Dexter supports the same connection options as psql. ``` +-h host -U user -p 5432 -d dbname +``` + +This includes URIs: + +``` postgresql://user:pass@host:5432/dbname ``` -To connect through a socket, just pass the database name. +and connection strings: ``` -dbname +host=localhost port=5432 dbname=mydb ``` ## Options Name | Description | Default --- | --- | --- exclude | prevent specific tables from being indexed | None interval | time to wait between processing queries, in seconds | 60 -log-level | `debug` gives additional info for suggested indexes<br />`debug2` gives additional info for processed queries | info +log-level | `debug` gives additional info for suggested indexes<br />`debug2` gives additional info for processed queries<br />`error` suppresses logging | info log-sql | log SQL statements executed | false min-time | only process queries consuming a min amount of DB time, in minutes | 0 -## Single Statement Mode +## Non-Streaming Modes You can pass a single statement with: ```sh -dexter <connection-string> -s "SELECT * FROM ..." +dexter <connection-options> -s "SELECT * FROM ..." ``` +or files with: + +```sh +dexter <connection-options> <file1> <file2> +``` + ## Examples Ubuntu with PostgreSQL 9.6 ```sh @@ -106,9 +119,13 @@ Homebrew on Mac ```sh tail -F -n +1 /usr/local/var/postgres/server.log | dexter dbname ``` + +## Hosted Postgres + +Some hosted providers like Amazon RDS and Heroku do not support the HypoPG extension, which Dexter needs to run. See [how to use Dexter](guides/Hosted-Postgres.md) in these cases. ## Future Work [Here are some ideas](https://github.com/ankane/dexter/issues/1)