From: Craig Ringer <ringerc@ringerc.id.au>
To: Sylvain CAILLET <scaillet@alaloop.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Create tables performance
Date: Sat, 07 Jul 2012 10:27:39 +0800
Message-ID: <4FF79E9B.8040304@ringerc.id.au> (raw)
In-Reply-To: <2ea3ab10-6768-45f2-a748-7f6c94be30fc@zimbra-ne01.network-studio.com>
References: <2ea3ab10-6768-45f2-a748-7f6c94be30fc@zimbra-ne01.network-studio.com>
On 07/06/2012 11:15 PM, Sylvain CAILLET wrote:
> Hi to all,
>
> I run Postgresql 8.3.9 on a dedicated server running with Debian
> 5.0.4, a strong bi quad-proc with RAM 16Go. My biggest db contains at
> least 100 000 tables. Last time, I started a Java process I use to
> make some change on it, it created 170 new tables and it took one full
> minute. That is a very long time for such a process on such a server !
If you create and drop a lot of tables, you need to make sure you're
vacuuming the pg_catalog tables frequently. Newer versions mostly take
care of this for you, but on 8.3 you'll at minimum have to turn
autovaccum right up.
See what happens if you run in psql, as a Pg superuser (usually the
"postgres" account):
CLUSTER pg_class_oid_index ON pg_catalog.pg_class;
CLUSTER pg_type_oid_index ON pg_catalog.pg_type;
CLUSTER pg_attribute_relid_attnam_index ON pg_catalog.pg_attribute;
CLUSTER pg_index_indexrelid_index ON pg_catalog.pg_index;
I'm guessing you have severe table bloat in your catalogs, in which case
this may help. I use CLUSTER instead of VACCUUM FULL because on old
versions like 8.3 it'll run faster and sort the indexes for you too.
> Do you think there could be some configuration tuning to do to improve
> the performance for create tables ?
> Or do I have to use tablespaces because 100000 files in a single
> folder is a too many for OS ?
That won't be a problem unless your OS and file system are truly crap.
--
Craig Ringer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: ringerc@ringerc.id.au, scaillet@alaloop.com
Subject: Re: Create tables performance
In-Reply-To: <4FF79E9B.8040304@ringerc.id.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox