On Sun, 18 Feb 2001, Chris Humphries wrote:

>              Table "facts"
>   Attribute  |     Type     | Modifier
> -------------+--------------+----------
>  keyword     | varchar(80)  |
>  description | varchar(255) |
>  url         | varchar(255) |
>
> select keyword from facts as f1
> where 1 <> (select count(*) from facts as f2 where f1.keyword = f2.keyword)
> order by keyword;
>
> it took about 65 minutes to complete. i know that it is doing alot of work,
> but it there a way that it could be sped up, like something i could configure
> or something that i could do to make it faster?

Hm, this will probably run the subquery for every row in the table.  Try:

select keyword, count(keyword) from facts
group by keyword
having 1 <> count(keyword)
order by count(keyword) desc

Is this any faster?
-- 
Tod McQuillin


Reply via email to