From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Vitalii Tymchyshyn <tivv00(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Charles Gomes <charlesrg(at)outlook(dot)com>, Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Performance on Bulk Insert to Partitioned Table |
Date: | 2012-12-28 14:44:17 |
Message-ID: | CAFj8pRD5PvM+WaWFBcuFbnxpeZd--zygYoth2j82=nx0rBspEQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
2012/12/28 Stephen Frost <sfrost(at)snowman(dot)net>:
> 2012/12/28 Vitalii Tymchyshyn <tivv00(at)gmail(dot)com>:
>> Why so? Basic form "case lvalue when rvalue then out ... end" is much like
>> switch.
>
> Sorry, to be honest, I missed that distinction and didn't expect that to
> work as-is, yet apparently it does. Does it currently perform the same
> as an if/elsif tree or is it implemented to actually use a table lookup?
both IF and CASE has very similar implementation - table lookup is not
used - there are not special path for searching constants
>
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> please, look to plpgsql source code. PL/pgSQL is too simply and has
>> not own arithmetic unit - all is transformed to SELECTs, has not any
>> optimization. But is really short and maintainable.
>
> I was thinking we'd actually do this for all CASE statements, those in
> plpgsql and those in regular SQL, if it's possible to do. Hopefully
> it'd be possible to do easily in plpgsql once the SQL-level CASE is
> done.
>
I am not sure - SQL case is not heavy specially optimized too :(
I see only one possible way, do almost work when CASE statement is
parsed and bypass executor - this can work, but I afraid so it can
slowdown first start and some use cases where is not too much paths,
because we have to check all paths before executions.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2012-12-28 16:30:30 | Re: Performance on Bulk Insert to Partitioned Table |
Previous Message | Stephen Frost | 2012-12-28 14:11:53 | Re: Performance on Bulk Insert to Partitioned Table |