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 can > be slow, especially in non-C locales. What's your locale setting? show all returns "lc_collate";"en_US.UTF-8" "lc_ctype";"en_US.UTF-8" "lc_messages";"C" "lc_monetary";"et_EE.utf-8" "lc_numeric";"et_EE.utf-8" "lc_time";"et_EE.utf-8" How to speed up this query ? Is it possible to force the binary comparison for grouping ? Should I concatenate all the char columns into single column ? Andrus. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match