X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1BE5FD1B989 for ; Fri, 12 Mar 2004 18:14:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98491-10 for ; Fri, 12 Mar 2004 14:14:48 -0400 (AST) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by svr1.postgresql.org (Postfix) with ESMTP id A0019D1B903 for ; Fri, 12 Mar 2004 14:14:46 -0400 (AST) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by smtp.istop.com (Postfix) with ESMTP id 9713717C416; Fri, 12 Mar 2004 13:14:46 -0500 (EST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1B1rBG-0003dg-00; Fri, 12 Mar 2004 13:14:46 -0500 To: Greg Stark Cc: "Eric Brown" , pgsql-performance@postgresql.org Subject: Re: severe performance issue with planner References: <873c8e54ji.fsf@stark.xeocode.com> In-Reply-To: <873c8e54ji.fsf@stark.xeocode.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 12 Mar 2004 13:14:46 -0500 Message-ID: <87wu5q3pbd.fsf@stark.xeocode.com> Lines: 46 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/161 X-Sequence-Number: 6017 Sorry, I forgot a key clause there: Greg Stark writes: > select w8.wid, > w8.variant, > w8.num_variants, > sum_text(w8.unicode) as unicodes, > sum_text(w8.pinyin) as pinyins > from ( > select wid,variant, > from words > where (sequence = 0 and pinyin = 'zheng4') > OR (sequence = 1 and pinyin like 'ji_') > OR (sequence = 2 and pinyin like 'guan_') > OR (sequence = 3 and pinyin like 'kai_') > OR (sequence = 4 and pinyin like 'fang_') > OR (sequence = 5 and pinyin like 'xi_') > OR (sequence = 6 and pinyin like 'tong_') > OR (sequence = 7 and pinyin like 'fu_') > group by wid,variant > having count(*) = 8 > ) as w > join words as w8 using (wid,variant) where w8.sequence = 8 Or perhaps that ought to be join words as w8 on ( w8.wid=w.wid and w8.variant=w.variant and w8.sequence = 8) or even join (select * from words where sequence = 8) as w8 using (wid,variant) I think they should all be equivalent though. -- greg