Arjen van der Meijden <acmmailing@vulcanus.its.tudelft.nl> writes:
> Anyway, I was looking into the usefullness of a INSERT INTO newtable
> SELECT field, field, CASE pkey WHEN x1 THEN y1 WHEN x2 THEN y2 etc END
> FROM oldtable
> The resulting select was about 1.7MB of query-text, mostly composed of
> the CASE-statement.
Hm, you mean one single SELECT, one single CASE? How many WHEN clauses
exactly? Exactly what did a typical clause of the CASE look like?
I wouldn't be too surprised to find some bit of code that's O(N^2) in
the number of arms of the CASE, or something like that; it's not an area
that we've ever felt the need to optimize. But I'd like a fairly
specific test case before trying to look into it.
regards, tom lane