Re: Novice DB Schema question - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Novice DB Schema question
Date
Msg-id 200211041226.31167.josh@agliodbs.com
Whole thread Raw
In response to Novice DB Schema question  (Nick Sayer <nsayer@quack.kfu.com>)
List 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


pgsql-novice by date:

Previous
From: "Ben Kassel"
Date:
Subject: AutoIncrement not working on this table only
Next
From: Kassel Ben CRBE
Date:
Subject: Re: AutoIncrement not working on this table only