3. Installation

pg_timetable is compatible with the latest supported PostgreSQL versions: 11, 12, 13, 14 (stable); 15 (dev).

Note

If you want to use pg_timetable with older versions (9.5, 9.6 and 10)... please, execute this SQL command before running pg_timetable:
CREATE OR REPLACE FUNCTION starts_with(text, text)
RETURNS bool AS
$$
SELECT
    CASE WHEN length($2) > length($1) THEN
        FALSE
    ELSE
        left($1, length($2)) = $2
    END
$$
LANGUAGE SQL
IMMUTABLE STRICT PARALLEL SAFE
COST 5;

3.1. Official release packages

You may find binary package for your platform on the official Releases page. Right now Windows, Linux and macOS packages are available.

3.2. Docker

The official docker image can be found here: https://hub.docker.com/r/cybertecpostgresql/pg_timetable

Note

The latest tag is up to date with the master branch thanks to this github action. In production you probably want to use the latest stable tag.

Run pg_timetable in Docker:

docker run --rm \
cybertecpostgresql/pg_timetable:latest \
-h 10.0.0.3 -p 54321 -c worker001

Run pg_timetable in Docker with Environment variables:

docker run --rm \
-e PGTT_PGHOST=10.0.0.3 \
-e PGTT_PGPORT=54321 \
cybertecpostgresql/pg_timetable:latest \
-c worker001

3.3. Build from sources

  1. Download and install Go on your system.

  2. Clone pg_timetable repo:

    $ git clone https://github.com/cybertec-postgresql/pg_timetable.git
    $ cd pg_timetable
    
  3. Run pg_timetable:

    $ go run main.go --dbname=dbname --clientname=worker001 --user=scheduler --password=strongpwd
    
  4. Alternatively, build a binary and run it:

    $ go build
    $ ./pg_timetable --dbname=dbname --clientname=worker001 --user=scheduler --password=strongpwd
    
  5. (Optional) Run tests in all sub-folders of the project:

    $ psql --command="CREATE USER scheduler PASSWORD 'somestrong'"
    $ createdb --owner=scheduler timetable
    $ go test -failfast -timeout=300s -count=1 -p 1 ./...