Slackbot
10/26/2023, 2:45 PMJohn Kowtko
10/26/2023, 2:56 PMGian Merlino
10/26/2023, 3:35 PMCLP_ID. If it's very high you could get better performance using approximation like APPROX_COUNT_DISTINCT_DS_HLLVignesh Shetty
10/26/2023, 5:52 PM`CMO_ID` String,
`CODE` String,
`LABEL` String,
`CLP_ID` Int64,
`PLP_ID` Int64,
`CATEGORY` String,
`CATEGORY_ID` UInt8,
`ROLL_UP_DATE` DateBen Krug
10/26/2023, 5:53 PMAPPROX_COUNT_DISTINCT_DS_HLL). Also, making CLP_ID a string instead of number might be faster for exact count distincts, if you need them. (A guess based on strings having dictionaries made.)Vignesh Shetty
10/26/2023, 5:56 PMSELECT
cmo_id,
count(distinct clp_id) as clp_id,
count( distinct plp_id) as plp_id
from
test.test_table
where
code in (
'785P10',
'POL0000',
'IOPL0129',
'Z79IKL',
'FLKMD',
'HJYIWSXD',
'FIOKDS',
'7990WJ',
'LPOXEIO',
'IISNEW'
)
and roll_up_date BETWEEN '2020-01-01'
and '2023-12-31'
group by
cmo_id
limit
10
Here is the same query, which will be serve my use caseVignesh Shetty
10/26/2023, 5:57 PMBen Krug
10/26/2023, 6:32 PMGian Merlino
10/26/2023, 8:31 PMVignesh Shetty
10/27/2023, 12:32 AM