Re: Why overhead of SPI is so large?
| От | Konstantin Knizhnik |
|---|---|
| Тема | Re: Why overhead of SPI is so large? |
| Дата | |
| Msg-id | cb07cfe8-1981-c923-f348-2507e3e45b75@postgrespro.ru обсуждение исходный текст |
| Ответ на | Re: Why overhead of SPI is so large? (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>) |
| Ответы |
Re: Why overhead of SPI is so large?
|
| Список | pgsql-hackers |
Some more information...
First of all I found out that marking PL/pgSQL function as immutable significantly increase speed of its execution:
19808 ms vs. 27594. It happens because exec_eval_simple_expr is taken snapshot if function is volatile (default).
I wonder if PL/pgSQL compiler can detect that evaluated expression itself is actually immutable and there is no need to take snapshot
for each invocation of this function. Also I have tried yet another PL language - JavaScript, which is now new outsider, despite to the fact that
v8 JIT compiler is very good.
First of all I found out that marking PL/pgSQL function as immutable significantly increase speed of its execution:
19808 ms vs. 27594. It happens because exec_eval_simple_expr is taken snapshot if function is volatile (default).
I wonder if PL/pgSQL compiler can detect that evaluated expression itself is actually immutable and there is no need to take snapshot
for each invocation of this function. Also I have tried yet another PL language - JavaScript, which is now new outsider, despite to the fact that
v8 JIT compiler is very good.
| Implementation | time (ms) |
| PL/v8 | 41550 |
| PL/Lua | 32220 |
| PL/pgSQL | 19808 |
| C/SPI | 9406 |
| SQL | 7399 |
| SQL (JIT) | 5532 |
| С/coreAPI | 2873 |
-- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
В списке pgsql-hackers по дате отправления: