X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2CBAA52CDF for ; Thu, 14 Jul 2005 05:45:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22321-08 for ; Thu, 14 Jul 2005 08:45:28 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 8BFB052B2D for ; Thu, 14 Jul 2005 05:45:27 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 781F3415A78; Thu, 14 Jul 2005 09:45:24 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 65D6115EDE; Thu, 14 Jul 2005 09:31:05 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08464-09; Thu, 14 Jul 2005 09:31:02 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id CB80015ED9; Thu, 14 Jul 2005 09:31:01 +0100 (BST) Message-ID: <42D622C5.9000907@archonet.com> Date: Thu, 14 Jul 2005 09:31:01 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frank Hagstrom Cc: pgsql-sql@postgresql.org Subject: Re: Possible to use a table to tell what table to select from? References: <28b4448e05070813326d98e574@mail.gmail.com> In-Reply-To: <28b4448e05070813326d98e574@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/123 X-Sequence-Number: 22101 Frank Hagstrom wrote: > Hello > > I've been thinking on a potential problem I might get in a distant > future, but once I started thinking on it I just as well had to > check... > > Is it possible to have say ~ 6 tables, where the first one is a > 'reference' to all the others (they all are with the same structure). > The other 5 or so have information stored in importance/access/age, > where one table will be only recent/important things, the other with a > bit lower priority and so on until the last table that can be really > huge and slow and used more like a storage ... Is it possible to write > an SQL query to let the first table figure out what table one will do > the actual select from? If the tables are all holding the same sort of thing, e.g. logs2003, logs2004, logs2005 etc. then you might want to look at partitioning. This is being looked at for the next version, check the archives of the hackers list. -- Richard Huxton Archonet Ltd