From: SZŰCS Gábor <surrano@mailbox.hu>
To: pgsql-performance@postgresql.org
Subject: constant vs function param differs in performance
Date: Fri, 14 Nov 2003 16:08:27 +0100
Message-ID: <01a601c3aac1$281e72c0$0403a8c0@fejleszt4> (raw)
Dear Gurus,
I have two SQL function that produce different times and I can't understand
why. Here is the basic difference between them:
CREATE FUNCTION test_const_1234 () RETURNS int4 AS '
SELECT ... 1234 ... 1234 .... 1234 ...
' LANGUAGE 'SQL';
CREATE FUNCTION test_param (int4) RETURNS int4 AS '
SELECT ... $1 .... $1 .... $1 ...
' LANGUAGE 'SQL';
Some sample times for different data:
test_const_1234() 450 msec
test_param(1234) 2700-4000 msec (probably disk cache)
test_const_5678() 13500 msec
test_param(5678) 14500 msec
Is there a sane explanation? a solution?
I can send more info if you wish.
TIA,
G.
------------------------------- cut here -------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: surrano@mailbox.hu
Subject: Re: constant vs function param differs in performance
In-Reply-To: <01a601c3aac1$281e72c0$0403a8c0@fejleszt4>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox