X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8A120D1DACE for ; Fri, 16 Apr 2004 19:57:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 18431-06 for ; Fri, 16 Apr 2004 19:57:48 -0300 (ADT) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by svr1.postgresql.org (Postfix) with ESMTP id BBD34D1D5E4 for ; Fri, 16 Apr 2004 19:57:49 -0300 (ADT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by smtp.istop.com (Postfix) with ESMTP id 642E417C490; Fri, 16 Apr 2004 18:57:52 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1BEcHQ-0000Qj-00; Fri, 16 Apr 2004 18:57:52 -0400 To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: Poor performance of group by query References: <20040416151706.GE87362@nasby.net> In-Reply-To: <20040416151706.GE87362@nasby.net> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 16 Apr 2004 18:57:51 -0400 Message-ID: <87pta78r9s.fsf@stark.xeocode.com> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/232 X-Sequence-Number: 6532 > stats=# explain analyze SELECT work_units, min(raw_rank) AS rank FROM Trank_work_overall GROUP BY work_units; > > ... > > raw_rank | bigint | > work_units | bigint | If you create a copy of the same table using regular integers does that run fast? And a copy of the table using bigints is still slow like the original? I know bigints are less efficient than integers because they're handled using dynamically allocated memory. This especially bites aggregate functions. But I don't see why it would be any slower for a hash aggregate than a regular aggregate. It's a pretty gross amount of time for 18k records. There was a thought a while back about making 64-bit machines handle 64-bit datatypes like bigints without pointers. That would help on your Opteron. -- greg