Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id B3A3219B3F2A for ; Mon, 28 Nov 2011 13:05:47 -0400 (AST) Received: from gwmta.wicourts.gov ([165.219.244.99] helo=gw.wicourts.gov) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RV4eG-0006qZ-O4 for pgsql-performance@postgresql.org; Mon, 28 Nov 2011 17:05:46 +0000 Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Mon, 28 Nov 2011 11:05:28 -0600 Message-Id: <4ED36AF0020000250004354F@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Mon, 28 Nov 2011 11:05:20 -0600 From: "Kevin Grittner" To: "Joost Kraaijeveld" , Subject: Re: PostgreSQL 9.1 : why is this query slow? References: <1322498526.3343.22.camel@panoramix.Askesis.nl> <1322499469.3343.25.camel@panoramix.Askesis.nl> In-Reply-To: <1322499469.3343.25.camel@panoramix.Askesis.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Pg-Spam-Score: -5.4 (-----) X-Archive-Number: 201111/274 X-Sequence-Number: 45785 Joost Kraaijeveld wrote: > This query goes faster (6224 ms, but I am not sure it gives the > correct answer as the result differs from my Java program): It seems clear that you want to see words which appear with all three types of files, but it's not clear what you want the count to represent. The number of times the word appears in filetype 'n' references (as specified in your second query)? The number of permutations of documents which incorporate one 'f' document, one 's' document, and one 'n' document (as specified in your first query). Something else, like the total number of times the word appears? -Kevin