Re: Question about speed: Weird Behavior

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
Cc: Israel Ben Guilherme Fonseca <israel(dot)bgf(at)gmail(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Question about speed: Weird Behavior
Date: 2011-06-14 08:25:35
Message-ID: 1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, 13 Jun 2011 21:44:45 -0700, Samuel Gendler wrote:
> On Mon, Jun 13, 2011 at 6:07 PM, Israel Ben Guilherme Fonseca wrote:
>
>> When I use the count, my timings get around of
>>
>> 100 miliseconds.
>>
>> When I use the select it goes to
>>
>> 30 miliseconds.
>
> I dont know much about the internals of the protocol used to move
> data
> around for jdbc, but doesnt 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(*) cant
> 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
>
>
>
> Links:
> ------
> [1] mailto:israel(dot)bgf(at)gmail(dot)com
Did you ran your queries in above order or did you changed order of
queries. Please bear in mind, that if you set fetch size, then cursor
approch will be used and not all data will be transferred to client
side.

Regards,
Radek

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Israel Ben Guilherme Fonseca 2011-06-14 11:22:50 Re: Question about speed: Weird Behavior
Previous Message Radosław Smogura 2011-06-14 08:15:05 Re: Question about speed: Weird Behavior