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] Include the phrase disable_cost in the name bitmap_exceeded_work_mem_cost #22388

Closed
1 task done
timothy-e opened this issue May 14, 2024 · 0 comments
Closed
1 task done
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 May 14, 2024

Jira Link: DB-11285

Description

bitmap_exceeded_work_mem_cost is 5.0e9. It's easy to miss when someone try to find all the places that inflates the cost values, e.g. investigate into cost overflow, precision losses with complex plans, etc.

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 May 14, 2024
@timothy-e timothy-e self-assigned this May 14, 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 May 14, 2024
timothy-e added a commit that referenced this issue May 14, 2024
Summary:
Because `bitmap_exceeded_work_mem_cost` doesn't contain the phrase `disable_cost`, it's easy to
miss when someone try to find all the places that inflates the cost values, e.g.
investigate into cost overflow, precision losses with complex plans, etc.

Change the name to `bitmap_exceeded_work_mem_disable_cost`.
Jira: DB-11285

Test Plan: Jenkins: compile only, build type: debug

Reviewers: tnayak, amartsinchyk, mtakahara

Reviewed By: mtakahara

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D35045
svarnau pushed a commit that referenced this issue May 25, 2024
Summary:
Because `bitmap_exceeded_work_mem_cost` doesn't contain the phrase `disable_cost`, it's easy to
miss when someone try to find all the places that inflates the cost values, e.g.
investigate into cost overflow, precision losses with complex plans, etc.

Change the name to `bitmap_exceeded_work_mem_disable_cost`.
Jira: DB-11285

Test Plan: Jenkins: compile only, build type: debug

Reviewers: tnayak, amartsinchyk, mtakahara

Reviewed By: mtakahara

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D35045
svarnau pushed a commit that referenced this issue May 29, 2024
…of Bitmap Scan CBO

Summary:
Original commits:
* D33861 / eac0c26
* D35044 / ca5b8e6
* D35045 / 49a8e47

Changes:
* There are some differences in actual number of seqs and nexts in the table scan. Fix these by just adding `_IgnoreActualResults` to the tests in `testSeekNextEstimationBitmapScan`

== Summary from D33861 ==
Implemented CBO for Bitmap Scans, using the same approach as PG: store a partially calculated index cost and use that to compute bitmap index access.

If Bitmap Index Scans or Bitmap Ors are predicted to exceed work_mem, they'll have `disable_cost / 2` added to their cost. This discourages the planner from using them,
but still costs them lower than other actually disabled scan types. Without this change, `/*+ BitmapScan(test) */ SELECT * FROM t1000000 ...` will use a sequential scan because it's cheaper, even though the sequential scan has been disabled by the hint.

To better determine if a Bitmap Or will exceed work_mem, more work has been done to determine an estimate of how many rows a Bitmap Or will return.

Also, a slight refactor was done: I put estimated seeks, nexts, width into a YbPlanInfo struct to reduce code duplication of printing / assigning those three values.
Jira: DB-9574

== Summary from D35044 ==
[#22387] YSQL: Fix Bitmap Scan CBO tests

2338431 / D34646 introduced a flag `yb_enable_bitmapscan = false`,
so YB bitmap scans are disabled by default, even when `enable_bitmapscan` is true.

At the same time, eac0c26 / D33861 introduced CBO for bitmap
scans. These tests passed before `yb_enable_bitmapscan` was added, but once it was added, they
started failing because they stopped using bitmap scans.

Fix the tests by setting `yb_enable_bitmapscan = true`.
Jira: DB-11284

== Summary from D35045 ==
[##22388] YSQL: Change name of bitmap_exceeded_work_mem_cost

Because `bitmap_exceeded_work_mem_cost` doesn't contain the phrase `disable_cost`, it's easy to
miss when someone try to find all the places that inflates the cost values, e.g.
investigate into cost overflow, precision losses with complex plans, etc.

Change the name to `bitmap_exceeded_work_mem_disable_cost`.
Jira: DB-11285

Test Plan:
Latest: [[ https://jenkins.dev.yugabyte.com/job/optimizer/job/generate-report/231/artifact/taqo/report/20240501-185328/index_yb_vs_yb_cost-validation_.html | TAQO YB CBO with Bitmap Scans enabled / disabled ]]
* Very few regressions in the default case - highest regression was 1.26 on query e57fd1caa18f59c4e40138d377ec2a01. I checked each regression above 1.1, and they were all run-to-run variances using the same execution plan.

[[ https://jenkins.dev.yugabyte.com/job/optimizer/job/generate-report/224/artifact/taqo/report/20240418-134354/index_yb_vs_yb_cost-validation_bitmap_scan_yb_vs_pg.html | TAQO Run vs PG ]]

[[ https://jenkins.dev.yugabyte.com/job/optimizer/job/generate-report/225/artifact/taqo/report/20240419-131907/index_yb_vs_yb_cost-validation_bitmap_scan_ybstatsonly_vs_pg.html | TAQO Run PG vs YB with only stats ]]

```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgBaseScansCostModel'
./yb_build.sh --java-test 'org.yb.pgsql.TestPgCostModelSeekNextEstimation'
```

Reviewers: gkukreja, mtakahara, amartsinchyk, tnayak

Reviewed By: mtakahara

Subscribers: yql, gkukreja

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D35136
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