Re: Database synchronization

From: Enrico Weigelt <weigelt(at)metux(dot)de>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Database synchronization
Date: 2007-08-08 13:15:52
Message-ID: 20070808131552.GD27936@nibiru.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Jyoti Seth <jyotiseth2001(at)gmail(dot)com> wrote:

Hi,

if you can live with some seconds lag, you can use an separate
transfer process which looks at the source of your prices and
and updates the second DB if some price changes.

Depending on how often prices change, there're two good options:

a) add an timestamp field to the original price table, which is
maintained by an after-trigger. The transfer regularily
(ie. every few secs) fetches all those records which have
been changed since last poll (via the new timestamp field).

b) create an new table for an journal of the price changes.
this journal is filled by rules on the original table and
contains exactly what's needed to reproduce the price changes
in the other DB. The transfer process regularily fetches
the journal and rolls it out in the second DB.

I've implemented the method b) in an realtime stock (FOREX)
trading applications where trading automatically robots execute
transactions on the customer's broker accounts on signals
provided by an team of profession traders. (the client can
subscribe to several trading signal channels and define in
which quantities transactions should be performed from which
channels should be executed on their broker accounts and the
broking platform does all the time critical work). The robots
work entirely on separate databases (on separate hosts),
several transfer processes feed in robot commands and fetch
back results to the primary database. So time critical things
are separated to own servers. It works quite fine :)

cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service - http://www.metux.de/
---------------------------------------------------------------------
Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
---------------------------------------------------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Paul Lambert 2007-08-08 22:13:35 Re: Implementing an regex filter
Previous Message Enrico Weigelt 2007-08-08 12:40:54 Performance on writable views