Re: Stats for multi-column indexes

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Stats for multi-column indexes
Дата
Msg-id 1174412816.23455.521.camel@dogma.v10.wvs
обсуждение исходный текст
Ответ на Re: Stats for multi-column indexes  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
On Tue, 2007-03-20 at 18:12 +0100, Josh Berkus wrote:
> Tom,
> 
> > Actually, I think you don't particularly need stats for that in most
> > cases --- if the planner simply took note that the FK relationship
> > exists, it would know that each row of the FK side joins to exactly
> > one row of the PK side, which in typical cases is sufficient.
> 
> Is it?  What about the other direction?  Currently, doesn't the planner 
> assume that the rowcount relationship is 1 to ( child total rows / 
> parent total rows) ?  That's ok for tables with relatively even 
> distribution, but not for skewed ones.
> 

In theory, the PK constrains the available values of the FK, but doesn't
provide any additional information about the relationship between the
columns. 

However, in practice there is limited space to store MCVs and limited
accuracy to n_distinct. So there may be a reason to store more
information, but I don't know what we'd store. Do we have reports of bad
estimates by the planner in this situation?

Regards,Jeff Davis



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Buildfarm feature request: some way to track/classify failures
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Stats for multi-column indexes