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

replaceCountStar should also replace count(primary key) and unique indexes with only non-nullable columns #7847

Open
max-hoffman opened this issue May 10, 2024 · 1 comment
Labels

Comments

@max-hoffman
Copy link
Contributor

I think the count of a primary key and count of a unique index with all non-nullable columns should both equivalent to count(*):

create table xyz (x int primary key, y int not null, z int, unique index (y), unique index (z));
select count(x) from xyz; -- plan.TableCount() lookup
select count(y) from xyz; -- plan.TableCount() lookup
select count(z) from xyz; -- NULL values might make this count lower
@max-hoffman
Copy link
Contributor Author

Partially implemented here dolthub/go-mysql-server#2494. We do not implement for unique non-null keys yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant