Re: Performance optimization of btree binary search

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Performance optimization of btree binary search
Дата
Msg-id 20131205141817.GH14419@alap2.anarazel.de
обсуждение исходный текст
Ответ на Re: Performance optimization of btree binary search  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Performance optimization of btree binary search
Список pgsql-hackers
On 2013-12-05 08:58:55 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > I don't think we can get rid of that dance in record_image_eq - it very
> > well could used on records originally generated when those bits haven't
> > been guaranteed to be zeroed.
> 
> No, you're failing to think about the context here.

Ah yes. I was completely forgetting that
heap_form_tuple()/heap_fill_tuple() will properly take care to only use
meaningful parts of the (to-be-)stored data, not random padding.

Thanks.

> The risk we take by simplifying comparisons in a more general context
> is that some function somewhere might've been sloppy about doing a
> native-type-to-Datum conversion on its result.  In the case of V0
> functions that risk is unavoidable except by adding some explicit cleanup
> code, but I'm a bit worried that somebody, particularly third-party code,
> might've sloppily written "return foo" in a V1 function when "return
> Int32GetDatum(foo)" would be correct.  In that case, the resultant Datum
> might have not-per-spec high-order bits, and if it reaches the fast
> comparator without ever having been squeezed into a physical tuple,
> we've got a problem.

Too bad V1 hasn't insisted on using PG_RETURN_* macros. That would have
allowed asserts checking against such cases by setting
fcinfo->has_returned = true or such...

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: same-address mappings vs. relative pointers
Следующее
От: "MauMau"
Дата:
Сообщение: [bug fix] pg_ctl always uses the same event source