Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AE5AF9FBE79 for ; Tue, 19 Jun 2007 12:50:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60363-02-2 for ; Tue, 19 Jun 2007 12:50:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 153F09FB8CD for ; Tue, 19 Jun 2007 12:50:26 -0300 (ADT) Received: from perhan.alvh.no-ip.org (190-13-143-52.bk13-dsl.surnet.cl [190.13.143.52]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l5JFoPd1028969; Tue, 19 Jun 2007 08:50:26 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 3341832A28; Tue, 19 Jun 2007 11:50:23 -0400 (CLT) Date: Tue, 19 Jun 2007 11:50:23 -0400 From: Alvaro Herrera To: Karl Wright Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Performance query about large tables, lots of concurrent access Message-ID: <20070619155023.GQ4265@alvh.no-ip.org> References: <4676DD57.7070304@metacarta.com> <14291.1182221811@sss.pgh.pa.us> <4677B831.8060704@metacarta.com> <27690.1182263794@sss.pgh.pa.us> <4677ECA9.3000402@metacarta.com> <28036.1182264975@sss.pgh.pa.us> <4677F617.5000105@metacarta.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4677F617.5000105@metacarta.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 19 Jun 2007 08:50:26 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/359 X-Sequence-Number: 25392 Karl Wright wrote: > I did an ANALYZE on that table and repeated the explain, and got this: > > >>>>>> > metacarta=> analyze intrinsiclink; > ANALYZE > metacarta=> explain select count(*) from intrinsiclink where > jobid=1181766706097 and > childidhash='7E130F3B688687757187F1638D8776ECEF3009E0'; > QUERY PLAN > > ------------------------------------------------------------------------------------------------------------------------------------ > Aggregate (cost=15276.36..15276.37 rows=1 width=0) > -> Index Scan using i1181764142395 on intrinsiclink > (cost=0.00..15255.53 rows=8333 width=0) > Index Cond: ((jobid = 1181766706097::bigint) AND > ((childidhash)::text = '7E130F3B688687757187F1638D8776ECEF3009E0'::text)) > (3 rows) > <<<<<< > > ... even more wildly wrong. Interesting. What is the statistics target for this table? Try increasing it, with ALTER TABLE ... SET STATISTICS, rerun analyze, and try again. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.