Re: is this expected or am i on crack?

Поиск
Список
Период
Сортировка
От Tod McQuillin
Тема Re: is this expected or am i on crack?
Дата
Msg-id Pine.GSO.4.31.0102222155270.13223-100000@sysadmin
обсуждение исходный текст
Ответ на is this expected or am i on crack?  (Chris Humphries <chumphries@siliconinc.net>)
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Ian Lance Taylor
Дата:
Сообщение: Re: Building SPI programs
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: [INTERFACES] Re: Chinese patch for Pgaccess