Slackbot
11/09/2022, 8:56 PMRenato Santos
11/09/2022, 10:03 PMAggregateFn(...) filter (where Y) eg:
count(1) filter ( where httpRspCode not like '5%') as successRateKai Sun
11/09/2022, 10:05 PMSELECT
COUNT(CASE WHEN httpRspCode not like '5%' THEN 1 ELSE NULL END)
From tableRenato Santos
11/09/2022, 10:06 PMKai Sun
11/09/2022, 10:08 PMsum(case when X then 1 else 0 end)Kai Sun
11/09/2022, 10:08 PMRenato Santos
11/09/2022, 10:08 PMCOUNT(CASE WHEN mm not like '5%' THEN 1 ELSE NULL END) as a,
sum(CASE WHEN mm not like '5%' THEN 1 ELSE 0 END) as b,
COUNT(1) as c,
sum(CASE WHEN mm not like '5%' THEN 1 ELSE 1 END) as dRenato Santos
11/09/2022, 10:09 PMDo they have same performance or any other performance difference?As far as I'm aware, it should be very little difference, most of the work will depends on your entire query condition and the how many segments you can exclude using the __time column the
col like 'Y%' is very fast because is done on the bitmap index just once for each string, then a bitmap index will be used to match the rows , maybe count(1) with filter can be a little faster than using a case-whenRenato Santos
11/09/2022, 10:15 PMKai Sun
11/09/2022, 10:15 PMRenato Santos
11/09/2022, 10:21 PMcount(1) filter (where mm not like '5%') as X
same plan as well, calcite is very smart