pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
Cc: Tatsuo Ishii <t-ishii@sra.co.jp>
Cc: darcy@wavefire.com
Cc: jd@www.commandprompt.com
Cc: sfrost@snowman.net
Cc: herve@elma.fr
Subject: Re: PostgreSQL clustering VS MySQL clustering
Date: Fri, 21 Jan 2005 09:47:53 -0800
Message-ID: <200501210947.53938.josh@agliodbs.com> (raw)
In-Reply-To: <20050121.170731.08315885.t-ishii@sra.co.jp>
References: <200501200929.37228.darcy@wavefire.com>
	<200501201949.24292.josh@agliodbs.com>
	<20050121.170731.08315885.t-ishii@sra.co.jp>

Tatsuo,

> Suppose table A gets updated on the master at time 00:00. Until 00:03
> pgpool needs to send all queries regarding A to the master only. My
> question is, how can pgpool know a query is related to A?

Well, I'm a little late to head off tangental discussion about this, but ....

The systems where I've implemented something similar are for web applications.  
In the case of the web app, you don't care if a most users see data which is 
2 seconds out of date; with caching and whatnot, it's often much more than 
that!

The one case where it's not permissable for a user to see "old" data is the 
case where the user is updating the data.   Namely:

(1) 00:00 User A updates "My Profile"
(2) 00:01 "My Profile" UPDATE finishes executing.
(3) 00:02  User A sees "My Profile" re-displayed
(6) 00:04  "My Profile":UserA cascades to the last Slave server

So in an application like the above, it would be a real problem if User A were 
to get switched over to a slave server immediately after the update; she 
would see the old data, assume that her update was not saved, and update 
again.  Or send angry e-mails to webmaster@.   

However, it makes no difference what User B sees:

(1) 00:00 User A updates "My Profile"v1			Master
(2) 00:01 "My Profile" UPDATE finishes executing.	Master
(3) 00:02  User A sees "My Profile"v2 displayed		Master
(4) 00:02  User B requests "MyProfile":UserA		Slave2
(5) 00:03  User B sees "My Profile"v1				Slave2
(6) 00:04  "My Profile"v2 cascades to the last Slave server  Slave2

If the web application is structured properly, the fact that UserB is seeing 
UserA's information which is 2 seconds old is not a problem (though it might 
be for web auctions, where it could result in race conditions.   Consider 
memcached as a helper).   This means that pgPool only needs to monitor 
"update switching" by *connection* not by *table*.

Make sense?

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (131+ messages)  latest in thread

Message-ID: <200501210947.53938.josh@agliodbs.com>
Permalink:  ../200501210947.53938.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200501210947.53938.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: josh@agliodbs.com, t-ishii@sra.co.jp, darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr
  Subject: Re: PostgreSQL clustering VS MySQL clustering
  In-Reply-To: <200501210947.53938.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox