selectivity calculation for or_clause is wrong ?

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема selectivity calculation for or_clause is wrong ?
Дата
Msg-id 000401bed261$965d2520$2801007e@cadzone.tpf.co.jp
обсуждение исходный текст
Ответы Re: [HACKERS] selectivity calculation for or_clause is wrong ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi all,

I have a question about the calculation of selectivity.

I see the following code in set_rest_selec() in clausesel.c.
               cost_clause = clausenode->selectivity;
    /*                * Check to see if the selectivity of this clause or any
'or'                * subclauses (if any) haven't been set yet.                */               if (cost_clause <= 0 ||
valid_or_clause(clausenode))              {
 

Why is valid_or_clause(clausenode) necessary ?

This means that even if selectivity is set,set_rest_selec()
calls compute_clause_selec() if the target clause is a
valid_or_clause.
compute_clause_selec() would add the selectivity of
elements of or_clause to the current selectivity.

AFAIC,compute_clause_selec() is called twice at least   ( from add_restrict_and_join_to_rel() in initsplan.c      and
set_rest_selec()in clausesel.c)
 
and seems to accumulate the result by repetition if
the target clause is a valid_or_clause.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp



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

Предыдущее
От: Vadim Mikheev
Дата:
Сообщение: Re: [HACKERS] (Debian Bug#41223) cascaded updates with refint insert bogus data
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] Re: [HACKERS] Counting bool flags in a complex query