pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: Greg Stark <gsstark@MIT.EDU>
Cc: Eric Brown <bigwhitecow@hotmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: severe performance issue with planner
Date: 12 Mar 2004 13:14:46 -0500
Message-ID: <87wu5q3pbd.fsf@stark.xeocode.com> (raw)
In-Reply-To: <873c8e54ji.fsf@stark.xeocode.com>
References: <BAY13-F54DwKAYzTkuA00017c9b@hotmail.com>
	<873c8e54ji.fsf@stark.xeocode.com>


Sorry, I forgot a key clause there:

Greg Stark <gsstark@MIT.EDU> 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




view thread (8+ messages)  latest in thread

Message-ID: <87wu5q3pbd.fsf@stark.xeocode.com>
Permalink:  ../87wu5q3pbd.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87wu5q3pbd.fsf@stark.xeocode.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: gsstark@mit.edu, bigwhitecow@hotmail.com
  Subject: Re: severe performance issue with planner
  In-Reply-To: <87wu5q3pbd.fsf@stark.xeocode.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox