Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id D8AD39F9CDE; Fri, 24 Aug 2007 21:42:19 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 15516-02; Fri, 24 Aug 2007 21:42:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sumo.dreamhost.com (sumo.dreamhost.com [66.33.216.29]) by postgresql.org (Postfix) with ESMTP id D31AF9F9CD3; Fri, 24 Aug 2007 21:42:16 -0300 (ADT) Received: from spunkymail-a9.g.dreamhost.com (sd-green-bigip-83.dreamhost.com [208.97.132.83]) by sumo.dreamhost.com (Postfix) with ESMTP id E33591B7F3E; Fri, 24 Aug 2007 17:42:15 -0700 (PDT) Received: from [68.26.254.37] (001-775-906.area1.spcsdns.net [68.26.254.37]) by spunkymail-a9.g.dreamhost.com (Postfix) with ESMTP id B10542109A; Fri, 24 Aug 2007 17:42:10 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3147EF26-2649-4FDF-BD86-2DB0AF8460FC@benjaminarai.com> Reply-To: me@benjaminarai.com Content-Transfer-Encoding: 7bit From: "Benjamin Arai" Subject: Partioning tsearch2 a table into chunks and accessing via views Date: Fri, 24 Aug 2007 17:41:48 -0700 To: PostgreSQL , pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.316 tagged_above=0 required=5 tests=BAYES_50=0.001, SARE_MILLIONSOF=0.315 X-Spam-Level: X-Archive-Number: 200708/1546 X-Sequence-Number: 119395 Hi, I have an application which loads millions of NEW documents each month into a PostgreSQL tsearch2 table. I have the initial version completed and searching performance is great but my problem is that each time a new month rolls around I have to drop all the indexes do a COPY and re-index the entire table. This is problematic considering that each month takes longer than the previous to rebuild the indexes and the application in unavailable during the rebuilding process. In order to avoid the re-indexing I was thinking of instead creating a new table each month (building its indexes and etc) and accessing them all through a view. This way I only have to index the new data each month. Does this work? Does a view with N tables make it N times slower for tsearch2 queries? Is there a better solution? Benjamin