postgresql/src/include/access
Tom Lane 54111e9511 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:49 +00:00
..
attnum.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
clog.h Fix recently-understood problems with handling of XID freezing, particularly 2006-11-05 22:42:10 +00:00
genam.h Change the relation_open protocol so that we obtain lock on a relation 2006-07-31 20:09:10 +00:00
gin.h Make use of qsort_arg in several places that were formerly using klugy 2006-10-05 17:57:40 +00:00
gist.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
gist_private.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
gistscan.h Allow include files to compile own their own. 2006-07-13 16:49:20 +00:00
hash.h Allow include files to compile own their own. 2006-07-13 16:49:20 +00:00
heapam.h Fix recently-understood problems with handling of XID freezing, particularly 2006-11-05 22:42:10 +00:00
hio.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
htup.h Fix recently-understood problems with handling of XID freezing, particularly 2006-11-05 22:42:10 +00:00
itup.h Allow include files to compile own their own. 2006-07-13 16:49:20 +00:00
multixact.h Repair two related errors in heap_lock_tuple: it was failing to recognize 2006-11-17 18:00:15 +00:00
nbtree.h Fix "failed to re-find parent key" btree VACUUM failure by revising page 2006-11-01 19:43:17 +00:00
printtup.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
reloptions.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
relscan.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
rmgr.h Fix recently-understood problems with handling of XID freezing, particularly 2006-11-05 22:42:10 +00:00
sdir.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
skey.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
slru.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
subtrans.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
transam.h Fix recently-understood problems with handling of XID freezing, particularly 2006-11-05 22:42:10 +00:00
tupdesc.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
tupmacs.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
tuptoaster.h Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's 2007-02-04 20:00:49 +00:00
twophase.h Allow include files to compile own their own. 2006-07-13 16:49:20 +00:00
twophase_rmgr.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
valid.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
xact.h Alphabetically order reference to include files, "S"-"Z". 2006-07-11 18:26:11 +00:00
xlog.h Fix recently-understood problems with handling of XID freezing, particularly 2006-11-05 22:42:10 +00:00
xlog_internal.h pgindent run for 8.2. 2006-10-04 00:30:14 +00:00
xlogdefs.h Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
xlogutils.h Make the world safe for full_page_writes. Allow XLOG records that try to 2006-04-14 20:27:24 +00:00