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] Cost based optimization #3101

Open
ndeodhar opened this issue Dec 6, 2019 · 1 comment
Open

[YSQL] Cost based optimization #3101

ndeodhar opened this issue Dec 6, 2019 · 1 comment
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@ndeodhar
Copy link
Contributor

ndeodhar commented Dec 6, 2019

Jira Link: DB-1656
There are several cost based optimizations needed for YSQL.
Some examples,
If table and index have the same PK, use table instead of index since table scan is more performant for YB. Today, we choose the index.

EXPLAIN SELECT * FROM airports WHERE iso_region = 'US-CA' LIMIT 1;
                                      QUERY PLAN
---------------------------------------------------------------------------------------
 Limit  (cost=0.00..0.50 rows=1 width=356)
   ->  Index Scan using airports_idx2 on airports  (cost=0.00..5.04 rows=10 width=356)
         Index Cond: (iso_region = 'US-CA'::text)
(3 rows)

Here airports and airports_idx2 have the same PK and our quiery plan selects index scan.

Another example: #2959

@ndeodhar ndeodhar added the area/ysql Yugabyte SQL (YSQL) label Dec 6, 2019
@ndeodhar ndeodhar added this to the v2.1 milestone Dec 6, 2019
@ddorian
Copy link
Contributor

ddorian commented Jan 20, 2020

@ndeodhar
If partial-index has all the columns that the query needs (where + include), always use that ?

@ndeodhar ndeodhar removed this from the v2.1 milestone May 19, 2020
@m-iancu m-iancu added this to YQL-beta Nov 30, 2021
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jun 8, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug labels Aug 24, 2022
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
Status: No status
Development

No branches or pull requests

6 participants