BUG #16303: A condtion whether an index-only scan is possible includes a wrong

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16303: A condtion whether an index-only scan is possible includes a wrong
Дата
Msg-id 16303-889581eb40fc0691@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16303: A condtion whether an index-only scan is possibleincludes a wrong  (Horimoto Yasuhiro <horimoto@clear-code.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16303
Logged by:          Horimoto Yasuhiro
Email address:      horimoto@clear-code.com
PostgreSQL version: 12.2
Operating system:   Debian 10.3
Description:

Hello, developers.

I think that the condition of whether an index-only scan is possible
includes a wrong.

For example, in the following case, the index has no data to return. Because
the query doesn't use specify columns.
However, the query planner choice index-only scan.

create table gist_count_tbl (tsv tsvector);
insert into gist_count_tbl values (null);
create index gist_count_tbl_index on gist_count_tbl using gist (tsv);

vacuum analyze gist_count_tbl;

set enable_seqscan=off;
set enable_bitmapscan=off;
set enable_indexonlyscan=on;

explain (costs off)
select count(*) from gist_count_tbl;
                             QUERY PLAN                             
--------------------------------------------------------------------
 Aggregate
   ->  Index Only Scan using gist_count_tbl_index on gist_count_tbl
(2 rows)

In my opinion, we expected that the query planner doesn't choose an
index-only scan in the above case. 

In fact, index_canreturn_attrs of
https://github.com/postgres/postgres/blob/master/src/backend/optimizer/path/indxpath.c#L1951
is NULL in the above case.

thanks!


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16302: too many range table entries - when count partition table(65538 childs)
Следующее
От: Horimoto Yasuhiro
Дата:
Сообщение: Re: BUG #16303: A condtion whether an index-only scan is possibleincludes a wrong