# Please Advice: Replacing SQL sum with Elastic Search sum

**URL:** <https://discuss.elastic.co/t/please-advice-replacing-sql-sum-with-elastic-search-sum/7435>\
**Category:** Elasticsearch\
**Created:** [April 22, 2012, 6:42pm UTC](https://discuss.elastic.co/t/please-advice-replacing-sql-sum-with-elastic-search-sum/7435 "2012-04-22T18:42:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Saebjoernsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreas_saebjoernsen/32/2904_2.png) [@Andreas\_Saebjoernsen](https://discuss.elastic.co/u/Andreas_Saebjoernsen)\
**Post date:** [April 22, 2012, 6:42pm UTC](https://discuss.elastic.co/t/please-advice-replacing-sql-sum-with-elastic-search-sum/7435/1 "2012-04-22T18:42:46Z")

</div>

We are considering moving an SQL table to a MongoDB document, and  
replace a sum over a column in SQL with an Elastic Search statistical  
facet sum over the equivalent document field. Please let us know if  
this is not a good idea or if there is a better query.

Best,  
Andy

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 25, 2012, 3:36pm UTC](https://discuss.elastic.co/t/please-advice-replacing-sql-sum-with-elastic-search-sum/7435/2 "2012-04-25T15:36:56Z")

</div>

Its a good idea :), note though, when doing that, all the field values will  
be loaded to memory to handle it as fast as possible.

On Sun, Apr 22, 2012 at 9:42 PM, Andy S [andreas@digitalplaywright.com](mailto:andreas@digitalplaywright.com)wrote:

> We are considering moving an SQL table to a MongoDB document, and  
> replace a sum over a column in SQL with an Elastic Search statistical  
> facet sum over the equivalent document field. Please let us know if  
> this is not a good idea or if there is a better query.
> 
> Best,  
> Andy

---

<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:** [July 6, 2017, 3:31am UTC](https://discuss.elastic.co/t/please-advice-replacing-sql-sum-with-elastic-search-sum/7435/3 "2017-07-06T03:31:08Z")

</div>


