{"id":22568125,"url":"https://github.com/rekgrpth/pg_task","last_synced_at":"2026-01-31T11:03:15.141Z","repository":{"id":38245540,"uuid":"170629404","full_name":"RekGRpth/pg_task","owner":"RekGRpth","description":"PostgreSQL, Greenplum and Greengage job scheduler pg_task allows to execute any sql command at any specific time at background asynchronously","archived":false,"fork":false,"pushed_at":"2026-01-01T19:13:12.000Z","size":3235,"stargazers_count":65,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-07T03:14:46.215Z","etag":null,"topics":["async","background","c","greengage","greenplum","job","postgres","postgresql","scheduler","sql","task"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RekGRpth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-14T04:54:55.000Z","updated_at":"2026-01-01T19:13:04.000Z","dependencies_parsed_at":"2024-10-25T14:43:58.820Z","dependency_job_id":"ce0e4677-a41b-46cf-bc85-644052f1da74","html_url":"https://github.com/RekGRpth/pg_task","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RekGRpth/pg_task","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RekGRpth%2Fpg_task","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RekGRpth%2Fpg_task/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RekGRpth%2Fpg_task/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RekGRpth%2Fpg_task/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RekGRpth","download_url":"https://codeload.github.com/RekGRpth/pg_task/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RekGRpth%2Fpg_task/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28939508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T10:18:23.202Z","status":"ssl_error","status_checked_at":"2026-01-31T10:18:22.693Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","background","c","greengage","greenplum","job","postgres","postgresql","scheduler","sql","task"],"created_at":"2024-12-08T00:11:29.762Z","updated_at":"2026-01-31T11:03:15.136Z","avatar_url":"https://github.com/RekGRpth.png","language":"C","readme":"PostgreSQL, Greenplum and Greengage job scheduler `pg_task` allows to execute any sql command at any specific time at background asynchronously\n\nfirst\n```conf\nshared_preload_libraries = 'pg_task' # add pg_task to shared_preload_libraries\n```\nsecond\n```sql\nINSERT INTO task (input) VALUES ('SELECT now()'); -- to run sql more quickly use only input\nINSERT INTO task (plan, input) VALUES (now() + '5 min':INTERVAL, 'SELECT now()'); -- to run sql after 5 minutes point plan(ned time)\nINSERT INTO task (plan, input) VALUES ('2029-07-01 12:51:00', 'SELECT now()'); -- to run sql at specific time point it as plan(ned time)\nINSERT INTO task (repeat, input) VALUES ('5 min', 'SELECT now()'); -- to repeat sql every 5 minutes point repeat( interval)\nINSERT INTO task (input) VALUES ('SELECT 1/0'); -- exception is catched and writed in error as text\nINSERT INTO task (group, max, input) VALUES ('group', 1, 'SELECT now()'); -- if some group needs concurently run only 2 parallel sqls then use max = 1\nINSERT INTO task (group, max, input) VALUES ('group', 2, 'SELECT now()'); -- if in this group there are more sqls and they are executing concurently by 2 then passing max = 2 will execute sql as more early in this group (it is like priority)\nINSERT INTO task (input, remote) VALUES ('SELECT now()', 'user=user host=host'); -- to run sql on remote database use remote\n```\n\n`pg_task` creates the following GUCs:\n\n| Name | Type | Default | Level | Description |\n| --- | --- | --- | --- | --- |\n| pg_task.delete | bool | true | config, database, user, session | Auto delete task when both output and error are nulls |\n| pg_task.drift | bool | false | config, database, user, session | Compute next repeat time by stop time instead by plan time |\n| pg_task.header | bool | true | config, database, user, session | Show columns headers in output |\n| pg_task.string | bool | true | config, database, user, session | Quote only strings |\n| pg_conf.close | int | 60 * 1000 | config, database, superuser | Close conf, milliseconds |\n| pg_conf.fetch | int | 10 | config, database, superuser | Fetch conf rows at once |\n| pg_conf.restart | int | 60 | config, database, superuser | Restart conf interval, seconds |\n| pg_task.count | int | 0 | config, database, user, session | Non-negative maximum count of tasks, are executed by current background worker process before exit |\n| pg_task.fetch | int | 100 | config, database, user | Fetch task rows at once |\n| pg_task.id | bigint | 0 | session | Current task id (for read only) |\n| pg_task.limit | int | 1000 | config, database, user | Limit task rows at once |\n| pg_task.max | int | 0 | config, database, user, session | Maximum count of concurrently executing tasks in group, negative value means pause between tasks in milliseconds |\n| pg_task.run | int | 2147483647 | config, database, user, session | Maximum count of concurrently executing tasks in work |\n| pg_task.sleep | int | 1000 | config, database, user | Check tasks every sleep milliseconds |\n| pg_work.close | int | 60 * 1000 | config, database, superuser | Close work, milliseconds |\n| pg_work.fetch | int | 100 | config, database, superuser | Fetch work rows at once |\n| pg_work.restart | int | 60 | config, database, superuser | Restart work interval, seconds |\n| pg_task.active | interval | 1 hour | config, database, user, session | Positive period after plan time, when task is active for executing |\n| pg_task.data | text | postgres | config | Database name for tasks table |\n| pg_task.delimiter | char | \\t | config, database, user, session | Results columns delimiter |\n| pg_task.escape | char | | config, database, user, session | Results columns escape |\n| pg_task.group | text | group | config, database, user, session | Task grouping by name |\n| pg_task.idle | int | 60 | config, database, user | Idle task count |\n| pg_task.json | json | [{\"data\":\"postgres\"}] | config | Json configuration, available keys: data, reset, schema, table, sleep and user |\n| pg_task.live | interval | 0 sec | config, database, user, session | Non-negative maximum time of live of current background worker process before exit |\n| pg_task.null | text | \\N | config, database, user, session | Null text value representation |\n| pg_task.plan | timestamptz | statement_timestamp() | config, database, user, session | Default value for now timestamp |\n| pg_task.quote | char | | config, database, user, session | Results columns quote |\n| pg_task.repeat | interval | 0 sec | config, database, user, session | Non-negative auto repeat tasks interval |\n| pg_task.reset | interval | 1 hour | config, database, user | Interval of reset tasks |\n| pg_task.schema | text | public | config, database, user | Schema name for tasks table |\n| pg_task.table | text | task | config, database, user | Table name for tasks table |\n| pg_task.timeout | interval | 0 sec | config, database, user, session | Non-negative allowed time for task run |\n| pg_task.user | text | postgres | config | User name for tasks table |\n\n`pg_task` creates table with the following columns:\n\n| Name | Type | Nullable? | Default | Description |\n| --- | --- | --- | --- | --- |\n| id | bigserial | NOT NULL | autoincrement | Primary key |\n| parent | bigint | NULL | pg_task.id | Parent task id (if exists, like foreign key to id, but without constraint, for performance) |\n| plan | timestamptz | NOT NULL | pg_task.plan | Planned date and time of start |\n| start | timestamptz | NULL | | Actual date and time of start |\n| stop | timestamptz | NULL | | Actual date and time of stop |\n| active | interval | NOT NULL | pg_task.active | Positive period after plan time, when task is active for executing |\n| live | interval | NOT NULL | pg_task.live | Non-negative maximum time of live of current background worker process before exit |\n| repeat | interval | NOT NULL | pg_task.repeat | Non-negative auto repeat tasks interval |\n| timeout | interval | NOT NULL | pg_task.timeout | Non-negative allowed time for task run |\n| count | int | NOT NULL | pg_task.count | Non-negative maximum count of tasks, are executed by current background worker process before exit |\n| max | int | NOT NULL | pg_task.max | Maximum count of concurrently executing tasks in group, negative value means pause between tasks in milliseconds |\n| pid | int | NULL | | Id of process executing task |\n| state | enum state (PLAN, TAKE, WORK, DONE, STOP) | NOT NULL | PLAN | Task state |\n| delete | bool | NOT NULL | pg_task.delete | Auto delete task when both output and error are nulls |\n| drift | bool | NOT NULL | pg_task.drift | Compute next repeat time by stop time instead by plan time |\n| header | bool | NOT NULL | pg_task.header | Show columns headers in output |\n| string | bool | NOT NULL | pg_task.string | Quote only strings |\n| delimiter | char | NOT NULL | pg_task.delimiter | Results columns delimiter |\n| escape | char | NOT NULL | pg_task.escape | Results columns escape |\n| quote | char | NOT NULL | pg_task.quote | Results columns quote |\n| data | text | NULL | | Some user data |\n| error | text | NULL | | Catched error |\n| group | text | NOT NULL | pg_task.group | Task grouping by name |\n| input | text | NOT NULL | | Sql command(s) to execute |\n| null | text | NOT NULL | pg_task.null | Null text value representation |\n| output | text | NULL | | Received result(s) |\n| remote | text | NULL | | Connect to remote database (if need) |\n\nbut you may add any needed colums and/or make partitions\n\nby default `pg_task` runs on default database with default user with default schema with default table with default sleep\n\nto run specific database and/or specific user and/or specific schema and/or specific table and/or specific sleep, set config (in json format)\n```conf\npg_task.json = '[{\"data\":\"database1\"},{\"data\":\"database2\",\"user\":\"username2\"},{\"data\":\"database3\",\"schema\":\"schema3\"},{\"data\":\"database4\",\"table\":\"table4\"},{\"data\":\"database5\",\"sleep\":100}]'\n```\n\nif database and/or user and/or schema and/or table does not exist then `pg_task` create it/their\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frekgrpth%2Fpg_task","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frekgrpth%2Fpg_task","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frekgrpth%2Fpg_task/lists"}