Re: [PERFORM] Performance issue with castings args of the function

От: Tom Lane
Тема: Re: [PERFORM] Performance issue with castings args of the function
Дата: ,
Msg-id: 18071.1483374980@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: [PERFORM] Performance issue with castings args of the function  (Андрей Хозов)
Ответы: Re: [PERFORM] Performance issue with castings args of the function  (Андрей Хозов)
Список: pgsql-performance

Скрыть дерево обсуждения

[PERFORM] Performance issue with castings args of the function  (Андрей Хозов, )
 Re: [PERFORM] Performance issue with castings args of the function  (Pavel Stehule, )
 Re: [PERFORM] Performance issue with castings args of the function  (Tom Lane, )
  Re: [PERFORM] Performance issue with castings args of the function  (Андрей Хозов, )

=?UTF-8?B?0JDQvdC00YDQtdC5INCl0L7Qt9C+0LI=?= <> writes:
> create table t1 (id serial, str char(32));

> create function f1(line text) returns void as $$
> begin
>   perform * from t1 where str = line;
> end;
> $$ language plpgsql;

This query is specifying a text comparison (text = text operator).
Since the table column isn't text, a char-to-text conversion must
happen at each line.

> create function f2(line char) returns void as $$
> begin
>   perform * from t1 where str = line;
> end;
> $$ language plpgsql;

This query is specifying a char(n) comparison (char = char operator).
No type conversion step needed, so it's faster.

            regards, tom lane



В списке pgsql-performance по дате сообщения:

От: Андрей Хозов
Дата:
Сообщение: Re: [PERFORM] Performance issue with castings args of the function
От: Vucomir Ianculov
Дата:
Сообщение: [PERFORM] Unable to connect to server