Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 26C209FBF16 for ; Tue, 30 Oct 2007 15:57:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 47640-10 for ; Tue, 30 Oct 2007 15:56:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by postgresql.org (Postfix) with ESMTP id 721449F98DE for ; Tue, 30 Oct 2007 15:56:57 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id j3so173741ugf for ; Tue, 30 Oct 2007 11:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=xUm1W4eU7NLLmekRfutRopTkZc63AA9JNJ6S9nn6TBs=; b=tXUFUnWnzql6kSRwvWhxMNM/SHadM5TQ9iV3T5gDRnQnZ10/XgCqQQSnu6yHkPVEiACKs7n6LFNZXWZClFm/cfNlwpsxDbFZQZ+2aVxPDeUMiZv5aDJqNHCLc78lw4bPsLZf+KAzVff9FDBLXi5DoEETies3N1VzXpc8Xxn7oCo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=Z2s4k9gII5nY2LsaY1nex/swK3B53X5EMuAQzCPS9RqLrVGHZi2JG2qY6nsmhngxOJnlabXipXUwOJ4DYg4R2SwysAazubCQ+0e6xvOCh7UvAP4gVNXhIFo4ga/1PBsT5IfbghrFeNK3BoUg4ulpPpAnYrwTa+U5o0InWCmAd0o= Received: by 10.67.31.5 with SMTP id i5mr297062ugj.1193770615989; Tue, 30 Oct 2007 11:56:55 -0700 (PDT) Received: from ?192.168.1.33? ( [86.27.233.204]) by mx.google.com with ESMTPS id b35sm2003442ugd.2007.10.30.11.56.53 (version=SSLv3 cipher=RC4-MD5); Tue, 30 Oct 2007 11:56:54 -0700 (PDT) Message-ID: <47277E72.6010101@enterprisedb.com> Date: Tue, 30 Oct 2007 18:56:50 +0000 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: Pablo Alcaraz CC: pgsql-performance@postgresql.org Subject: Re: tables with 300+ partitions References: <47277341.7070704@laotraesquina.com.ar> In-Reply-To: <47277341.7070704@laotraesquina.com.ar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/365 X-Sequence-Number: 27387 Pablo Alcaraz wrote: > I had a big big big table. I tried to divide it in 300 partitions with > 30M rows each one. The problem was when I used the table to insert > information: the perfomance was LOW. That's very vague. What exactly did you do? Just inserted a few rows, or perhaps a large bulk load of millions of rows? What was the bottleneck, disk I/O or CPU usage? How long did the operation take, and how long did you expect it to take? > I did some testing. I created a 300 partitioned empty table. Then, I > inserted some rows on it and the perfomance was SLOW too. > > SLOW = 1% perfomance compared with a non partitioned table. That is too > much. > > Then, I did a 10 partitioned table version with 30M rows each one and I > inserted rows there. The performance was the same that the no > partitioned table version. That suggests that the CPU time is spent in planning the query, possibly in constraint exclusion. But that's a very different scenario from having millions of rows in each partition. > I suspect there is a lock problem there. I think every SQL command do a > lock to ALL the partitions so the perfomance with concurrent inserts and > updates are far worst than the no partitioned version. Every query takes an AccessShareLock on each partition, but that doesn't prevent concurrent inserts or updates, and acquiring the locks isn't very expensive. In other words: no, that's not it. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com