This message was deleted.
# troubleshooting
s
This message was deleted.
r
it supports
AggregateFn(...) filter (where Y)
eg:
count(1) filter ( where httpRspCode not like '5%') as successRate
k
Then do we support the first, aka
Copy code
SELECT 
  COUNT(CASE WHEN httpRspCode not like '5%' THEN 1 ELSE NULL END) 
From table
r
I think yes, but the null may throw out all the results, usually I do sum(case when X then 1 else 0 end) when doing these
k
Right. The intentions is to throw out when WHEN condition is not met. Same effects as
sum(case when X then 1 else 0 end)
Do they have same performance or any other performance difference?
r
Copy code
COUNT(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 d
Do 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-when
both A and B column generates the same execution plan, so there's no difference
k
right. Thx for the info.
r
Copy code
count(1) filter (where mm not like '5%') as X
same plan as well, calcite is very smart