pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Non-blocking SQL Execution
4+ messages / 3 participants
[nested] [flat]

* Non-blocking SQL Execution
@ 2005-11-01 00:06  Logan Bowers <logan@zillow.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Logan Bowers @ 2005-11-01 00:06 UTC (permalink / raw)
  To: pgsql-jdbc

Hello,

 

(sorry if this comes through twice)

 

I'm running a web application that needs to run several queries against
several databases

to satisfy a single request.  To minimize latency I'd like to be able to
issue

"<PreparedStatement Object>.executeQuery()" on each connection, allow
the servers to

execute the queries in parallel, and then only block when I attempt to
fetch the first

row.

 

My anecdotal experience with JDBC drivers in general are that they block
when you attempt

to execute the query, not when you attempt to retrieve data.  Is this
the case for the

Postgres driver?  Does anyone have a feel for how hard it would be to
modify the driver

allow queries to be executed in the background?  Thanks!

 

Logan Bowers

 

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Non-blocking SQL Execution
@ 2005-11-01 00:49  Dave Cramer <pg@fastcrypt.com>
  parent: Logan Bowers <logan@zillow.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Dave Cramer @ 2005-11-01 00:49 UTC (permalink / raw)
  To: Logan Bowers <logan@zillow.com>; +Cc: pgsql-jdbc

It's probably easier to create a non-blocking thread which  
encapsulates the driver

And yes, the postgres driver blocks on the execute.

Dave
On 31-Oct-05, at 7:06 PM, Logan Bowers wrote:

> Hello,
>
>
>
> (sorry if this comes through twice)
>
>
>
> I'm running a web application that needs to run several queries  
> against several databases
>
> to satisfy a single request.  To minimize latency I'd like to be  
> able to issue
>
> "<PreparedStatement Object>.executeQuery()" on each connection,  
> allow the servers to
>
> execute the queries in parallel, and then only block when I attempt  
> to fetch the first
>
> row.
>
>
>
> My anecdotal experience with JDBC drivers in general are that they  
> block when you attempt
>
> to execute the query, not when you attempt to retrieve data.  Is  
> this the case for the
>
> Postgres driver?  Does anyone have a feel for how hard it would be  
> to modify the driver
>
> allow queries to be executed in the background?  Thanks!
>
>
>
> Logan Bowers
>
>
>
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Non-blocking SQL Execution
@ 2005-11-01 00:57  Logan Bowers <logan@zillow.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Logan Bowers @ 2005-11-01 00:57 UTC (permalink / raw)
  To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc

Ah yes, I like this strategy, it will actually make things easier in my
application for dealing with timeouts and such (since they can be
handled in the thread).  Thanks!  

 

Logan Bowers

 

________________________________

From: Dave Cramer [mailto:pg@fastcrypt.com] 
Sent: Monday, October 31, 2005 4:50 PM
To: Logan Bowers
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Non-blocking SQL Execution

 

It's probably easier to create a non-blocking thread which encapsulates
the driver

 

And yes, the postgres driver blocks on the execute.

 

Dave

On 31-Oct-05, at 7:06 PM, Logan Bowers wrote:





Hello,

 

(sorry if this comes through twice)

 

I'm running a web application that needs to run several queries against
several databases

to satisfy a single request.  To minimize latency I'd like to be able to
issue

"<PreparedStatement Object>.executeQuery()" on each connection, allow
the servers to

execute the queries in parallel, and then only block when I attempt to
fetch the first

row.

 

My anecdotal experience with JDBC drivers in general are that they block
when you attempt

to execute the query, not when you attempt to retrieve data.  Is this
the case for the

Postgres driver?  Does anyone have a feel for how hard it would be to
modify the driver

allow queries to be executed in the background?  Thanks!

 

Logan Bowers

 





 

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Non-blocking SQL Execution
@ 2005-11-01 16:21  Craig Servin <cservin@cromagnon.com>
  parent: Logan Bowers <logan@zillow.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Craig Servin @ 2005-11-01 16:21 UTC (permalink / raw)
  To: pgsql-jdbc

If your using a 1.5 JDK a  java.util.concurrent.FutureTask is a nice way to do 
this.





On Monday 31 October 2005 06:57 pm, Logan Bowers wrote:
> Ah yes, I like this strategy, it will actually make things easier in my
> application for dealing with timeouts and such (since they can be
> handled in the thread).  Thanks!
>
>
>
> Logan Bowers
>
>
>
> ________________________________
>
> From: Dave Cramer [mailto:pg@fastcrypt.com]
> Sent: Monday, October 31, 2005 4:50 PM
> To: Logan Bowers
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] Non-blocking SQL Execution
>
>
>
> It's probably easier to create a non-blocking thread which encapsulates
> the driver
>
>
>
> And yes, the postgres driver blocks on the execute.
>
>
>
> Dave
>
> On 31-Oct-05, at 7:06 PM, Logan Bowers wrote:
>
>
>
>
>
> Hello,
>
>
>
> (sorry if this comes through twice)
>
>
>
> I'm running a web application that needs to run several queries against
> several databases
>
> to satisfy a single request.  To minimize latency I'd like to be able to
> issue
>
> "<PreparedStatement Object>.executeQuery()" on each connection, allow
> the servers to
>
> execute the queries in parallel, and then only block when I attempt to
> fetch the first
>
> row.
>
>
>
> My anecdotal experience with JDBC drivers in general are that they block
> when you attempt
>
> to execute the query, not when you attempt to retrieve data.  Is this
> the case for the
>
> Postgres driver?  Does anyone have a feel for how hard it would be to
> modify the driver
>
> allow queries to be executed in the background?  Thanks!
>
>
>
> Logan Bowers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-11-01 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-01 00:06 Non-blocking SQL Execution Logan Bowers <logan@zillow.com>
2005-11-01 00:49 ` Dave Cramer <pg@fastcrypt.com>
2005-11-01 00:57 Re: Non-blocking SQL Execution Logan Bowers <logan@zillow.com>
2005-11-01 16:21 ` Craig Servin <cservin@cromagnon.com>

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