RE: [HACKERS] selectivity calculation for or_clause is wrong ?

Поиск
Список
Период
Сортировка
От Hiroshi Inoue
Тема RE: [HACKERS] selectivity calculation for or_clause is wrong ?
Дата
Msg-id 000301bed318$d2fca0c0$2801007e@cadzone.tpf.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] selectivity calculation for or_clause is wrong ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] selectivity calculation for or_clause is wrong ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Wednesday, July 21, 1999 12:32 AM
> To: Hiroshi Inoue
> Cc: pgsql-hackers
> Subject: Re: [HACKERS] selectivity calculation for or_clause is wrong ? 
> 
> 
> "Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> > Why is valid_or_clause(clausenode) necessary ?
> 
> Looks like a waste of cycles to me too.
>

It's not only a waste of cycles.
For exmaple,

1.explain select key1 from b where someitem in (1);
  NOTICE:  QUERY PLAN:
  Seq Scan on b on b  (cost=1638.49 rows=261 width=4)

2.explain select key1 from b where someitem in (1,2);
  NOTICE:  QUERY PLAN:
  Seq Scan on b on b  (cost=1638.49 rows=773 width=4)

3.explain select key1 from b where someitem in (1,2,3);
 NOTICE:  QUERY PLAN:
 Seq Scan on b on b  (cost=1638.49 rows=1274 width=4)


rows of each plan  261 : 773 : 1274  not =  1 : 2 : 3.
It's nearly = 1 :3 :5.

elements of or_clause except its first element are evaluated 
twice and the results are accumlated.

Regards.

Hiroshi Inoue
Inoue@tpf.co.jp



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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: PostgreSQL 6.5.1 Released ...
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [ANNOUNCE] PostgreSQL status report