SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2003
    Location
    Arcadia
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    groups and calendars

    Hey,

    I have a question about the proper design for the following project. I'm working on a website where different groups each have their own calendar where they can post events (and of course each group can only see their own events). Right now, recurring events are stored as lots of rows (like if an event recurs weekly for a year, that will add 52 rows). the structure is sort of like:

    id - groupid - date - event - details - user

    So the concern is that since recurring events create so many rows, eventually there will be lots of rows (especially as the number of groups increase) which will be clunky. Especially since the front page for each group lists upcoming events which means each visit will result in a query searching for "blah blah where groupid = $groupid" or something. I'm thinking of changing it so that recurring events can only take up one row, and then running a cron each week to create a new table that has only the events for the upcoming week (so that each recurring event then has it's own row). That way, when looking for upcoming events, it only has to look at the smaller table.

    Most of what I've read so far has dealt with calendars for a single person or group, so the scaling factor is less of an issue than here (where there could be a lot of groups), and I haven't found anything effectively dealing with this issue.

    If not obvious yet, I don't know what I'm talking about , so any advice would be much appreciated!

  2. #2
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I might suggest:

    event
    -----
    eventid PK
    groupid FK
    startdatetime
    recurrenceinterval (bigint -- hours)
    event
    details
    user


    Then, as long it is a periodically recurring event you can just set the number of hours it recurs (168 per week and then do display calculations in the user interface....

  3. #3
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Again, another option would be:

    event
    -----
    eventid PK
    groupid FK
    startdatetimeevent
    details
    user

    event_occurrence
    -----
    eventid
    startdatetime
    enddatetime


    And then you add rows to event_occurence by using application logic...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •