Skip site navigation (1) Skip section navigation (2)

Re: Calculation of unused columns

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Calculation of unused columns
Date: 2009-10-18 17:59:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Sun, Oct 18, 2009 at 10:35 AM, Tim Landscheidt
<tim(at)tim-landscheidt(dot)de> wrote:
> Daniel Migowski <dmigowski(at)ikoffice(dot)de> wrote:
>> I have a very common example which would illustrate the
>> above problem a bit more. Guess the following view on a
>> company table, which references the country of that company
>> in another table. The view itself just returns the
>> company-id and the country-name,
>>    create view companys_and_countries as
>>    select, from company left join
>> country on (company.country_id =;
>> Pleaso note we have a left join here, so the contents of
>> country do by no means affect the contents of the "id" row
>> in that view. Lets see what happens when we just query for
>> the ids:
>>    explain select id from companys_and_countries;
>> The join is done anyway, even if its removed (At least on
>> Postgres 8.3). [...]
> How could that be done otherwise? PostgreSQL *must* look at
> country to determine how many rows the left join produces.

Even if is a primary or unique key?


In response to


pgsql-performance by date

Next:From: Tom LaneDate: 2009-10-18 18:20:19
Subject: Re: Full text search - query plan? PG 8.4.1
Previous:From: Tim LandscheidtDate: 2009-10-18 17:35:29
Subject: Re: Calculation of unused columns

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group