Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 1D5ED63297D for ; Sun, 28 Mar 2010 06:07:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 34787-05 for ; Sun, 28 Mar 2010 09:07:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by mail.postgresql.org (Postfix) with ESMTP id 44113632A07 for ; Sun, 28 Mar 2010 06:07:14 -0300 (ADT) Received: by vws8 with SMTP id 8so2076226vws.19 for ; Sun, 28 Mar 2010 02:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=+u1RyV/56RCdQ7B8NtbvCmLkkNgS+gSjdcIkQSQbKDE=; b=O/4FBntxCpmApdvNjl3rddmjfXVniOPUK2G4n69xUjxwqF6mSk2yapNwie7q10QFjE AaPe7b/IQJ+kBLSNXG+agjJ+nrcGm7e2dyf9CBK4opQ+eiyW1AtyJPlkJ3b93WL9/A7R OU0FmrrvkIvFc4rN+Fafn6saGsHkaMuYD6B8o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=rDwMC9Vis+mxk8f7XgaoCBgrr4yPuOmUzA2UNGFnNF1hEqM/gtJYodL0U3zpxTkibc LpBfNKf0IMw2qbPKyEHcteO5czZZgucDKxMJC9OJVx9huC2o9U9CjHubf7akcfFRsKE8 i26s1ZTMmaoKCt5BrFhik7UK8Z4F1MU3pfS3Q= MIME-Version: 1.0 Received: by 10.220.99.197 with HTTP; Sun, 28 Mar 2010 02:07:13 -0700 (PDT) In-Reply-To: <4BAF14F2.20200@gpdnet.co.uk> References: <645d9d71003272351x766707c7sadde9aa77bc1c0d3@mail.gmail.com> <645d9d71003280011q6cf2c6d6p7279605e6e0b4235@mail.gmail.com> <645d9d71003280033l16069edcp45d9bbb0e7ed5517@mail.gmail.com> <4BAF14F2.20200@gpdnet.co.uk> Date: Sun, 28 Mar 2010 14:37:13 +0530 Received: by 10.220.44.20 with SMTP id y20mr1650966vce.217.1269767233205; Sun, 28 Mar 2010 02:07:13 -0700 (PDT) Message-ID: <645d9d71003280207p14fa4628i91b51ca8ee954216@mail.gmail.com> Subject: Re: Optimizer showing wrong rows in plan From: Tadipathri Raghu To: Gary Doades Cc: pgsql-performance@postgresql.org, Szymon Guz Content-Type: multipart/alternative; boundary=0016363b92ece1fc3e0482d8b8f4 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.096 tagged_above=-10 required=5 tests=AWL=-0.357, BAYES_20=-0.74, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/354 X-Sequence-Number: 38179 --0016363b92ece1fc3e0482d8b8f4 Content-Type: text/plain; charset=ISO-8859-1 Hi All, I want to give some more light on this by analysing more like this 1. In my example I have created a table with one column as INT( which occupies 4 bytes) 2. Initially it occupies one page of space on the file that is (8kb). So, here is it assuming these many rows may fit in this page. Clarify me on this Please. Regards Raghavendra On Sun, Mar 28, 2010 at 2:06 PM, Gary Doades wrote: > On 28/03/2010 8:33 AM, Tadipathri Raghu wrote: > > Hi Guz, > > >> It is assuming that there are 2400 rows in this table. Probably you've >> deleted some rows from the table leaving just one. > > > Frankly speaking its a newly created table without any operation on it as > you have seen the example. Then how come it showing those many rows where we > have only one in it. > Thanks if we have proper explination on this.. > > It's not *showing* any rows at all, it's *guessing* 2400 rows because > you've never analyzed the table. Without any statistics at all, postgres > will use some form of in-built guess for a table that produces reasonable > plans under average conditions. As you've already seen, once you analyze the > table, the guess get's much better and therefore would give you a more > appropriate plan. > > Regards, > Gary. > > --0016363b92ece1fc3e0482d8b8f4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi All,
=A0
I want to give some more light on this by analysing more like this
=A0
1. In my example=A0I=A0have created a table with one column as INT( wh= ich occupies 4 bytes)
2. Initially it occupies one page of=A0 space on the file that is (8kb= ).
=A0
So, here is it assuming these many rows may fit in this page. Clarify = me on this Please.
=A0
Regards
Raghavendra

=A0
On Sun, Mar 28, 2010 at 2:06 PM, Gary Doades <gpd@gpdnet.co.uk= > wrote:
On 28/03/2010 8:33 AM, Tadipathri Raghu wrote:=20
Hi Guz,
=A0
It is assuming that = there are 2400 rows in this table. Probably you've deleted some rows fr= om the table leaving just one.
=A0
Frankly speaking its a newly created table without any operation on it= as you have seen the example. Then how come it showing those many rows whe= re we have only one in it.
Thanks if we have proper explination on this..
It's not *showing* any rows at all, it's *guessing* 2400 rows beca= use you've never analyzed the table. Without any statistics at all, pos= tgres will use some form of in-built guess for a table that produces reason= able plans under average conditions. As you've already seen, once you a= nalyze the table, the guess get's much=A0 better and therefore would gi= ve you a more appropriate plan.

Regards,
Gary.


--0016363b92ece1fc3e0482d8b8f4--