Re: Optimizer showing wrong rows in plan

From: Frank Heikens <frankheikens(at)mac(dot)com>
To: Tadipathri Raghu <traghu(dot)dba(at)gmail(dot)com>
Cc: Gary Doades <gpd(at)gpdnet(dot)co(dot)uk>, pgsql-performance(at)postgresql(dot)org, Szymon Guz <mabewlun(at)gmail(dot)com>
Subject: Re: Optimizer showing wrong rows in plan
Date: 2010-03-28 09:18:27
Message-ID: AC9B4F8F-FFD7-426E-A200-F0A1AB565F29@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


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(at)gpdnet(dot)co(dot)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.
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gary Doades 2010-03-28 09:27:22 Re: Optimizer showing wrong rows in plan
Previous Message Tadipathri Raghu 2010-03-28 09:07:13 Re: Optimizer showing wrong rows in plan