Skip site navigation (1) Skip section navigation (2)

Re: xlog location arithmetic

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: xlog location arithmetic
Date: 2011-12-06 10:14:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Dec 6, 2011 at 05:19, Euler Taveira de Oliveira
<euler(at)timbira(dot)com> wrote:
> Hi,
> A while ago when blogging about WAL [1], I noticed a function to deal with
> xlog location arithmetic is wanted. I remembered Depez [2] mentioning it and
> after some questions during trainings and conferences I decided to translate
> my shell script function in C.
> The attached patch implements the function pg_xlog_location_diff (bikeshed
> colors are welcome). It calculates the difference between two given
> transaction log locations. Now that we have pg_stat_replication view, it will
> be easy to get the lag just passing columns as parameters. Also, the
> monitoring tools could take advantage of it instead of relying on a fragile
> routine to get the lag.

I've been considering similar things, as you can find in the archives,
but what I was thinking of was converting the number to just a plain
bigint, then letting the user apply whatever arithmetic wanted at the
SQL level. I never got around to acutally coding it, though. It could
easily be extracted from your patch of course - and I think that's a
more flexible approach. Is there some advantage to your method that
I'm missing?

Also, why do you use DirectFunctionCall to do the simple math, and not
just do the math right there in the function?

 Magnus Hagander

In response to


pgsql-hackers by date

Next:From: Nicolas BarbierDate: 2011-12-06 10:40:23
Subject: Re: Inlining comparators as a performance optimisation
Previous:From: Volker GrabschDate: 2011-12-06 09:34:37
Subject: Adding XSLT support to PostgreSQL core?

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group