Re: executeQuery and busy waiting

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: Garrick Dasbach <Garrick(at)musicrebellion(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: executeQuery and busy waiting
Date: 2003-06-27 18:53:18
Message-ID: 1056739998.1301.15.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Garrick,

It would help if you posted a small program to replicate the problem.

Dave
On Fri, 2003-06-27 at 14:44, Garrick Dasbach wrote:
> I'm working on a project with Postgresql and I'm running into a strange
> problem.
>
> I have a Java Program running on the Database server that periodicly
> connects to the Database and runs a pl/pgsql function. This function
> should run fairly fast, but could take several minutes based on the load
> of the server and amount of information it needs to process.
>
> Running the function from psql takes 40 seconds under no load and
> minimal data, but when I run the function from java using JDBC it takes
> 20-30 minutes.
>
> Checking top, this is a Linux system, I see that the java program takes
> up 99% of the CPU when it's running this function through executeQuery.
> Is executeQuery() doing a busy wait for the data from postgres? It
> seems a bit absurd that the executeQuery method would hijack 99% of the
> CPU waiting for results and slowing everything else on the system down.
>
> The second problem I am noticing is that if I move the java program to
> another machine, to keep java from stealing all the CPU cycles, the
> function still takes 20-30 minutes to run through java, but only takes
> 40 seconds to run through psql. What's the deal?
>
> Any help would be appreciated.
>
> Garrick Dasbach
>
> Software Developer
> MusicRebellion.com, Inc.
> Garrick(at)musicrebellion(dot)com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
--
Dave Cramer <Dave(at)micro-automation(dot)net>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Garrick Dasbach 2003-06-27 19:00:06 Re: executeQuery and busy waiting
Previous Message Garrick Dasbach 2003-06-27 18:44:02 executeQuery and busy waiting