[Pljava-dev] pljava concurrency

From: jurka at ejurka(dot)com (Kris Jurka)
To:
Subject: [Pljava-dev] pljava concurrency
Date: 2008-10-23 19:52:13
Message-ID: 4900D5ED.5030801@ejurka.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Peter Mengaziol wrote:
>
> I'm evaluating Postgresql (via EnterpriseDB) and I need to be sure
> that separate pljava requests (e.g., called from cron) that overlap
> in execution won't contend. I have some java procs that take a long
> time (read files, parse them, stuff them into a db) and I'd like to
> be assured that the java sprocs themselves won't block one another.

The fact that they are java functions doesn't imply any additional
blocking, but you are still subject to the constraints of the database
regarding holding and waiting for locks. This may be complicated by the
fact that postgresql functions are not true stored procedures and
therefore cannot commit transactions to release locks. All locks are
held through function exit until the enclosing transaction ends.

> I have been getting transaction errors since I am using cursor code
> inherited from the other database. Can I assume that nested cursors
> are not prohibited by the pljava environment? I assume that nested
> cursors are allowed in other PG languages...
>

Nested cursors are legal, but be aware that some databases and jdbc
drivers allow the following while the spec and pljava do not:

ResultSet rs1 = stmt.executeQuery(sql);
while (rs1.next()) {
ResultSet rs2 = stmt.executeQuery(sql2);
}

The second statement execution will close the first ResultSet. To do
this you need to create a second independent Statement.

Please also keep replies on the list, so that others may contribute to
or benefit from the discussion.

Kris Jurka

In response to

Browse pljava-dev by date

  From Date Subject
Next Message Imre Oolberg 2008-11-23 18:07:27 [Pljava-dev] calling pljava function seems to change locale settings
Previous Message Kris Jurka 2008-10-23 17:22:49 [Pljava-dev] pljava concurrency