Re: Schemas vs partitioning vs multiple databases for archiving

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Bartel Viljoen <bartel(at)ncc(dot)co(dot)za>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schemas vs partitioning vs multiple databases for archiving
Date: 2012-08-18 08:29:22
Message-ID: 502F5262.1050401@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/18/2012 04:05 PM, Bartel Viljoen wrote:
> Dear mailing list.
>
> My current application make use of partitioning by creating a new child
> table which holds transaction records for every month. I’ve notice that
> after a couple of months depending on the hardware at some of our
> clients the inserts become very slow.

Look into the cause of that before trying to fix it. Why do they slow
down? "Memory" is unlikely to be the explanation, unless there's more
going on than you're saying, like a big trigger function.

If you're having trouble with constraint exclusion based partitioning
and inserts, try inserting directly into the target partition, not the
"common" table all the partitions inherit from.

Use `EXPLAIN ANALYZE` to examine some INSERTs and see what's going on.
Look at `vmstat`, `iostat`, etc for system load, see if you can tell
what's limiting the system. Turn checkpoint logging on and examine the
Pg log files to see if you're checkpointing too often.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2012-08-18 11:01:06 Re: Schemas vs partitioning vs multiple databases for archiving
Previous Message Craig Ringer 2012-08-18 08:25:44 Re: Views versus user-defined functions: formatting, comments, performance, etc.