Cenceptual help needed - periodic events - Mailing list pgsql-sql

From Pat M
Subject Cenceptual help needed - periodic events
Date
Msg-id 9q9dq9$pnp$1@news.tht.net
Whole thread Raw
Responses Re: Cenceptual help needed - periodic events  ("Josh Berkus" <josh@agliodbs.com>)
List pgsql-sql
I'm goofing around, designing a planned maintenance system. In a couple of
weeks I'll be taking on the actual scheduling of tasks. How would you
experts out there approach this? I've beeen thinking I can approach this two
ways.

1) When a list of tasks is requested, generate new rows and store them.

2) When a list of tasks is requested, look at the task row and calculate the
tasks, display them, but do not generate rows for storage. Just calc on the
fly all the time.

Method #1 would mean less CPU and RAM use but then I'd have to worry about
tasks changing or being added to a maintenance schedule and not being
reflected in any pre-generated rows. #2 would alleviate that problem, but
may be slower overall and perhaps eat large amounts of ram.

If anyone has done something similar with periodic events, what did you find
worked best?

I'm planning on using a base task record to record the frequency and other
specifics of a task. This record is the basis for generating the periodic
tasks.

One row:
task_id =1 (serial)
task_system = 1
task_equip =  12
task_text = Lubricate fan shafts with lithium grease
task_interval = 1 month (using an interval type column)
task_startmonth = 2 (offset so that not ALL 6 month interval tasks actuall
happen in June)

Another row:
task_id =25 (serial)
task_system = 8
task_equip =  72
task_text =
task_interval = 6 month (using an interval type column)
task_startmonth=3

Then I'll have to step through the calendar by month and match up all the
task rows and print out a single page for each system.

This is all a brand new concept to me, so any suggestions are more than
welcome. I still have a few weeks work in other areas to keep me busy, but
this is the toughy that I'm spending brain time on =)





pgsql-sql by date:

Previous
From: missive@frontiernet.net (Lee Harr)
Date:
Subject: Re: to_char()??
Next
From: Tom Lane
Date:
Subject: Re: Why would this slow the query down so much?