Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COUNT(*) of Table Attempts to use trgm gin Index #13987

Closed
yugabyte-ci opened this issue Sep 13, 2022 · 1 comment
Closed

COUNT(*) of Table Attempts to use trgm gin Index #13987

yugabyte-ci opened this issue Sep 13, 2022 · 1 comment
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) duplicate jira-originated kind/bug This issue is a bug priority/medium Medium priority issue

Comments

@yugabyte-ci
Copy link
Contributor

Jira Link: DB-3486

@yugabyte-ci yugabyte-ci added area/ysql Yugabyte SQL (YSQL) jira-originated kind/bug This issue is a bug priority/low Low priority status/awaiting-triage Issue awaiting triage priority/high High Priority and removed priority/low Low priority status/awaiting-triage Issue awaiting triage labels Sep 13, 2022
@yugabyte-ci yugabyte-ci added priority/medium Medium priority issue and removed priority/high High Priority labels Mar 2, 2023
@jasonyb
Copy link
Contributor

jasonyb commented Mar 28, 2023

A small repro is

create table t (id serial, string text);
create extension pg_trgm;
create index on t using gin (string gin_trgm_ops);
insert into t (string) select 'a' from generate_series(1, 50000);
analyze t;
explain select count(*) from t;

YB around commit 94c72fa:

                                        QUERY PLAN                                         
-------------------------------------------------------------------------------------------
 Aggregate  (cost=4555.00..4555.01 rows=1 width=8)
   ->  Index Only Scan using t_string_idx on t  (cost=3600.00..4430.00 rows=50000 width=0)
(2 rows)

PG 15.1:

                              QUERY PLAN                               
-----------------------------------------------------------------------
 Aggregate  (cost=12.16..12.17 rows=1 width=8)
   ->  Index Only Scan using i on t  (cost=0.13..12.16 rows=2 width=0)
(2 rows)

For context, ybgin supports amgettuple but not amgetbitmap, whereas gin (upstream PG) supports the opposite. That's the difference. Otherwise, the codepaths each take appear the same:

get_index_paths

  • build_index_paths
    • this returns an IndexOnlyScan IndexPath
  • "However, some of the indexes might support only bitmap scans"
  • if (index->amhasgettuple)
    • this is where code diverges, but it is expected behavior

The issue is that using the index results in error due to not-supported scan type:

select count(*) from t;
ERROR: unsupported ybgin index scan
Detail: ybgin index method does not support non-default search mode: everything.

This could be considered duplicate of issue #9960 and item "feat: support non-default search modes" of issue #7850.

@jasonyb jasonyb closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) duplicate jira-originated kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants