Re: Large text data

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Large text data
Дата
Msg-id 1144368145.32266.120.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на Large text data  ("Antimon" <antimon@gmail.com>)
Список 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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Mike Adams
Дата:
Сообщение: Re: Cant find temp tables
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: posgresql <-> oracle