X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6CD275346A for ; Thu, 24 Mar 2005 19:43:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44183-01 for ; Thu, 24 Mar 2005 19:43:16 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9C26953457 for ; Thu, 24 Mar 2005 19:43:15 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j2OJhFor005051; Thu, 24 Mar 2005 14:43:15 -0500 (EST) To: matt@followers.net Cc: pgsql-performance@postgresql.org Subject: Re: Preventing query from hogging server In-reply-to: <42431001.36c6643c.1b4b.ffffd505@mx.gmail.com> References: <42431001.36c6643c.1b4b.ffffd505@mx.gmail.com> Comments: In-reply-to "Matthew Nuzum" message dated "Thu, 24 Mar 2005 13:07:39 -0600" Date: Thu, 24 Mar 2005 14:43:15 -0500 Message-ID: <5050.1111693395@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/516 X-Sequence-Number: 11221 "Matthew Nuzum" writes: > Here is the query (BTW, there will be a corresponding "max" version of this > query as well): > INSERT INTO usage_sessions_min (accountid,atime,sessionid) > select accountid, min(atime) as atime, sessionid from usage_access > group by accountid,sessionid; How many rows in usage_access? How many groups do you expect? (Approximate answers are fine.) What PG version is this, and what's your sort_mem setting? regards, tom lane