Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 20CCC64FE15 for ; Fri, 28 Nov 2008 16:44:21 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90242-10 for ; Fri, 28 Nov 2008 16:44:18 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-out.neti.ee (smtp-out.neti.ee [194.126.126.44]) by mail.postgresql.org (Postfix) with ESMTP id 4468764FE07 for ; Fri, 28 Nov 2008 16:44:18 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by MXR-5.estpak.ee (Postfix) with ESMTP id 19F291E10D5; Fri, 28 Nov 2008 22:44:16 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at estpak.ee Received: from smtp-out.neti.ee ([127.0.0.1]) by localhost (MXR-5.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PA3h19bHfj1B; Fri, 28 Nov 2008 22:44:14 +0200 (EET) Received: from Relayhost2.neti.ee (Relayhost2 [88.196.174.142]) by MXR-5.estpak.ee (Postfix) with ESMTP id 79CFB1E10CD; Fri, 28 Nov 2008 22:44:14 +0200 (EET) X-SMTP-Auth-NETI-Businesmail: no Received: from andrusnotebook (unknown [195.50.198.194]) by Relayhost2.neti.ee (Postfix) with SMTP id 0941A1FC0EE; Fri, 28 Nov 2008 22:44:14 +0200 (EET) Message-ID: <2B43ECEF2E3A49A1811782BD8FD8E67E@andrusnotebook> From: "Andrus" To: "Scott Carey" , "Scott Marlowe" Cc: Subject: Re: Increasing GROUP BY CHAR columns speed Date: Fri, 28 Nov 2008 22:43:57 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200811/299 X-Sequence-Number: 32030 >I it seems that slowness is caused by grouping by column > > exchrate numeric(13,8) exchrate has different values in few rows. It has usually value 0 In this sample query it is always 0. I tried not change exchrate with nullif( bilkaib.EXCHRATE,0) but this does not up speed query, no idea why. Andrus.