# New riddle for the enthusiasts, who can give me the answer?

**URL:** <https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [October 27, 2025, 7:26pm UTC](https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878 "2025-10-27T19:26:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [October 27, 2025, 7:26pm UTC](https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878/1 "2025-10-27T19:26:53Z")

</div>

Hello I found more, but this is a simple example

Why gives:

fetch logs | sort content | dedup content | summarize count()

A different value then:

fetch logs&nbsp; | dedup content | sort content | summarize count()

KR Henk

@zanting

---

<div class="post-metadata">

**Author:** ![m3tomlins](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/m3tomlins/32/15924_2.png) [@m3tomlins](https://community.dynatrace.com/u/m3tomlins)\
**Post date:** [October 27, 2025, 8:47pm UTC](https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878/2 "2025-10-27T20:47:42Z")

</div>

FUN!

“_The original order of the records is not preserved. Therefore, by default the sequence of records that are chosen during deduplication is random. If you want to pick a particular record out of the duplicates, you can use the sort parameter._” ([docs](https://docs.dynatrace.com/docs/discover-dynatrace/platform/grail/dynatrace-query-language/commands/filtering-commands#dedup))

- sorting first ensures the order of records sequenced into the deduplication algorithm, potentially more predictable  
&nbsp; - deduplication first on a randomized order seems less predicatable to me

How does this compare internally to using the sort option included in the dedup function?  
&nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; dedup {fieldA, fieldB}, sort {fieldA asc, fieldB desc}

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 28, 2025, 2:25am UTC](https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878/3 "2025-10-28T02:25:29Z")

</div>

[@henk\_stobbe](https://community.dynatrace.com/user/11427)&nbsp;I think the count returned should be same for both the queries , unless they are executed at different intervals . As they are logs which are continuously ingested even less than a second difference can give you a different count

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [October 29, 2025, 1:17pm UTC](https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878/4 "2025-10-29T13:17:47Z")

</div>

Hello,

Problem (at my end) is that every part of the “pipeline” seems to have its own limits (-;&nbsp; so you can loose data in every step. Not sure how to prevent this when using multiple steps.

So starting with 9999 log lines, after the sort you can end up with 8888 (as an example),

KR Henk

---

<div class="post-metadata">

**Author:** ![m3tomlins](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/m3tomlins/32/15924_2.png) [@m3tomlins](https://community.dynatrace.com/u/m3tomlins)\
**Post date:** [October 29, 2025, 2:22pm UTC](https://community.dynatrace.com/t/new-riddle-for-the-enthusiasts-who-can-give-me-the-answer/53878/5 "2025-10-29T14:22:08Z")

</div>

This is true in multiple languages, not just DQL.

The limits on each step in the query are applied from the configuration in the tile/segment.

This would be different from a “| limit {n}” applied at the end of the processing.

For your riddle, however - I think it’s good to remember how the dedup function works in DQL: it is not sorted by default and on a large query, sorting before dedup can improve performance quite a lot.
