# DQL - get the top 5 process of each host

**URL:** <https://community.dynatrace.com/t/dql-get-the-top-5-process-of-each-host/40034>\
**Category:** DQL\
**Tags:** dql\
**Created:** [June 1, 2023, 5:40pm UTC](https://community.dynatrace.com/t/dql-get-the-top-5-process-of-each-host/40034 "2023-06-01T17:40:13Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![StephenLHChan](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@StephenLHChan](https://community.dynatrace.com/u/StephenLHChan)\
**Post date:** [June 1, 2023, 5:40pm UTC](https://community.dynatrace.com/t/dql-get-the-top-5-process-of-each-host/40034/1 "2023-06-01T17:40:13Z")

</div>

Hi,

I am now facing a problem when writing the DQL query to get the top 5 processes of each host in an 1-hour interval.

Here is the DQL that I come up with:

```python
timeseries max(dt.process.cpu.usage), 
by:{host.name, dt.process_group_instance}, 
interval:1h, 
from:-2h, 
to:now()
| limit 5

```

But seems like the logic is not correct.&nbsp; If I add “limit 5”, it only shows me 5 records in total.

I need the host name and process name in the result.

Grateful if anyone can help on the this issue.

Thanks!

---

_[View the full topic](https://community.dynatrace.com/t/dql-get-the-top-5-process-of-each-host/40034)._
