Re: [BUGS] SELECT "bug"?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] SELECT "bug"?
Дата
Msg-id 9811.948492996@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT "bug"?  (The Hermit Hacker <scrappy@hub.org>)
Список pgsql-bugs
The Hermit Hacker <scrappy@hub.org> writes:
> select count(1) from webhit_details_formatted where counter_id = 1;
> [ hangs, then crashes when try to cancel ]

Wow, how'd that escape notice for this long?

play=> create table webhit_details_formatted (counter_id int);
CREATE
play=>  select count(1) from webhit_details_formatted where counter_id = 1;
pqReadData() -- backend closed the channel unexpectedly.

Mine just crashes immediately, no waiting.

The good news is that current sources don't seem to have the problem.


> Under Oracle, doing the "SELECT count(1)..." is faster then doing "SELECT
> count(*)..." (supposedly), since it doesn't have to retrieve all the
> information, only count how many records match the WHERE clause ...

Under Postgres, there's no difference --- in fact, the parser currently
converts count(*) into count(1) ;-)

            regards, tom lane

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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: SELECT "bug"?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] SELECT "bug"?