我想,如下所示覆制與crontab中類似語義的PostgreSQL數據庫表(mininimal)的crontab功能的PostgreSQL數據庫(指標未顯示,對於simiplicity):運行查詢定期(ALA的crontab)從
create table schedule (
id int not null primary key,
command text
);
create table schedule_detail(
schedule_id int not null references schedule(id),
sd_minute smallint not null,
sd_hour smallint not null,
sd_day smallint not null,
sd_month smallint not null,
sd_year smallint not null,
sd_dayofweek smallint not null
);
我只得到模式設計。我想就如何實現這一點提出一些想法。特別是,如何實現:
- 在計劃表中的「定期輪詢」
- 如何確定的時間表來運行
PostgreSQL擁有任何本機(內置)的功能,我可以建立在實現這種行爲?
+1它甚至採用了使用[的cron風格的格式(http://www.pgadmin.org/docs/1.4/pgagent-schedules.html) – 2010-12-14 14:30:31
我決定「推出自己的」因爲pgAgent是我想要的矯枉過正。不過,我會接受這個答案,因爲它讓我走上了正確的道路 – skyeagle 2010-12-15 08:14:19
@skyeagle,我希望看到你的pgAgent版本,你是否用pgsql或不同的腳本語言編寫它? – indago 2013-04-08 14:42:02