Forum Discussion
query cassandra database in report builder
Hi,
I'm using report builder to generate a report and my data source is cassandra database in shared data source in pbi report server.
At first, when I create a data set, my query is:
select * from table where user_id in (@user_id)
and my parameter can mutiselect, then I got error :
Error while executing a query in Cassandra: [33562624] : line 17:18 no viable alternative at character '@'
Then I cancel the multiselect for parameter and use the expression to generate the query and my expression is:
=" select * from table where user_id = '" & Parameters!userid.Value & "' "
Then the report generated very fast
After that, I tick the multiselect for parameter again and change the expression like :
=" select * from table where log_time >= '" & Format(Parameters!start.Value, "yyyy-MM-dd") & "' and log_time <= '" & Format(Parameters!end.Value, "yyyy-MM-dd") & "' "
Then the report generate very very slow maybe takes aroud 5 minutes.
Anyone help to improve the query of ths dataset?
Thank you!
Hi, Tengmin123
I see that you use format in the query. If the data type is originally date, this step is not necessary. Secondly, I see that you want to filter the data over a period of time, so this is already the simplest query, if the time is still long, it should be due to the relatively large amount of data.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-janeyg-msftCommunity Support
Hi, Tengmin123
I see that you use format in the query. If the data type is originally date, this step is not necessary. Secondly, I see that you want to filter the data over a period of time, so this is already the simplest query, if the time is still long, it should be due to the relatively large amount of data.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.