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 3EB253A5344 for ; Mon, 22 Nov 2004 19:41:41 +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 48997-03 for ; Mon, 22 Nov 2004 19:41:29 +0000 (GMT) Received: from web51302.mail.yahoo.com (web51302.mail.yahoo.com [206.190.38.168]) by svr1.postgresql.org (Postfix) with SMTP id AEE023A5345 for ; Mon, 22 Nov 2004 19:41:28 +0000 (GMT) Received: (qmail 8042 invoked by uid 60001); 22 Nov 2004 19:41:26 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=Tmg+w1RbeyklAUXGXbroh1T8Qmf646GlwkNI5fyG65Oq82O8amJG1EdSD+txv2vOAM7huJ8YGCp6AwanMF5ZoNxHX+mr1VE2JFS6PG+BxID73BH3QDk8mNa3BYmtyHzvDbwV8fdqxj3u6TVX3+ZE2izS+JWLIkw9pUPLM4uRvN8= ; Message-ID: <20041122194125.8040.qmail@web51302.mail.yahoo.com> Received: from [65.218.182.242] by web51302.mail.yahoo.com via HTTP; Mon, 22 Nov 2004 11:41:25 PST Date: Mon, 22 Nov 2004 11:41:25 -0800 (PST) From: sarlav kumar Subject: Re: help needed -- sequential scan problem To: pgsql-performance@postgresql.org In-Reply-To: <16679.1100927986@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1772108165-1101152485=:7758" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_FONTCOLOR_BLUE, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200411/332 X-Sequence-Number: 9286 --0-1772108165-1101152485=:7758 Content-Type: text/plain; charset=us-ascii Hi Tom, Thanks for the help, Tom. >The major issue seems to be in the sub-selects: > -> Seq Scan on merchant_purchase mp (cost=0.00..95.39 rows=44 width=4) (actual time=2.37..2.58 rows=6 loops=619) > Filter: (merchant_id = $0) >where the estimated row count is a factor of 7 too high. If the >estimated row count were even a little lower, it'd probably have gone >for an indexscan. I understand that the sub-selects are taking up most of the time as they do a sequential scan on the tables. >You might get some results from increasing the >statistics target for merchant_purchase.merchant_id. Do I have to use vacuum analyze to update the statistics? If so, I have already tried that and it doesn't seem to help. >If that doesn't help, I'd think about reducing random_page_cost a little bit. I am sorry, I am not aware of what random_page_cost is, as I am new to Postgres. What does it signify and how do I reduce random_page_cost? Thanks, Saranya __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-1772108165-1101152485=:7758 Content-Type: text/html; charset=us-ascii
Hi Tom,
 
Thanks for the help, Tom.
 
>The major issue seems to be in the sub-selects:

> -> Seq Scan on merchant_purchase mp (cost=0.00..95.39 rows=44 width=4) (actual time=2.37..2.58 rows=6 loops=619)
> Filter: (merchant_id = $0)
>where the estimated row count is a factor of 7 too high. If the
>estimated row count were even a little lower, it'd probably have gone
>for an indexscan.
 
I understand that the sub-selects are taking up most of the time as they do a sequential scan on the tables. 
 
 >You might get some results from increasing the
>statistics target for merchant_purchase.merchant_id.
 
Do I have to use vacuum analyze to update the statistics? If so, I have already tried that and it doesn't seem to help.
 
>If that doesn't help, I'd think about reducing random_page_cost a little bit.
 
I am sorry, I am not aware of what random_page_cost is, as I am new to Postgres. What does it signify and how do I reduce random_page_cost?

Thanks,
Saranya

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com --0-1772108165-1101152485=:7758--