From: Jeff Davis on
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?

Regards,
Jeff Davis


--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Tom Lane on
Jeff Davis <pgsql(a)j-davis.com> writes:
> 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.

You probably need some flag bits anyway, so flailing frantically to
avoid that doesn't seem like a profitable use of time.

One pretty obvious use for a flag bit is open-ended ranges, ie
range(something, infinity)
You could only do this without a flag bit if the underlying datatype
has an "infinity" value, which not all do.

I'm also wondering what null range boundaries would do. Maybe that's
the same as the infinity case, or maybe not.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Scott Bailey on
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.

Would it be OK if we handled float timestamp ranges as continuous and
int64 timestamps discrete? You effectively lose the ability to build
non-contiguous sets with continuous ranges. Which is integral to the
work I'm doing (union, intersect, coalesce and minus sets of ranges)

As for the extra bits, would it be better to just require continuous
ranges to be either [] or [)? But I don't know which would be preferred.
My inclination would be toward [), but Tom seemed to indicate that
perhaps [] was the norm.

Scott

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: David Fetter on
On Tue, Dec 15, 2009 at 11:31:05AM -0800, Scott Bailey wrote:
> Jeff Davis wrote:
> >On Tue, 2009-12-15 at 10:19 -0500, Tom Lane wrote:
>
> Would it be OK if we handled float timestamp ranges as continuous
> and int64 timestamps discrete?

That sounds like a recipe for disaster. Whatever timestamp ranges
are, float and int64 should be treated the same way so as not to get
"surprises" due to implementation details.

> You effectively lose the ability to build non-contiguous sets with
> continuous ranges. Which is integral to the work I'm doing (union,
> intersect, coalesce and minus sets of ranges)
>
> As for the extra bits, would it be better to just require continuous
> ranges to be either [] or [)? But I don't know which would be
> preferred. My inclination would be toward [), but Tom seemed to
> indicate that perhaps [] was the norm.

[] makes certain operations--namely the important ones in
calendaring--impossible, or at least incredibly kludgy, to do. I
think we ought to leave openness at each end up to the user,
independent of the underlying implementation details.

FWIW, I think it would be a good idea to treat timestamps as
continuous in all cases.

Cheers,
David.
--
David Fetter <david(a)fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter(a)gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Tom Lane on
David Fetter <david(a)fetter.org> writes:
> On Tue, Dec 15, 2009 at 11:31:05AM -0800, Scott Bailey wrote:
>> As for the extra bits, would it be better to just require continuous
>> ranges to be either [] or [)? But I don't know which would be
>> preferred. My inclination would be toward [), but Tom seemed to
>> indicate that perhaps [] was the norm.

> [] makes certain operations--namely the important ones in
> calendaring--impossible, or at least incredibly kludgy, to do. I
> think we ought to leave openness at each end up to the user,
> independent of the underlying implementation details.

Yes. A range implementation that couldn't support all four cases
of [], [), (], () would be seriously crippled IMO.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Prev: Winflex
Next: [HACKERS] Fast or immediate shutdown