Re: PostgreSQL Arrays and Performance

From: Joe Conway <mail(at)joeconway(dot)com>
To: Marc Philipp <mail(at)marcphilipp(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL Arrays and Performance
Date: 2006-01-03 19:13:15
Message-ID: 43BACCCB.7010903@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marc Philipp wrote:
> During a daily update process new timestamps are collected and existing
> data rows are being updated (new rows are also being added). These
> changes affect a large percentage of the existing rows.
>
> What we have been observing in the last few weeks is, that the overall
> database size is increasing rapidly due to this table and vacuum
> processes seem to deadlock with other processes querying data from this
> table.

This sounds like it has more to do with inadequate freespace map
settings than use of arrays. Every update creates a dead tuple, and if
it is large (because the array is large) and leaked (because you have no
room in your freespace map), that would explain a rapidly increasing
database size.

> Therefore, the the database keeps growing and becomes more and more
> unusable. The only thing that helps is dumping and restoring it which
> is nothing you are eager to do on a large live system and a daily basis.

Arrays are stored as compressed varlenas, pretty much exactly like
varchar or text fields. However, if your use of arrays causes you to
need to perform updates to a large percentage of your rows on a daily
basis, instead of just inserting new rows, you should probably rethink
your data model.

> Would it be more efficient to not use an array for this purpose but
> split the table in two parts?
>

I think so.

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Alberer 2006-01-03 19:52:08 Re: Problem restoring db-dump on Postgres 8.0.4 Power5
Previous Message Peter Alberer 2006-01-03 19:05:23 Re: Problem restoring db-dump on Postgres 8.0.4 Power5