Re: Making strxfrm() blobs in indexes work - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Making strxfrm() blobs in indexes work
Date
Msg-id 20140212233016.GD15462@svana.org
Whole thread Raw
In response to Re: Making strxfrm() blobs in indexes work  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Making strxfrm() blobs in indexes work  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
On Sun, Feb 02, 2014 at 05:09:06PM -0800, Peter Geoghegan wrote:
> However, it also occurs to me that strxfrm() blobs have another useful
> property: We (as, say, the author of an equality operator on text, an
> operator intended for a btree operator class) *can* trust a strcmp()'s
> result on blobs, provided the result isn't 0/equal, *even if the blobs
> are truncated*. So maybe a better scheme, and certainly a simpler one
> would be to have a pseudo-attribute in inner pages only with, say, the
> first 8 bytes of a strxfrm() blob formed from the logically-leading
> text attribute of the same indexTuple. Because we're only doing this
> on inner pages, there is a very good chance that that will be good
> enough most of the time. This also allows us to reduce bloat very
> effectively.

(A bit late to the party). This idea has come up before and the most
annoying thing is that braindead strxfrm api.  Namely, to strxfrm a
large strings you need to strxfrm it completely even if you only want
the first 8 bytes.

That said, since btree index tuples are limited to <3k anyway, the
overhead probably isn't that bad.

I think it would make a noticable difference if it can be made to work.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.  -- Arthur Schopenhauer

pgsql-hackers by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: contrib/cache_scan (Re: What's needed for cache-only table scan?)
Next
From: Peter Geoghegan
Date:
Subject: Re: Making strxfrm() blobs in indexes work