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

translate count(*) to count(1) automatically #5171

Closed
zachmu opened this issue Jan 19, 2023 · 2 comments · Fixed by dolthub/go-mysql-server#1576
Closed

translate count(*) to count(1) automatically #5171

zachmu opened this issue Jan 19, 2023 · 2 comments · Fixed by dolthub/go-mysql-server#1576
Labels
performance sql Issue with SQL

Comments

@zachmu
Copy link
Member

zachmu commented Jan 19, 2023

Customer reports that query select count(*) from table where col is null is consuming 100% CPU and not returning. Table has approximately 1M rows. Same query with count(primary_key_col) is fast, as expected.

@timsehn timsehn added sql Issue with SQL performance labels Jan 25, 2023
@timsehn
Copy link
Sponsor Contributor

timsehn commented Jan 25, 2023

This was diagnosed to be related to the use of text columns which are blobs. Performance degradation in this case was much worse.

@zachmu
Copy link
Member Author

zachmu commented Feb 1, 2023

Remaining work here is to automatically translate count(*) into count(1) in the analyzer. Updating description.

@zachmu zachmu changed the title count(1) much faster than count(*) in query translate count(*) to count(1) automatically Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance sql Issue with SQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants