Что в plpgsql быстрее возводит в степень: x^y или power(x,y)?

EvgIq
Дата: 17.02.2015 09:20:57
Пытаюсь разбираться с созданием триггерных функций. Скорость их работы важна. В документации описаны оба способа. Поэтому вопрос:
Что в языке plpgsql быстрее возводит в степень: x^y или power(x,y)?
Подскажите, кто в курсе.
Maxim Boguk
Дата: 17.02.2015 09:35:04
EvgIq,

postgres=# \do+ ^
List of operators
Schema | Name | Left arg type | Right arg type | Result type | Function | Description
------------+------+------------------+------------------+------------------+---------------+----------------
pg_catalog | ^ | double precision | double precision | double precision | dpow | exponentiation
pg_catalog | ^ | numeric | numeric | numeric | numeric_power | exponentiation
(2 rows)

postgres=# \df+ power
List of functions
Schema | Name | Result data type | Argument data types | Type | Security | Volatility | Owner | Language | Source code | Description
------------+-------+------------------+------------------------------------+--------+----------+------------+----------+----------+---------------+----------------
pg_catalog | power | double precision | double precision, double precision | normal | invoker | immutable | postgres | internal | dpow | exponentiation
pg_catalog | power | numeric | numeric, numeric | normal | invoker | immutable | postgres | internal | numeric_power | exponentiation
(2 rows)


т.е. это одно и тоже.
Любой оператор в postgresql это всегда та или иная функция.
И внутри 2+2 выполняется как int2pl(2,2) и тд и тп.

--Maxim Boguk
www.postgresql-consulting.ru
EvgIq
Дата: 17.02.2015 11:51:45
Maxim Boguk, спасибо! понял :)