dolthub / dolthub/dolt

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

Open
#7,847 1 comment 0 reactions 0 assignees View on GitHub
analyzer performance sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

I think the count of a primary key and count of a unique index with all non-nullable columns should both equivalent to `count(*)`:
```sql
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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.