Skip site navigation (1) Skip section navigation (2)

Re: Backend Protocol

From: Barry Lind <barry(at)xythos(dot)com>
To: dave(at)fastcrypt(dot)com
Cc: "'PostgreSQL-development'" <pgsql-jdbc(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Backend Protocol
Date: 2001-11-06 03:11:38
Message-ID: 3BE754EA.7080704@xythos.com (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackerspgsql-jdbc
Dave,

This is documented in the Developer's Guide (Chapter 4 Frontend/Backend 
Protocol of the 7.1 docs).

A few days ago I added this same item the the jdbc todo list.  I don't 
think the implementation will need to do anything different at the FE/BE 
protocol level.  Instead my thoughts on this are to wrap all jdbc 
Statements/Prepared Statements doing selects in a sql cursor, and then 
issuing fetch statements to set sets of rows instead of the entire 
result set.

Thus 'select foo from bar'

Whould get executed by the driver as:

declare barcursor cursor as select foo from bar;

followed by:

fetch forward 10 from barcursor;

(to select the first 10 rows)

additional fetches as needed...

finally:

close barcursor;

Just when this should be done (i.e. you probably don't want to overhead 
of using a cursor for every select statement), how many rows to fetch at 
a time (perhaps you might want to fetch 100 rows per call to minimize 
network roundtrips) would need to be configurable somehow.

Also not the the jdbc2 spec has methods for setCursorName(), etc. and 
just how they would play into this I don't know.

thanks,
--Barry



Dave Cramer wrote:

> Hi,
> 
> I am looking at changing the jdbc driver to be asynchronous, in other
> words retrieve the result set when asked as opposed to retrieving it all
> before returning.
> 
> This will involve understanding the client/backend protocol completely.
> So far I have found one reference to this. Does anyone have a flow chart
> or can point me to any other references.
> 
> Dave
> 
> 



In response to

pgsql-hackers by date

Next:From: Peter HarveyDate: 2001-11-06 03:47:45
Subject: Re: compiler warnings in ODBC
Previous:From: Vince VielhaberDate: 2001-11-06 03:03:45
Subject: Re: Beta going well

pgsql-committers by date

Next:From: thomasDate: 2001-11-06 16:27:32
Subject: pgsql/src/include/utils cash.h
Previous:From: tglDate: 2001-11-06 01:15:29
Subject: pgsql/src/backend/utils/misc ps_status.c

pgsql-jdbc by date

Next:From: Barry LindDate: 2001-11-06 04:54:37
Subject: Re:
Previous:From: Barry LindDate: 2001-11-06 02:58:04
Subject: Re: Encoding weirdness with JDBC, driver crashing?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group