dbTalk Databases Forums  

Re: Replicating sequences

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss Re: Replicating sequences in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: Replicating sequences - 10-31-2004 , 09:25 AM






"Ed L." <pgsql (AT) bluepolka (DOT) net> writes:
Quote:
Are triggers on sequences a reasonable feature request/hope for Pgsql?
I don't think so. Since sequences are inherently not transactional,
it seems wrong to fire a transactional behavior as a side effect of
nextval(). What exactly are you expecting the trigger to do, and
how is it going to do it in a way that won't get rolled back if the
calling transaction fails later?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
  #2  
Old   
Ed L.
 
Posts: n/a

Default Re: Replicating sequences - 10-31-2004 , 10:10 AM






On Sunday October 31 2004 8:25, Tom Lane wrote:
Quote:
"Ed L." <pgsql (AT) bluepolka (DOT) net> writes:
Are triggers on sequences a reasonable feature request/hope for Pgsql?

I don't think so. Since sequences are inherently not transactional,
it seems wrong to fire a transactional behavior as a side effect of
nextval(). What exactly are you expecting the trigger to do, and
how is it going to do it in a way that won't get rolled back if the
calling transaction fails later?
I don't know how to implement a solution to my problem. What seems evident
is that polling hundreds of sequence objects to tell if they've changed is
an unscalable aspect of current async replication solutions. My only
thought in raising the idea is that notification of a change to a sequence
value is highly preferrable over performance-intensive polling. Whether
that's done via triggers inside a transaction, or some other mechanism, I
don't care much as long as polling is not required.

I wonder if these async replication triggered procedures might be able to
detect changes to their related sequence objects, and issue a NOTIFY for
the updated sequence? The replicator could be listening on the NOTIFY and
update accordingly. The NOTIFY wouldn't go out until/unless the
transaction completed, and would obviate the need for sequence polling.
That'd save us 100-200 queries/second if it were possible if we're
attempting to replicate with a very short (1s) sync interval.

Ed


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.