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

Re: range_adjacent and discrete ranges

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Florian Pflug <fgp(at)phlo(dot)org>, Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: range_adjacent and discrete ranges
Date: 2011-11-23 21:39:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I wrote:
> I did a little bit of performance testing on an x86_64 machine (Fedora 14),
> and found that the time to execute a clause like
> 	WHERE int4range(1,2) -|- int4range(x, 10000000)
> (x being an integer Var) grows from 0.37 us to 0.56 us if we adopt the
> patched version of range_adjacent.  With float8 ranges it grows from
> 0.35 us to 0.54 us.  So these are noticeable penalties but they don't
> seem like show-stoppers.  Since the alternative is to document that
> the apparent freedom to choose a canonicalization policy is illusory,
> I'm inclined to think we should change it.

It occurred to me that we can easily buy back the extra time for range
types that don't have a canonical function (ie, continuous ranges).
If there's no such function, it's impossible for B..C to normalize to
empty when B < C, so we can skip the extra logic.  The attached version
is no slower than the original code for continuous ranges, and doesn't
seem measurably different from my previous patch for discrete ranges.

			regards, tom lane

Attachment: range_adjacent_reimplementation-2.patch
Description: text/x-patch (3.3 KB)

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2011-11-23 21:55:29
Subject: Re: Not HOT enough
Previous:From: Simon RiggsDate: 2011-11-23 21:36:46
Subject: Re: Not HOT enough

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