Re: Large text data

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Antimon <antimon(at)gmail(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Large text data
Date: 2006-04-07 00:02:25
Message-ID: 1144368145.32266.120.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2006-04-06 at 17:18, Antimon wrote:
> Hi,
> I need to store text entries and i use text datatype. I want to ask if
> it will be better to split text and entry information?
>
> I mean, i can use a table like, (id, authorid, insertdate, editdate,
> threadid, textdata) or i can have an entrytexts table (id, entryid,
> textdata) and a foreign key on entryid -> entries.id.
> Which would be better? I might need to do some range searches and
> orders on entries so i thought splitting text might decrease some
> overhead?
>
> Or shall i just use one table?

Text over a certain size gets moved out of the main table and stored in
the toast table, so there's not that huge of a hit in terms of
performance.

It's really a question of relativity. If you're non large text fields
will add up to a couple hundred bytes, there's no great gain moving the
text to another table, and when you join them, you've got the overhead
of joining two separate tables.

OTOH, if you'll be storing one int, one date, and one 10 character or so
text keyword or something, then it might be worth your while to move the
text out.

If you're always gonna grab the text at the same time, leave it in the
table. If you'll grab it once every 1,000 or so accesses, separate may
be better.

Nothing beats a benchmark. But knowing that the database automagically
compresses and stores text (over a certain size) helps you realize why
you won't get huge returns on moving the text to another table.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-04-07 00:35:45 Re: posgresql <-> oracle
Previous Message Mike Adams 2006-04-07 00:01:11 Re: Cant find temp tables