nbtsort.c performs unneeded (though harmless) truncation

Started by Peter Geogheganabout 8 years ago3 messageshackers
Jump to latest

I noticed that we're calling _bt_nonkey_truncate() needlessly when a
minimum key is needed at the leftmost page on each level of the tree.
This was always a special case, and I think that it should remain as
one. Attached patch avoids unneeded truncations, while preserving the
generic BTreeTupleGetNAtts() assertions.

This isn't a correctness issue, and the extra overhead of unneeded
truncation should be negligible, but what we have now seems confusing
to me.

--
Peter Geoghegan

Attachments:

0001-Don-t-truncate-away-non-key-attributes-for-leftmost-.patchapplication/octet-stream; name=0001-Don-t-truncate-away-non-key-attributes-for-leftmost-.patchDownload+14-17
#2Teodor Sigaev
teodor@sigaev.ru
In reply to: Peter Geoghegan (#1)
Re: nbtsort.c performs unneeded (though harmless) truncation

Thank you, pushed.

Peter Geoghegan wrote:

I noticed that we're calling _bt_nonkey_truncate() needlessly when a
minimum key is needed at the leftmost page on each level of the tree.
This was always a special case, and I think that it should remain as
one. Attached patch avoids unneeded truncations, while preserving the
generic BTreeTupleGetNAtts() assertions.

This isn't a correctness issue, and the extra overhead of unneeded
truncation should be negligible, but what we have now seems confusing
to me.

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

In reply to: Teodor Sigaev (#2)
Re: nbtsort.c performs unneeded (though harmless) truncation

On Fri, May 4, 2018 at 2:39 AM, Teodor Sigaev <teodor@sigaev.ru> wrote:

Thank you, pushed.

Thanks.

--
Peter Geoghegan