plpgsql slower than sql - Mailing list pgsql-general

From jain@gmx.net (Eric)
Subject plpgsql slower than sql
Date
Msg-id 835c2e5d.0207300450.12faed54@posting.google.com
Whole thread Raw
List pgsql-general
I have a simple procedure involving the following two steps:

1) Check if a certain record exist (SELECT)

2) Create, update or leave the record as is depending on a simple
condition (INSERT, UPDATE, -)


I am aware of two approaches for efficiently implementing this
procedure in a Java application:

A) Use 3 PreparedStatements, handle logic in application.

B) Use 1 PreparedStatement or CallableStatement, put logic in plpgsql
function.


Naturally, I expected the latter to be faster. To my surprise it is
considerable slower. I therefore assume that this is either a known
issue or perhaps I am doing something wrong?

pgsql-general by date:

Previous
From: "xav"
Date:
Subject: very slow updates
Next
From: paulie808@yahoo.com (Paul)
Date:
Subject: ERROR: Can't Parse "" (PG and PHP on Linux)