Skip site navigation (1) Skip section navigation (2)

Re: TOAST usage setting

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: TOAST usage setting
Date: 2007-05-29 16:01:02
Message-ID: 200705291601.l4TG12N06406@momjian.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Gregory Stark wrote:
> "Bruce Momjian" <bruce(at)momjian(dot)us> writes:
> 
> > Gregory Stark wrote:
> >> "Bruce Momjian" <bruce(at)momjian(dot)us> writes:
> >> 
> >> > I tested TOAST using a method similar to the above method against CVS
> >> > HEAD, with default shared_buffers = 32MB and no assert()s.  I created
> >> > backends with power-of-2 seetings for TOAST_TUPLES_PER_PAGE (4(default),
> >> > 8, 16, 32, 64) which gives TOAST/non-TOAST breakpoints of 2k(default),
> >> > 1k, 512, 256, and 128, roughly.
> >> >
> >> > The results are here:
> >> >
> >> > 	http://momjian.us/expire/TOAST/
> >> >
> >> > Strangely, 128 bytes seems to be the break-even point for TOAST and
> >> > non-TOAST, even for sequential scans of the entire heap touching all
> >> > long row values.  I am somewhat confused why TOAST has faster access
> >> > than inline heap data.
> 
> Is your database initialized with C locale? If so then length(text) is
> optimized to not have to detoast:
> 
> 	if (pg_database_encoding_max_length() == 1)
> 		PG_RETURN_INT32(toast_raw_datum_size(str) - VARHDRSZ);

Wow, we optimized length().  OK, will run the test with
substring(t,1,1).

> Also, I think you have to run this for small datasets like you have well as
> large data sets where the random access seek time of TOAST will really hurt.

Well, if everything doesn't fit in the cache, then the smaller heap will
be a bigger win for non-TOAST access, so some of that overhead balances
out.  Let me get in-cache numbers and then I can look at larger data sets.

-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2007-05-29 16:09:16
Subject: Re: TOAST usage setting
Previous:From: Gregory StarkDate: 2007-05-29 15:53:41
Subject: Re: TOAST usage setting

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group