Re: [PERFORM] why group expressions cause query to run forever

2006-06-27 Thread Andrus
> I think the problem is probably that you're sorting two dozen CHAR > columns, and that in many of the rows all these entries are '' forcing > the sort code to compare all two dozen columns (not so)? Yes, most of columns return empty strings. I changed empty strings to null, casted to varchar an

Re: [PERFORM] why group expressions cause query to run forever

2006-06-26 Thread Andrus
Tom, thank you. > I think the problem is probably that you're sorting two dozen CHAR > columns, and that in many of the rows all these entries are '' forcing > the sort code to compare all two dozen columns (not so)? So the sort > ends up doing lots and lots and lots of CHAR comparisons. Which

Re: [PERFORM] why group expressions cause query to run forever

2006-06-22 Thread Tom Lane
"Andrus" <[EMAIL PROTECTED]> writes: > How to speed the following query? It seems to run forever. > explain SELECT > bilkaib.DB, > CASE WHEN dbkonto.objekt1='+' THEN bilkaib.DBOBJEKT ELSE '' END AS dbobjekt, > CASE WHEN dbkonto.objekt2='+' THEN bilkaib.DB2OBJEKT ELSE '' END AS > db2objekt, > CASE

[PERFORM] why group expressions cause query to run forever

2006-06-22 Thread Andrus
How to speed the following query? It seems to run forever. explain SELECT bilkaib.DB, CASE WHEN dbkonto.objekt1='+' THEN bilkaib.DBOBJEKT ELSE '' END AS dbobjekt, CASE WHEN dbkonto.objekt2='+' THEN bilkaib.DB2OBJEKT ELSE '' END AS db2objekt, CASE WHEN dbkonto.objekt3='+' THEN bilkaib.DB3OBJEKT EL