From: | Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz> |
---|---|
To: | testman1316 <danilo(dot)ramirez(at)hmhco(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: PostrgeSQL vs oracle doing 1 million sqrts am I doing it wrong? |
Date: | 2014-08-05 07:37:58 |
Message-ID: | 53E089D6.9030000@catalyst.net.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 05/08/14 17:56, Mark Kirkwood wrote:
>
> Adding in the 'if' in the float8 case increases run time to 4s. So looks
> like plpgsql might have a slightly higher cost for handling added
> conditionals. Be interesting to dig a bit more and see what is taking
> the time.
>
Thinking about this a bit more, I wonder if the 'big O' has added some
optimizations in PL/SQL for trivial conditionals - i.e you are adding:
IF (0 = 0) THEN
END IF;
...it may be going...'Ah yes, always true...so remove'!
So it might be interesting to try some (hopefully not so easily
removable) non trivial ones like:
DO LANGUAGE plpgsql $$ DECLARE
DECLARE i integer;
BEGIN
FOR i IN 1..10000000 LOOP
IF (i%100 = 0) THEN
NULL;
END IF;
END LOOP;
END $$;
Now I guess there is the chance that PL/SQL might understand that NULL
inside a loop means it can remove it...so you may need to experiment
further. The point to take away here is that for interesting loops and
conditions - there may be not such a significant difference!
Regards
Mark
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriele Bartolini | 2014-08-05 10:10:11 | Re: Proposal: Incremental Backup |
Previous Message | Pavel Stehule | 2014-08-05 06:46:57 | Re: PostrgeSQL vs oracle doing 1 million sqrts am I doing it wrong? |