Re: is this expected or am i on crack?

From: Tod McQuillin <devin(at)spamcop(dot)net>
To: Chris Humphries <chumphries(at)siliconinc(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: is this expected or am i on crack?
Date: 2001-02-23 04:00:13
Message-ID: Pine.GSO.4.31.0102222155270.13223-100000@sysadmin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ian Lance Taylor 2001-02-23 04:04:06 Re: Building SPI programs
Previous Message Aristide Aragon 2001-02-23 03:58:29 Re: Building SPI programs