| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Arjen van der Meijden <acmmailing(at)vulcanus(dot)its(dot)tudelft(dot)nl> |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: Large CASE-statement is pretty slow? |
| Date: | 2004-03-14 21:09:40 |
| Message-ID: | 25013.1079298580@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Arjen van der Meijden <acmmailing(at)vulcanus(dot)its(dot)tudelft(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | postgres | 2004-03-14 21:43:41 | Deadlocks... |
| Previous Message | Arjen van der Meijden | 2004-03-14 19:33:00 | Large CASE-statement is pretty slow? |