# Sql Query vs Dsl Query

**URL:** <https://discuss.elastic.co/t/sql-query-vs-dsl-query/247048>\
**Category:** Elasticsearch\
**Created:** [September 1, 2020, 5:58am UTC](https://discuss.elastic.co/t/sql-query-vs-dsl-query/247048 "2020-09-01T05:58:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nupur](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Nupur](https://discuss.elastic.co/u/Nupur)\
**Post date:** [September 1, 2020, 5:58am UTC](https://discuss.elastic.co/t/sql-query-vs-dsl-query/247048/1 "2020-09-01T05:58:14Z")

</div>

querying through sql access api or querying through dsl .. which is faster in searching . Is there is performance difference in both.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 1, 2020, 5:59am UTC](https://discuss.elastic.co/t/sql-query-vs-dsl-query/247048/2 "2020-09-01T05:59:41Z")

</div>

You would thing that the DSL would be faster, as there is no translation from SQL\<\>DSL.

I don't know how much of a difference it'd be, it's something you would want to test with your use case, and then see if it's worth the cost.

---

<div class="post-metadata">

**Author:** ![bogdan.pintea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogdan.pintea/32/45740_2.png) [@bogdan.pintea](https://discuss.elastic.co/u/bogdan.pintea)\
**Post date:** [September 10, 2020, 1:32pm UTC](https://discuss.elastic.co/t/sql-query-vs-dsl-query/247048/3 "2020-09-10T13:32:07Z")

</div>

Generally the cost of translation should be negligible compared to the cost of executing the query, but definitely, non-zero.

Mind however that some SQL queries can involve an extra data processing step - like sorting - in the SQL plugin (vs just piping the answer through), which otherwise - when using DSL only - you might have to implement on the client. So it could be that the SQL way might turn faster in specific cases, everything considered.

But indeed, testing with your specific cases should give you a better idea.

---

<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:** [October 8, 2020, 1:32pm UTC](https://discuss.elastic.co/t/sql-query-vs-dsl-query/247048/4 "2020-10-08T13:32:22Z")

</div>

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