# DQL too much data read message

**URL:** <https://community.dynatrace.com/t/dql-too-much-data-read-message/40043>\
**Category:** DQL\
**Tags:** dql, latest-dynatrace, notebooks\
**Created:** [June 2, 2023, 11:09am UTC](https://community.dynatrace.com/t/dql-too-much-data-read-message/40043 "2023-06-02T11:09:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivart\_89](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@sivart\_89](https://community.dynatrace.com/u/sivart_89)\
**Post date:** [June 2, 2023, 11:09am UTC](https://community.dynatrace.com/t/dql-too-much-data-read-message/40043/1 "2023-06-02T11:09:35Z")

</div>

Is there any way to get around the below message without limiting my results and making multiple queries? My dql is below, we have 2.75k hosts in that mgmt zone.

The lookup command’s subquery read too much data. Please continue to filter the lookup table or narrow the query time range

timeseries cpuUsage = avg(dt.process.cpu.usage), by:{host.name, dt.entity.process\_group\_instance}, interval:1h, from:-2h, to:now()  
| sort arrayAvg(cpuUsage) desc  
| limit 5  
| lookup [fetch dt.entity.process\_group\_instance], sourceField:dt.entity.process\_group\_instance, lookupField:id  
| filter matchesValue(lookup.managementZones, “UNIX”)  
| fieldsRename process\_group\_instance.name = lookup.entity.name  
| fieldsRemove lookup.id, dt.entity.process\_group\_instance

---

<div class="post-metadata">

**Author:** ![David\_Hauger](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/david_hauger/32/13595_2.png) [@David\_Hauger](https://community.dynatrace.com/u/David_Hauger)\
**Post date:** [June 5, 2023, 8:06am UTC](https://community.dynatrace.com/t/dql-too-much-data-read-message/40043/2 "2023-06-05T08:06:43Z")

</div>

The limitation is based on the implementation of the lookup command, which collects the data from the nested execution block. Keeping the full pgi information in memory is a bit too much.

As the timeseries query is the shorter/less expensive part of your query, you could also turn the query around.

```java
fetch dt.entity.process_group_instance
| lookup [
    timeseries cpuUsage = avg(dt.process.cpu.usage), by:{host.name, dt.entity.process_group_instance}, interval:1h
    | sort arrayAvg(cpuUsage), direction:"descending"
    | limit 5
], sourceField:id, lookupField:dt.entity.process_group_instance
| ....

```

you can also specify the fields/ prefix in the lookup command to add the fields that you want in your result,…  
But I guess this example here might be a good starting point.  
As the inner execution block now contains only 5 elements, this should make the query cheaper and faster - and no limitations would need to apply.
