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

[YSQL] Avoid unnecessary Bitmap Table Scan fetches #22044

Open
1 task done
timothy-e opened this issue Apr 18, 2024 · 0 comments
Open
1 task done

[YSQL] Avoid unnecessary Bitmap Table Scan fetches #22044

timothy-e opened this issue Apr 18, 2024 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@timothy-e
Copy link
Contributor

timothy-e commented Apr 18, 2024

Jira Link: DB-10960

Description

There are some cases where bitmap scans can avoid going to the main table, e.g. a COUNT(*) where all the conditions are satisfied by the index conditions.

This behaviour was enabled by default with the initial support for YB Bitmap Scans, but removed as part of the fix for #21980, to give more time to do this properly.

Cases where we can avoid fetching:

  • No targets (such as COUNT(*)) with no local / remote conditions
  • Only ybctid is required
  • Only primary key is required (extract primary key from ybctid?)

What we can do in these cases:

  • avoid creating a ybScan handle
  • avoid sending any requests
  • return an all-null tuple, or a tuple with system attributes filled out

This is similar to bitmap scan aggregate pushdown #21198

Issue Type

kind/enhancement

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
@timothy-e timothy-e added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Apr 18, 2024
@timothy-e timothy-e self-assigned this Apr 18, 2024
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue and removed status/awaiting-triage Issue awaiting triage labels Apr 18, 2024
timothy-e added a commit that referenced this issue Apr 19, 2024
Summary:
Bitmap scans try to optimize cases where the actual tuples are not required by avoiding fetching the rows from the table.

This was added in PG to support the COUNT(*) use case, but would also optimize returning system attributes that aren't stored in DocDB. In both of these cases, we already have everything we need locally: an exact number of ybctids, or the system attributes. Sending a request is a waste of time.

However, there are a few edge cases / optimization to this that make it a bit more complicated. For now, disable this optimisation so that we can do it right later, at a priority that makes sense. That follow up is tracked by #22044
Jira: DB-10901

Test Plan:
```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressYbBitmapScans'
```

Reviewers: amartsinchyk, tnayak

Reviewed By: amartsinchyk

Subscribers: yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34137
timothy-e added a commit that referenced this issue Apr 29, 2024
…ap Table Scan

Summary:
Original commit: 03fd372 / D34137
Bitmap scans try to optimize cases where the actual tuples are not required by avoiding fetching the rows from the table.

This was added in PG to support the COUNT(*) use case, but would also optimize returning system attributes that aren't stored in DocDB. In both of these cases, we already have everything we need locally: an exact number of ybctids, or the system attributes. Sending a request is a waste of time.

However, there are a few edge cases / optimization to this that make it a bit more complicated. For now, disable this optimisation so that we can do it right later, at a priority that makes sense. That follow up is tracked by #22044
Jira: DB-10901

Test Plan:
```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressYbBitmapScans'
```

Reviewers: amartsinchyk, tnayak

Reviewed By: amartsinchyk

Subscribers: yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34335
svarnau pushed a commit that referenced this issue May 25, 2024
Summary:
Bitmap scans try to optimize cases where the actual tuples are not required by avoiding fetching the rows from the table.

This was added in PG to support the COUNT(*) use case, but would also optimize returning system attributes that aren't stored in DocDB. In both of these cases, we already have everything we need locally: an exact number of ybctids, or the system attributes. Sending a request is a waste of time.

However, there are a few edge cases / optimization to this that make it a bit more complicated. For now, disable this optimisation so that we can do it right later, at a priority that makes sense. That follow up is tracked by #22044
Jira: DB-10901

Test Plan:
```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressYbBitmapScans'
```

Reviewers: amartsinchyk, tnayak

Reviewed By: amartsinchyk

Subscribers: yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34137
ZhenYongFan pushed a commit to ZhenYongFan/yugabyte-db that referenced this issue Jun 15, 2024
… YB Bitmap Table Scan

Summary:
Original commit: 03fd372 / D34137
Bitmap scans try to optimize cases where the actual tuples are not required by avoiding fetching the rows from the table.

This was added in PG to support the COUNT(*) use case, but would also optimize returning system attributes that aren't stored in DocDB. In both of these cases, we already have everything we need locally: an exact number of ybctids, or the system attributes. Sending a request is a waste of time.

However, there are a few edge cases / optimization to this that make it a bit more complicated. For now, disable this optimisation so that we can do it right later, at a priority that makes sense. That follow up is tracked by yugabyte#22044
Jira: DB-10901

Test Plan:
```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressYbBitmapScans'
```

Reviewers: amartsinchyk, tnayak

Reviewed By: amartsinchyk

Subscribers: yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D34335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

2 participants