https://github.com/cybertec-postgresql/pg_timetable Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} cybertec-postgresql / pg_timetable * Notifications * Star 494 * Fork 26 pg_timetable: Advanced scheduling for PostgreSQL www.cybertec-postgresql.com/en/products/pg_timetable/ View license 494 stars 26 forks Star Notifications * Code * Issues 1 * Pull requests 0 * Discussions * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 19 tags Code * Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone cybert] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @pashagolub pashagolub [*] bump Go version to 1.17 ... bb50dbb Aug 26, 2021 [*] bump `Go` version to 1.17 bb50dbb Git stats * 932 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github [*] bump Go version to 1.17 Aug 26, 2021 docs fix typo Aug 20, 2021 extras [!] use new consistent terminology: command -> task -> chain Apr 13, 2021 internal [+] add function to delete task from the chain, closes #316 Aug 25, 2021 samples [+] merge timetable.command table with timetable.task, closes #261 May 6, 2021 .gitignore - LICENSE file name fixed Feb 21, 2020 .golangci.yml [+] implement autonomous tasks Apr 16, 2020 .goreleaser.yml [*] use goreleaser/goreleaser-action@v2 instead of master Aug 26, 2021 CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Oct 7, 2019 Dockerfile [+] add certificates to the Docker image Mar 10, 2021 LICENSE Templated used Mar 23, 2020 README.md fix broken links to the documentation, closes #304 Aug 4, 2021 SECURITY.md Create SECURITY.md Jul 7, 2020 config.example.yaml update config example Jun 24, 2021 go.mod [!] upgrade to Go 1.17, closes #311 Aug 19, 2021 go.sum Bump github.com/pashagolub/pgxmock from 1.3.0 to 1.4.0 Aug 19, 2021 main.go [-] fix timetable.is_cron_in_time(), closes #305 Aug 11, 2021 View code [ ] pg_timetable: Advanced scheduling for PostgreSQL Documentation Main features Installation Quick Start Supported Environments Contributing Support Authors README.md License: MIT [badge] Coverage Status Documentation Status Release Github All Releases Docker Pulls Go Report Card Mentioned in Awesome Go pg_timetable: Advanced scheduling for PostgreSQL pg_timetable is an advanced standalone job scheduler for PostgreSQL, offering many advantages over traditional schedulers such as cron and others. It is completely database driven and provides a couple of advanced concepts. It allows you to schedule PostgreSQL commands, system programs and built-in operations: -- Run public.my_func() at 00:05 every day in August: SELECT timetable.add_job('execute-func', '5 0 * 8 *', 'SELECT public.my_func()'); -- Run VACUUM at minute 23 past every 2nd hour from 0 through 20 every day: SELECT timetable.add_job('run-vacuum', '23 0-20/2 * * *', 'VACUUM'); -- Refresh materialized view every 2 hours: SELECT timetable.add_job('refresh-matview', '@every 2 hours', 'REFRESH MATERIALIZED VIEW public.mat_view'); -- Clear log table after pg_timetable restart: SELECT timetable.add_job('clear-log', '@reboot', 'TRUNCATE public.log'); -- Reindex at midnight on Sundays with reindexdb utility: -- using default database under default user (no command line arguments) SELECT timetable.add_job('reindex-job', '0 0 * * 7', 'reindexdb', job_kind := 'PROGRAM'); -- specifying target database and tables, and be verbose SELECT timetable.add_job('reindex-job', '0 0 * * 7', 'reindexdb', '["--table=foo", "--dbname=postgres", "--verbose"]'::jsonb, 'PROGRAM'); -- passing password using environment variable through bash shell SELECT timetable.add_job('reindex-job', '0 0 * * 7', 'bash', '["-c", "PGPASSWORD=5m3R7K4754p4m reindexdb -U postgres -h 192.168.0.221 -v'::jsonb, 'PROGRAM'); Documentation https://pg-timetable.readthedocs.io/ Main features * Tasks can be arranged in chains * Each task executes SQL, built-in or executable command * Parameters can be passed to tasks * Missed chains (possibly due to downtime) can be retried automatically * Support for configurable repetitions * Builtin tasks such as sending emails, downloading, importing files, etc. * Fully database driven configuration * Full support for database driven logging * Enhanced cron-style scheduling * Optional concurrency protection Installation Complete installation guide can be found in the documentation. Possible choices are: * official release packages; * Docker images; * build from sources. Quick Start Complete usage guide can be found in the documentation. 1. Download pg_timetable executable 2. Make sure your PostgreSQL server is up and running and has a role with CREATE privilege for a target database, e.g. my_database=> CREATE ROLE scheduler PASSWORD 'somestrong'; my_database=> GRANT CREATE ON DATABASE my_database TO scheduler; 3. Create a new job, e.g. run VACUUM each night at 00:30 my_database=> SELECT timetable.add_job('frequent-vacuum', '30 * * * *', 'VACUUM'); add_job --------- 3 (1 row) 4. Run the pg_timetable # pg_timetable postgresql://scheduler:somestrong@localhost/my_database --clientname=vacuumer 5. PROFIT! Supported Environments Cloud Service Supported PostgreSQL Supported OS Supported Version Alibaba Cloud 14 (devel) Linux Amazon RDS 13 (current) Darwin Amazon Aurora 12 Windows Azure 11 FreeBSD* Citus Cloud 10 NetBSD* Crunchy 9.6 OpenBSD* Bridge DigitalOcean Solaris* Google Cloud Heroku Supabase * - there are no official release binaries made for these OSes. One would need to build them from sources. ** - previous PostgreSQL versions may and should work smoothly. Only officially supported PostgreSQL versions are listed in this table. Contributing If you want to contribute to pg_timetable and help make it better, feel free to open an issue or even consider submitting a pull request . Support For professional support, please contact Cybertec. Authors * Implementation: Pavlo Golub * Initial idea and draft design: Hans-Jurgen Schonig About pg_timetable: Advanced scheduling for PostgreSQL www.cybertec-postgresql.com/en/products/pg_timetable/ Topics sql database cron docker-image scheduling postgresql interval chains pg-timetable Resources Readme License View license Releases 19 v4.1.0 Latest Aug 12, 2021 + 18 releases Contributors 15 * @pashagolub * @SanjeevChoubey * @KieranKaelin * @markwort * @dependabot[bot] * @immercool * @kmoppel * @dependabot-preview[bot] * @thormick * @fluca1978 * @postgresql007 + 4 contributors Languages * Go 71.7% * PLpgSQL 27.9% * Dockerfile 0.4% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.