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] Select on column used in partial index does not use the index #2275

Closed
ndeodhar opened this issue Sep 11, 2019 · 1 comment
Closed
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)
Milestone

Comments

@ndeodhar
Copy link
Contributor

After creating a partial index on a column, if we run a select query with a condition based on that column, we do a full scan of the table instead of using the index:

CREATE INDEX discontinued_products
ON products(discontinued)
WHERE discontinued = 1;

EXPLAIN SELECT
   product_id,
   product_name,
   discontinued
FROM
   products
WHERE
   discontinued = 1;


Foreign Scan on products  (cost=0.00..102.50 rows=1000 width=104)
@ndeodhar ndeodhar self-assigned this Sep 11, 2019
@ndeodhar ndeodhar added the area/ysql Yugabyte SQL (YSQL) label Sep 11, 2019
@ndeodhar ndeodhar added this to the v2.1 milestone Sep 11, 2019
@ndeodhar
Copy link
Contributor Author

ndeodhar commented Jun 8, 2020

Fixed as a result of #4494.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
None yet
Development

No branches or pull requests

1 participant