Re: Database synchronization - Mailing list pgsql-sql

From Enrico Weigelt
Subject Re: Database synchronization
Date
Msg-id 20070808131552.GD27936@nibiru.local
Whole thread Raw
In response to Database synchronization  ("Jyoti Seth" <jyotiseth2001@gmail.com>)
List pgsql-sql
* Jyoti Seth <jyotiseth2001@gmail.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
timestampfield).
 

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_TaskforcePatches/ Fixes for a lot dozens of packages in dozens of
versions:http://patches.metux.de/
---------------------------------------------------------------------


pgsql-sql by date:

Previous
From: Enrico Weigelt
Date:
Subject: Performance on writable views
Next
From: Paul Lambert
Date:
Subject: Re: Implementing an regex filter