Re: PostrgeSQL vs oracle doing 1 million sqrts am I doing it wrong?
От | Mark Kirkwood |
---|---|
Тема | Re: PostrgeSQL vs oracle doing 1 million sqrts am I doing it wrong? |
Дата | |
Msg-id | 53E089D6.9030000@catalyst.net.nz обсуждение исходный текст |
Ответ на | Re: PostrgeSQL vs oracle doing 1 million sqrts am I doing it wrong? (Mark Kirkwood <mark.kirkwood@catalyst.net.nz>) |
Список | 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
В списке pgsql-hackers по дате отправления: