<@U01UL37KF28> Moving to troubleshooting: <https:/...
# troubleshooting
m
Given that the query is inherently expensive, perhaps you can share a bit about the use case so we can see if the query itself can be modified
k
@Mayank We have two types of queries
Copy code
select userid,eventlabel,sessionid, MIN(timestampist) as mint, MAX(timestampist) as maxt, (MAX(timestampist) - MIN(timestampist)) as diff_time  from default.click_stream where sessionid !='null' and timestampist between 1615833000000 and 1616225312000 group by userid,eventlabel,sessionid
select userid, v1, max(timestamp) as timestampist from clickstream where eventlabel=‘app_classroom_video_seen’ and k1 = ‘video_id’ and timestampist between 1608057000000 and 1615965662009 group by userid, v1
These queries are taking too much time process every time.. Its taking more than 60 Sec and got timed out Total docs as of now is : 310767668
m
When I say use case I mean what is the end goal, is this a dashboard, how it is going to be used etc
k
It’s going to be a dashboard and its like 500 around concurrent users may use it in parallel. Every time a users opens this dashboard it will fire these queries.
m
So if there are 500M records selected in query with 1minutr granularity there will be millions of groups (at least)
Is the dashboard going to show all that?
k
As you suggested i made it to 1 day level granuality. As i can live with 1 day granuality.
m
Can you do offline also?
For example real-time for 1 day and preaggregate in offline with star tree for 29’days
k
How its gonna help here ?
m
Offline preaggregation with star tree will be very fast
k
I have to maintain 2 tables one is realtime with one day granulaity and 1 with 29 days ?
m
Nope
k
offline with 29
m
Single table
k
Ok, what are the changes i should made it ?
m
Single table with offline and real-time component. Generate star tree in offline and push
Do you have an estimate of how many unique sessions per day? And how many unique groups you expect?
If we can somehow control the number of unique groups a query has to process that would help
k
I’ll check and let you know