# Strange: apm generated some SQL query statements that are too long

**URL:** <https://discuss.elastic.co/t/strange-apm-generated-some-sql-query-statements-that-are-too-long/234461>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [May 27, 2020, 5:56am UTC](https://discuss.elastic.co/t/strange-apm-generated-some-sql-query-statements-that-are-too-long/234461 "2020-05-27T05:56:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [May 27, 2020, 5:56am UTC](https://discuss.elastic.co/t/strange-apm-generated-some-sql-query-statements-that-are-too-long/234461/1 "2020-05-27T05:56:15Z")

</div>

service version: .net core 2.1

code:  
[https://paste.ubuntu.com/p/NtMRvpRfwP/](https://paste.ubuntu.com/p/NtMRvpRfwP/)

SQL:

> **[Firefox Send](https://send.firefox.com/download/8f91c7cb891b5d3a/#wyDtNn7ebiODWdWhHSjYJQ)**
>
> Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/2/42f17995432d651f03a4ce659a9e026c00f5f108.png)  
Why is there such a long SQL statement?

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [June 3, 2020, 9:31pm UTC](https://discuss.elastic.co/t/strange-apm-generated-some-sql-query-statements-that-are-too-long/234461/2 "2020-06-03T21:31:17Z")

</div>

Hi @wajika,

unfortunately the Firefox link seems to expire so I haven't seen the captured SQL statement, but I looked at the code you linked.

The way this works is that EF Core creates the SQL queries for you based on your C# code and the agent simply captures the generated SQL statement. I assume the reason for a long statement is that your C# code made EF Core to generate such a query.

Was there a specific problem or is it just "long" and looks bad?

---

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [June 4, 2020, 12:53am UTC](https://discuss.elastic.co/t/strange-apm-generated-some-sql-query-statements-that-are-too-long/234461/3 "2020-06-04T00:53:13Z")

</div>

[google drive](https://drive.google.com/file/d/1WK077ZYVeAqqWCTEv3jRCd5930JvC5rc/view?usp=sharing)  
[pcloud link](https://u.pcloud.link/publink/show?code=XZ5dC6kZ9OzeuH6P44p6KkCkcPlc4phj1gWk)  
I think it is too long  
@GregKalapos

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 24, 2020, 8:53pm UTC](https://discuss.elastic.co/t/strange-apm-generated-some-sql-query-statements-that-are-too-long/234461/4 "2020-06-24T20:53:18Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
