From: | Sylvain CAILLET <scaillet(at)alaloop(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Create tables performance |
Date: | 2012-07-09 06:49:36 |
Message-ID: | b0287602-acb3-46e6-b376-dcae270a24af@zimbra-ne01.network-studio.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi,
Thank you all for your help.
@Jeff : my daemon creates these tables at start time so it doesn't do anything else at the same time. The CPU is loaded between 20% and 25%.
@Richard : Sure the DB number of table is quite big and sure most of them have the same structure, but it's very hard to move it now so I have to deal with it for a while !
@Craig : I can't run any of the queries. Fo example, " CLUSTER pg_class_oid_index ON pg_catalog.pg_class; " throws a " ERROR: "pg_class" is a system catalog " exception. But, using VACUUM FULL, it's done in less than a second. Autovacuum is on but not tuned in postgresql configuration file.
Sylvain Caillet
----- Mail original -----
On 07/06/2012 11:15 PM, Sylvain CAILLET wrote:
<blockquote>
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.
<blockquote>
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 ?
</blockquote>
That won't be a problem unless your OS and file system are truly crap.
--
Craig Ringer
</blockquote>
From | Date | Subject | |
---|---|---|---|
Next Message | Yan Chunlu | 2012-07-09 09:20:56 | Re: how could select id=xx so slow? |
Previous Message | Nate Allan | 2012-07-09 06:20:41 | Re: Terrible plan for join to nested union |