{"id":9551,"date":"2022-10-22T15:48:00","date_gmt":"2022-10-22T20:48:00","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=9551"},"modified":"2022-10-20T15:58:25","modified_gmt":"2022-10-20T20:58:25","slug":"using-pg_cron-in-postgresql","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=9551","title":{"rendered":"Using PG_CRON In PostgreSQL"},"content":{"rendered":"\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/citusdata\/pg_cron\/\" data-type=\"URL\" data-id=\"https:\/\/github.com\/citusdata\/pg_cron\/\" target=\"_blank\">pg_cron extension<\/a> allows you to schedule tasks from within your database (or, to those who didn&#8217;t know it was a thing, it allows you to hide {really well} jobs that mutate or remove data leading to absolutely inexplicable database content). While the project documents how to <em>create<\/em> or remove a scheduled job, I had quite the time figuring out how to <em>see<\/em> what was scheduled. <\/p>\n\n\n\n<p>To see jobs scheduled in pg_cron:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_ListJobs.png\"><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"227\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_ListJobs.png\" alt=\"\" class=\"wp-image-9552\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_ListJobs.png 756w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_ListJobs-300x90.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_ListJobs-750x225.png 750w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/a><\/figure>\n\n\n\n<p>To see the result of scheduled jobs:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_JobResults.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1018\" height=\"353\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_JobResults.png\" alt=\"\" class=\"wp-image-9553\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_JobResults.png 1018w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_JobResults-300x104.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_JobResults-768x266.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/10\/PG_CRON_JobResults-750x260.png 750w\" sizes=\"auto, (max-width: 1018px) 100vw, 1018px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The pg_cron extension allows you to schedule tasks from within your database (or, to those who didn&#8217;t know it was a thing, it allows you to hide {really well} jobs that mutate or remove data leading to absolutely inexplicable database content). While the project documents how to create or remove a scheduled job, I had &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1522],"tags":[1348,1349],"class_list":["post-9551","post","type-post","status-publish","format-standard","hentry","category-postgresql","tag-postgres","tag-postgresql"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/9551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9551"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/9551\/revisions"}],"predecessor-version":[{"id":9554,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/9551\/revisions\/9554"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}