Re: Calculation of unused columns

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Calculation of unused columns
Дата
Msg-id f67928030910181059g37293530t982204699829faad@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Calculation of unused columns  (Tim Landscheidt <tim@tim-landscheidt.de>)
Ответы Re: Calculation of unused columns  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-performance
On Sun, Oct 18, 2009 at 10:35 AM, Tim Landscheidt
<tim@tim-landscheidt.de> wrote:
> Daniel Migowski <dmigowski@ikoffice.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 company.id, country.name from company left join
>> country on (company.country_id = 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 country.id is a primary or unique key?

Jeff

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tim Landscheidt
Дата:
Сообщение: Re: Calculation of unused columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Full text search - query plan? PG 8.4.1