Re: TOAST, large objects and ACIDity

From: "Alexander Staubo" <alex(at)purefiction(dot)net>
To: "Benoit Mathieu" <benoit(dot)mathieu(at)mist-technologies(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: TOAST, large objects and ACIDity
Date: 2007-07-10 13:48:29
Message-ID: 88daf38c0707100648g58af940x966f977f9ecdd0a0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/10/07, Benoit Mathieu <benoit(dot)mathieu(at)mist-technologies(dot)com> wrote:
> I saw postgres offers at least 2 method : bytea column with TOAST, or
> large objects API.

From the documentation:

> All large objects are placed in a single system table called pg_largeobject.
> PostgreSQL also supports a storage system called "TOAST" that automatically
> stores values larger than a single database page into a secondary storage area
> per table. This makes the large object facility partially obsolete. One remaining
> advantage of the large object facility is that it allows values up to 2 GB in size,
> whereas TOASTed fields can be at most 1 GB. Also, large objects can be
> randomly modified using a read/write API that is more efficient than performing
> such operations using TOAST.

My take: Stick with TOAST unless you need fast random access. TOAST is
faster, more consistently supported (eg., in Slony) and easier to work
with.

If you need fast random access, use the file system. Will you ever be
updating parts of the contents of a single file, or will you be
writing each file just once? If the latter, writing your own robust,
ACID-compliant file storage is fairly trivial.

> * I really care keeping my transaction fully ACID. Documentation on
> large objects doesn't explicitly say if lo_import an lo_export (and
> other primitives) are fully ACID. Some ideas ?

Since the lo_* functions are implemented as relational operations on
the internal large object table, they're ACID-compliant.

Alexander.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-07-10 13:54:53 Re: russian case-insensitive regexp search not working
Previous Message Brad Nicholson 2007-07-10 13:43:44 Vaccum Stalling