Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 925769FB324 for ; Mon, 4 Jun 2007 16:44:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 63778-01-6 for ; Mon, 4 Jun 2007 16:44:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from oxford.xeocode.com (unknown [87.127.95.194]) by postgresql.org (Postfix) with ESMTP id D30379FA2DF for ; Mon, 4 Jun 2007 16:43:43 -0300 (ADT) Received: from localhost.enta.net ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1HvISo-00011a-VE; Mon, 04 Jun 2007 20:43:39 +0100 From: Gregory Stark To: "Thomas Andrews" Cc: "Mark Lewis" , Subject: Re: Thousands of tables versus on table? In-Reply-To: <46645DD9.7030805@soliantconsulting.com> (Thomas Andrews's message of "Mon, 04 Jun 2007 14:45:45 -0400") Organization: EnterpriseDB References: <1180980943.31471.322.camel@archimedes> <46645DD9.7030805@soliantconsulting.com> X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 802) Date: Mon, 04 Jun 2007 20:43:38 +0100 Message-ID: <877iqjmro5.fsf@oxford.xeocode.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.116 tagged_above=0 required=5 tests=AWL=-0.335, BAYES_50=0.001, FORGED_RCVD_HELO=0.135, SARE_MILLIONSOF=0.315 X-Spam-Level: X-Archive-Number: 200706/40 X-Sequence-Number: 25073 "Thomas Andrews" writes: > I guess my real question is, does it ever make sense to create thousands of > tables like this? Sometimes. But usually it's not a good idea. What you're proposing is basically partitioning, though you may not actually need to put all the partitions together for your purposes. Partitioning's main benefit is in the management of the data. You can drop and load partitions in chunks rather than have to perform large operations on millions of records. Postgres doesn't really get any faster by breaking the tables up like that. In fact it probably gets slower as it has to look up which of the thousands of tables you want to work with. How often do you update or delete records and how many do you update or delete? Once per day is a very low frequency for vacuuming a busy table, you may be suffering from table bloat. But if you never delete or update records then that's irrelevant. Does reindexing or clustering the table make a marked difference? I would suggest you post your schema and the results of "vacuum verbose". -- Gregory Stark EnterpriseDB http://www.enterprisedb.com