Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: database design question

Re: database design question

From: Uwe Schneider <uwe_at_richard-schneider.de>
Date: Sat, 13 Oct 2001 18:07:43 +0200
Message-ID: <3BC866CF.9D85D673@richard-schneider.de>


Hi Seerge,

Serge Baduk wrote:
>
> Hi,
>
> I have a general database design question: how should I implement the
> bank account balance, if I were to build a bank database? Currently,
> it seems that I have the following three options:
>
> 1. BALANCE VIEW
> This means that the balance will be recalculated from the
> TRANSACTION table on every query.
> 2. BALANCE TABLE
> This means that every UPDATE, DELETE or INSERT operation on the
> TRANSACTION table will trigger an update, delete or insert operation
> to the corresponding BALANCE TABLE row.
> 3. BALANCE MATERIALIZED VIEW
> This means that the database engine will decide for itself when to
> recalculate the balance field in the BALANCE MATERIALIZED VIEW from
> the TRANSACTION table.
>
> Given that both performance and data integrity are critical, what
> would you think is the best approach? Or how is BALANCE implemented in
> existing banking systems?

We are satisified with the second option: The balance is just another attribute of the accounts table. A row trigger maintains its value after inserts. Of course this can be done for updates or deletes as well, but normally these modifications should be prohibited in a real world bank application, since transactions correspond to events.

Uwe

-- 
Uwe Schneider       | Telefon +49 7244 / 609504
Karlsdorfer Str. 31 | Mail    uwe_at_richard-schneider.de
DE-76356 Weingarten | http://www.richard-schneider.de/uwe
Linux - OS al dente!
Received on Sat Oct 13 2001 - 11:07:43 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US