Re: Performance on Bulk Insert to Partitioned Table
От | Jeff Janes |
---|---|
Тема | Re: Performance on Bulk Insert to Partitioned Table |
Дата | |
Msg-id | CAMkU=1xcdjdFWRSZyaXyo2h8eHYz7DJRTpqeL1shMO5M858MMw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Performance on Bulk Insert to Partitioned Table (Vitalii Tymchyshyn <tivv00@gmail.com>) |
Ответы |
Re: Performance on Bulk Insert to Partitioned Table
|
Список | pgsql-performance |
On Friday, December 28, 2012, Vitalii Tymchyshyn wrote:
There is switch-like sql case:It should work like C switch statement.
I had thought that too, but the catch is that the target expressions do not need to be constants when the function is created. Indeed, they can even be volatile.
CREATE OR REPLACE FUNCTION foo(x integer)
RETURNS integer AS $$
BEGIN
case x
when 0 then return -5;
when (random()*10)::integer then return 1;
when (random()*10)::integer then return 2;
when (random()*10)::integer then return 3;
when (random()*10)::integer then return 4;
when (random()*10)::integer then return 5;
when (random()*10)::integer then return 6;
when (random()*10)::integer then return 7;
when (random()*10)::integer then return 8;
when (random()*10)::integer then return 9;
when (random()*10)::integer then return 10;
else return -6;
Cheers,
Jeff
В списке pgsql-performance по дате отправления: