Re: Performance optimization of btree binary search

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: Performance optimization of btree binary search
Date: 2013-12-04 23:56:30
Message-ID: 28844.1386201390@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Hmm. And yet, there's this:

> * When a type narrower than Datum is stored in a Datum, we place it in the
> * low-order bits and are careful that the DatumGetXXX macro for it discards
> * the unused high-order bits (as opposed to, say, assuming they are zero).
> * This is needed to support old-style user-defined functions, since depending
> * on architecture and compiler, the return value of a function returning char
> * or short may contain garbage when called as if it returned Datum.

> And record_image_eq does a rather elaborate dance around here, calling
> the appropriate GET_x_BYTES macro depending on the type-width. If we
> can really count on the high-order bits to be zero, that's all
> completely unnecessary tomfoolery.

Yeah, that's another thing we could simplify if we fixed this problem
at the source. I think these decisions date from a time when we still
cared about the speed of fmgr_oldstyle.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-12-05 00:04:18 Re: Performance optimization of btree binary search
Previous Message Álvaro Hernández Tortosa 2013-12-04 23:51:51 Re: RFC: programmable file format for postgresql.conf