High values of Historical metrics segments.scan pending and segments.query.wait.time

Hello experts.
Have a question on relationship between
segment.scan.pending, query.wait.time and query.segment.time in historical metrics.

In our queries we. are seeing high number (in hundreds) of segments scan pending and high value (in seconds) segment.query.wait.time.
I am a little confused what causes this high value and whats the relationship between these metrics.
Can anyone please provide insights on this ?

https://druid.apache.org/docs/latest/operations/metrics.html this does give explanation but still i am not clear what exactly is the order of these metrics and what happens when we say segment scan vs segment query

Hey Vindhya - segments are scanned per core - so if you have a big queue (segment scan pending) then it would sound as if you are executing queries that are scanning lots and lots of segments - and that will make you core-bound. Because they sit in the queue for a long time waiting to be scanned, this leads to a long wait time.