Re: Modifying TOAST_TUPLE_THRESHOLD and TOAST_TUPLE_TARGET?

From: Greg Stark <stark(at)enterprisedb(dot)com>
To: Shadar <shauldar(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Modifying TOAST_TUPLE_THRESHOLD and TOAST_TUPLE_TARGET?
Date: 2009-06-11 14:54:23
Message-ID: 4136ffa0906110754s11b96c74vd057d6293c8ff6cc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 11, 2009 at 3:32 PM, Shadar<shauldar(at)gmail(dot)com> wrote:
>
> I notice that one of my tables gets TOASTed, about 40% of it. I read about
> TOAST and understand the general motivation (get faster access to the
> *other* columns). But in my case the big column (~2.5KB fixed width) is a
> list (array) of values (not text) and the usage pattern is that I always
> access a single row from the table by key and read the full list. So my
> guess is TOAST is doing me more damage than good. Right?

It's possible. It might depend on how much wasted space you'll get in
each 8k block if you store them inline. And also on how cpu-bound
versus i/o-bound your database is.

> I would have liked to disable TOAST (even altogether for my DB) - is there a
> direct way to do this? Alternatively I thought of increasing
> TOAST_TUPLE_THRESHOLD and TOAST_TUPLE_TARGET from 2KB (I believe this is the
> default?) to 4KB? Do I have to change the source (
> http://doxygen.postgresql.org/tuptoaster_8h-source.html here ?) and compile
> a private version of Postgres?

Yeah.

There are a few other options.

You could use "ALTER COLUMN SET STORAGE PLAIN" to disable toasting on
that column entirely. This will disable compression as well though. If
any record doesn't fit in an 8kB block you'll get an error.

Alternately you could leave the column alone but drop the toast table
(presumably having truncated the table first). That will leave
compression enabled but force the system to avoid storing things
externally. Again you'll get an error if a record doesn't fit in 8kB
but only after first trying to compress the data.

--
Gregory Stark
http://mit.edu/~gsstark/resume.pdf

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2009-06-11 14:58:15 Re: Modifying TOAST_TUPLE_THRESHOLD and TOAST_TUPLE_TARGET?
Previous Message Bruce Momjian 2009-06-11 14:50:13 Re: pgindent run coming