Re: Performance on Bulk Insert to Partitioned Table - Mailing list pgsql-performance

From Jeff Janes
Subject Re: Performance on Bulk Insert to Partitioned Table
Date
Msg-id CAMkU=1xcdjdFWRSZyaXyo2h8eHYz7DJRTpqeL1shMO5M858MMw@mail.gmail.com
Whole thread Raw
In response to Re: Performance on Bulk Insert to Partitioned Table  (Vitalii Tymchyshyn <tivv00@gmail.com>)
Responses Re: Performance on Bulk Insert to Partitioned Table  (Stephen Frost <sfrost@snowman.net>)
List pgsql-performance


On Friday, December 28, 2012, Vitalii Tymchyshyn wrote:

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 by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Performance on Bulk Insert to Partitioned Table
Next
From: Stephen Frost
Date:
Subject: Re: Performance on Bulk Insert to Partitioned Table