pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Radosław Smogura <rsmogura@softperience.eu>
To: Samuel Gendler <sgendler@ideasculptor.com>
Cc: Israel Ben Guilherme Fonseca <israel.bgf@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Question about speed: Weird Behavior
Date: Tue, 14 Jun 2011 10:25:35 +0200
Message-ID: <1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu> (raw)
In-Reply-To: <BANLkTim9igjkg9uctSWUBNOMJm9s6mUvbA@mail.gmail.com>
References: <BANLkTimTaoOnVMcuUhnhE5VodRVDSTyH0w@mail.gmail.com>
	<4DF5B7B3.7010708@postnewspapers.com.au>
	<BANLkTimPigO8As72fj7MR59JU9GgzJSuyw@mail.gmail.com>
	<56264945a293522f5d499649330d3f84@mail.softperience.eu>
	<BANLkTiksRx=RvGtLqJgGv+PA4pHhOS_x4A@mail.gmail.com>
	<BANLkTimNhvPo9VeL94o0sxnBCDcRpLKK5A@mail.gmail.com>
	<BANLkTi=HKOK1P0URDTidBuaqGJ2uptzT_w@mail.gmail.com>
	<BANLkTim9igjkg9uctSWUBNOMJm9s6mUvbA@mail.gmail.com>

 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.bgf@gmail.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



view thread (14+ messages)  latest in thread

Message-ID: <1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu>
Permalink:  ../1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu/
Also on:    postgresql.org/message-id/1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: rsmogura@softperience.eu, sgendler@ideasculptor.com, israel.bgf@gmail.com
  Subject: Re: Question about speed: Weird Behavior
  In-Reply-To: <1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu>
  References: <BANLkTimTaoOnVMcuUhnhE5VodRVDSTyH0w@mail.gmail.com> <4DF5B7B3.7010708@postnewspapers.com.au> <BANLkTimPigO8As72fj7MR59JU9GgzJSuyw@mail.gmail.com> <56264945a293522f5d499649330d3f84@mail.softperience.eu> <BANLkTiksRx=RvGtLqJgGv+PA4pHhOS_x4A@mail.gmail.com> <BANLkTimNhvPo9VeL94o0sxnBCDcRpLKK5A@mail.gmail.com> <BANLkTi=HKOK1P0URDTidBuaqGJ2uptzT_w@mail.gmail.com> <BANLkTim9igjkg9uctSWUBNOMJm9s6mUvbA@mail.gmail.com> <1d5c89dfd44bddbdce2eff4e2287f66e@mail.softperience.eu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox