Hi Yanni,

On 30 Jul 2013, at 05:17, Yanni Chiu <ya...@rogers.com> wrote:

> On 29/07/13 7:08 PM, Sven Van Caekenberghe wrote:
>> 
>> The explanation for the slowdown must be in the PgV2 driver.
> 
> The PgV2 protocol is described at:
>  http://www.postgresql.org/docs/7.1/static/protocol-message-formats.html
> 
> Have a glance at the "AsciiRow" and "BinaryRow" message formats. The driver 
> reads the data off the socket, parsing the the data, as described as 
> described by the message format. With the V2 protocol design, you have to 
> read the result row, one field at a time.
> 
> IIUC, in the newer V3? protocol, the AsciiRow/BinaryRow message is replaced 
> by a DataRow message. The DataRow message has the message size included, 
> which could allow the driver to read the entire set of fields for one data 
> row, using a single socket read (or a few buffer sized reads).
> 
> I recall seeing an experimental V3 protocol implementation, a few years back 
> - sorry, no links handy. It would be nice to see some benchmarks.
> 
> Hope that helps.

Thanks for the response.

I believe the V3 project is here http://www.squeaksource.com/PostgresV3.html.

Now, I probably spoke too fast and should have taken Mariano's advice to never 
speculate and first measure. Here is my quick test that, for me, shows that 
PostgresV2 seems more than fast enough (something that I had experienced before 
without doing benchmarks).

[ self execute: 'select longitude,latitude from log_data limit 10000;' ] 
timeToRun. 

=> 76 ms

[ self execute: 'select longitude,latitude from log_data limit 100000;' ] 
timeToRun. 

=> 765 ms

This is querying for 2 floats from a huge table, over the network. Pretty fast 
;-)

So, back to Chris: what exactly are you doing that is (so) slow ?

Anyway, thanks Yanni for all your work on the existing driver !

Sven

--
Sven Van Caekenberghe
Proudly supporting Pharo
http://pharo.org
http://association.pharo.org
http://consortium.pharo.org





Reply via email to