question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DISTINCTCOUNT and DISTINCTCOUNTHLL aggregations are really slow

See original GitHub issue

Pinot version used is 0.4.0

Issue: DISTINCTCOUNT on a string column is much much slower than the group by on that same column. DISTINCTCOUNT query:

Select DISTINCTCOUNT(foo) FROM myTable WHERE col1 = 'value1' AND time_col >= 1596750994918 AND time_col < 1597960594918 AND foo != 'null' limit 1

group by query

Select foo, COUNT(*) FROM myTable WHERE col1 = 'value1' AND time_col >= 1596750994918 AND time_col < 1597960594918 AND foo != 'null' group by foo limit 10000

We don’t have an index on column foo. The DISTINCTCOUNT query was taking anywhere b/w 3 and 6s while the group by query returns in <500ms most of the time. DISTINCTCOUNTHLL was equally slower, if not more in some cases, than DISTINCTCOUNT query.

cc @kishoreg

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kishoregcommented, Aug 24, 2020

one reason might be that group by was using dictionary whereas distinct is not. I think you have fixed this in the recent version.

0reactions
kishoregcommented, Aug 26, 2020

@buchireddy please update this ticket once you have the new version

Read more comments on GitHub >

github_iconTop Results From Across the Web

DISTINCTCOUNT and DISTINCTCOUNTHLL aggregations ...
Issue: DISTINCTCOUNT on a string column is much much slower than the group by on that same column. DISTINCTCOUNT query: Select DISTINCTCOUNT(foo) ...
Read more >
[GitHub] [incubator-pinot] kishoreg commented on issue #5907 ...
[GitHub] [incubator-pinot] kishoreg commented on issue #5907: DISTINCTCOUNT and DISTINCTCOUNTHLL aggregations are really slow.
Read more >
DAX : Approx Distinct Count
For this blog, I want to share an interesting approach that can potentially speed up slow reports that include a distinct count calculation....
Read more >
Slow calculations with DISTINCTCOUNT
And it works perfectly, the outcome is correct, however I have a huge amount of data and DISTINCTCOUNT slows down my calculations a...
Read more >
Aggregation Functions - Apache Pinot Docs
Returns the count of distinct values of a column as Integer . When there are too many distinct values, automatically switch to approximate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found