plpgsql slower than sql
plpgsql slower than sql
От:
jain@gmx.net (Eric)
Дата:
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?