Re: Range types

From: decibel <decibel(at)decibel(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, tomas(at)tuxteam(dot)de, Scott Bailey <artacus(at)comcast(dot)net>, hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Range types
Date: 2009-12-16 00:06:42
Message-ID: 17265715-B5DB-4526-B17B-685A8A9E0F4E@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Dec 15, 2009, at 11:34 AM, Jeff Davis wrote:
> On Tue, 2009-12-15 at 10:19 -0500, Tom Lane wrote:
>> I'm not sure that anyone has argued that. I did suggest that there
>> might be a small list of types for which we should provide discrete
>> behavior (ie, with next/previous functions) and the rest could have
>> continuous behavior (without that assumption). But I quite agree
>> that we want both types of ranges.
>
> It seems like we're moving toward treating TIMESTAMP as continuous.
>
> If I'm correct, continuous ranges always need two extra bits of storage
> for the exclusivity. But for timestamps, that means 16 bytes (2 x 8-byte
> timestamp) turns into 17 bytes, which is really more like 20 or 24 bytes
> with alignment.
>
> Considering that these are likely to be used for audit or history
> tables, 8 bytes of waste (50%) seems excessive -- especially when
> treating them as discrete seems to work pretty well, at least for the
> int64 timestamps.
>
> Ideas?

Now that varlena's don't have an enormous fixed overhead, perhaps it's worth looking at using them. Obviously some operations would be slower, but for your stated examples of auditing and history, I suspect that you're not going to notice the overhead that much.

I'm not sure if the best way to do this would be to support a varlena timestamp or to take fixed-size timestamps and convert them into varlena periods.
--
Jim C. Nasby, Database Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christophe Pettus 2009-12-16 00:08:43 Re: Range types
Previous Message decibel 2009-12-16 00:03:26 Re: Range types