From: Frank Heikens <frankheikens@mac.com>
To: Tadipathri Raghu <traghu.dba@gmail.com>
Cc: Gary Doades <gpd@gpdnet.co.uk>
Cc: pgsql-performance@postgresql.org, Szymon Guz <mabewlun@gmail.com>
Subject: Re: Optimizer showing wrong rows in plan
Date: Sun, 28 Mar 2010 11:18:27 +0200
Message-ID: <AC9B4F8F-FFD7-426E-A200-F0A1AB565F29@mac.com> (raw)
In-Reply-To: <645d9d71003280207p14fa4628i91b51ca8ee954216@mail.gmail.com>
References: <645d9d71003272351x766707c7sadde9aa77bc1c0d3@mail.gmail.com>
<e4edc9361003280002o627b710dhe89c98c18b5d1db3@mail.gmail.com>
<645d9d71003280011q6cf2c6d6p7279605e6e0b4235@mail.gmail.com>
<e4edc9361003280029v7174f84bo72d073aced772206@mail.gmail.com>
<645d9d71003280033l16069edcp45d9bbb0e7ed5517@mail.gmail.com>
<4BAF14F2.20200@gpdnet.co.uk>
<645d9d71003280207p14fa4628i91b51ca8ee954216@mail.gmail.com>
Op 28 mrt 2010, om 11:07 heeft Tadipathri Raghu het volgende geschreven:
> 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.
See these chapters in the manual: http://www.postgresql.org/docs/8.4/interactive/storage.html
The minimum size of a file depends on the block size, by default 8kb: http://www.postgresql.org/docs/8.4/interactive/install-procedure.html
Regards,
Frank
>
> Regards
> Raghavendra
>
>
> 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:
>>
>> 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.
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: frankheikens@mac.com, traghu.dba@gmail.com, gpd@gpdnet.co.uk, mabewlun@gmail.com
Subject: Re: Optimizer showing wrong rows in plan
In-Reply-To: <AC9B4F8F-FFD7-426E-A200-F0A1AB565F29@mac.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox