Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 8EEC66503C6 for ; Mon, 3 Nov 2008 20:31:35 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 63788-03-6 for ; Mon, 3 Nov 2008 20:31:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lion.animals (mail.refractions.net [24.68.236.214]) by mail.postgresql.org (Postfix) with ESMTP id 6A886650420 for ; Mon, 3 Nov 2008 20:29:28 -0400 (AST) Received: by lion.animals (Postfix, from userid 88) id 25528ED0305; Mon, 3 Nov 2008 16:29:26 -0800 (PST) Received: from [192.168.50.85] (unknown [192.168.50.85]) by lion.animals (Postfix) with ESMTP id 9FAB2ED02FE for ; Mon, 3 Nov 2008 16:29:25 -0800 (PST) Message-ID: <490F9762.4030603@refractions.net> Date: Mon, 03 Nov 2008 16:29:22 -0800 From: Kevin Neufeld User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: many tables vs large tables Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200811/16 X-Sequence-Number: 30670 What is the general consensus around here ... to have many smaller tables, or have a few large tables? I'm looking at a db model where a client has around 5500 spatial (PostGIS) tables, where the volume of each one varies greatly ... from a few hundred rows to over 250,000. Speed is of the utmost importance. I'm investigating various options, like grouping the tables based on a common attribute or spatial type (POINT, LINESTRING, etc) into many multi-million tuple tables. Or, table inheritance could be my friend here, in terms of performance. Ie. Using inheritance and constraint exclusion, the query planner could quickly isolate the tables of interest. It's orders of magnitude faster to perform a sequential scan through a relatively small table than it is to do an index scan on a large, likely unclustered table. The question is, can the underlying OS handle thousands of tables in a tablespace? Would it overwhelm the parser to perform constraint exclusion on 50-100 tables? Can it be done relatively quickly? Clearly, serious testing is in order, but I just wanted to get a feel for things before I dive in. Cheers, Kevin