Re: Question about speed: Weird Behavior

Поиск
Список
Период
Сортировка
От Samuel Gendler
Тема Re: Question about speed: Weird Behavior
Дата
Msg-id BANLkTim9igjkg9uctSWUBNOMJm9s6mUvbA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Question about speed: Weird Behavior  (Israel Ben Guilherme Fonseca <israel.bgf@gmail.com>)
Ответы Re: Question about speed: Weird Behavior
Список pgsql-jdbc
On Mon, Jun 13, 2011 at 6:07 PM, Israel Ben Guilherme Fonseca <israel.bgf@gmail.com> wrote:

When I use the count, my timings get around of

100 miliseconds.

When I use the select it goes to

30 miliseconds.


I don't know much about the internals of the protocol used to move data around for jdbc, but doesn't this actually make some sense?  If the query returns as soon as the first row has arrived, then select * should definitely be faster than select count(*), since count(*) can't return until the entire table has been scanned, whereas select * returns with the first row received.  That, at least, seems like a likely candidate for the difference between them, no?

--sam


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

Предыдущее
От: Israel Ben Guilherme Fonseca
Дата:
Сообщение: Re: Question about speed: Weird Behavior
Следующее
От: Radosław Smogura
Дата:
Сообщение: Re: Question about speed: Weird Behavior