constant vs function param differs in performance

Поиск
Список
Период
Сортировка
От SZŰCS Gábor
Тема constant vs function param differs in performance
Дата
Msg-id 01a601c3aac1$281e72c0$0403a8c0@fejleszt4
обсуждение исходный текст
Ответы Re: constant vs function param differs in performance  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
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 -------------------------------


В списке pgsql-performance по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Help with count(*)
Следующее
От: "Nick Fankhauser"
Дата:
Сообщение: Re: Seeking help with a query that takes too long