plpgsql slower than sql

From: jain(at)gmx(dot)net (Eric)
To: pgsql-general(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: plpgsql slower than sql
Date: 2002-07-30 12:50:45
Message-ID: 835c2e5d.0207300450.12faed54@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Browse pgsql-general by date

  From Date Subject
Next Message stefan 2002-07-30 13:07:56 Re: RES: pg_controldata question
Previous Message xav 2002-07-30 12:43:38 very slow updates