Re: Novice DB Schema question

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Novice DB Schema question
Date: 2002-11-04 20:26:31
Message-ID: 200211041226.31167.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"anonymous"

> I have a bit of a stumper.
>
> I'm writing an IMAP server. The goal it to achieve IMAP scalability by
> allowing a user to set up a fleet of thin servers to speak IMAP and push
> the scaling problem to the SQL layer (where the problem has been largely
> solved). This means I want to write it with PostgreSQL, but I want it to
> wind up being portable to whatever big iron someone might want to use.

Sounds like you should hire an experienced Postgres DBA, unless this is an
Open Source project.

> The only trick left is to arrange for a message to be deleted when its
> last messagemap entry is deleted.

Write a trigger, in PL/pgSQL, which executes whenever a record is deleted from
messagemap. The trigger should check whether there are any mailboxes left
with that particular message; if not, delete it.

Triggers are covered in the online documentation.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kassel Ben CRBE 2002-11-05 02:10:57 Re: AutoIncrement not working on this table only
Previous Message Josh Berkus 2002-11-04 18:50:34 Re: Populating a database