postgresql/src
Tom Lane a2e092e1c7 Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's
threshold for tuple length.  On 4-byte-MAXALIGN machines, the toast code
creates tuples that have t_len exactly TOAST_TUPLE_THRESHOLD ... but this
number is not itself maxaligned, so if heap_insert maxaligns t_len before
comparing to TOAST_TUPLE_THRESHOLD, it'll uselessly recurse back to
tuptoaster.c, wasting cycles.  (It turns out that this does not happen on
8-byte-MAXALIGN machines, because for them the outer MAXALIGN in the
TOAST_MAX_CHUNK_SIZE macro reduces TOAST_MAX_CHUNK_SIZE so that toast tuples
will be less than TOAST_TUPLE_THRESHOLD in size.  That MAXALIGN is really
incorrect, but we can't remove it now, see below.)  There isn't any particular
value in maxaligning before comparing to the thresholds, so just don't do
that, which saves a small number of cycles in itself.

These numbers should be rejiggered to minimize wasted space on toast-relation
pages, but we can't do that in the back branches because changing
TOAST_MAX_CHUNK_SIZE would force an initdb (by changing the contents of toast
tables).  We can move the toast decision thresholds a bit, though, which is
what this patch effectively does.

Thanks to Pavan Deolasee for discovering the unintended recursion.

Back-patch into 8.2, but not further, pending more testing.  (HEAD is about
to get a further patch modifying the thresholds, so it won't help much
for testing this form of the patch.)
2007-02-04 20:00:37 +00:00
..
backend Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's 2007-02-04 20:00:37 +00:00
bin Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
include Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's 2007-02-04 20:00:37 +00:00
interfaces Applied Magnus Hagander's patch to take away some compiler warnings. 2007-02-02 09:31:10 +00:00
makefiles Add $(CFLAGS) to the simplified build rule for .so libraries on Darwin. 2006-11-28 05:45:43 +00:00
pl Update some of the "expected" regression test results for Bruce's 2007-02-01 20:11:18 +00:00
port Use sizeof() for snprintf() buffer length. 2007-01-29 20:22:35 +00:00
template Make --with-ldap build on Unixware, per Olivier Prenant. 2006-12-14 21:49:54 +00:00
test Implement XMLSERIALIZE for real. Analogously, make the xml to text cast 2007-02-03 14:06:56 +00:00
timezone Wording cleanup for error messages. Also change can't -> cannot. 2007-02-01 19:10:30 +00:00
tools This patch changes the installscript for vcbuild to actually parse the 2007-02-02 16:25:34 +00:00
tutorial Update CVS HEAD for 2007 copyright. Back branches are typically not 2007-01-05 22:20:05 +00:00
DEVELOPERS Testing commit stuff 2006-07-10 15:50:02 +00:00
Makefile Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
Makefile.global.in On Windows, we know the backend stack size limit because we have to 2006-10-08 17:15:34 +00:00
Makefile.shlib Indent comments in makefiles better so they don't appear in the output. 2007-01-07 08:49:31 +00:00
bcc32.mak Fix bcc32.mak to create and remove pg_config_os.h properly. Apparently 2006-10-06 18:53:53 +00:00
nls-global.mk When merging PO files, take into consideration translations in other PO 2006-04-05 13:40:15 +00:00
win32.mak Fix win32.mak for config cleanup. 2006-08-08 22:44:05 +00:00