# Very Slow incrementing counter

**URL:** <https://discuss.elastic.co/t/very-slow-incrementing-counter/55114>\
**Category:** Elasticsearch\
**Created:** [July 9, 2016, 2:41pm UTC](https://discuss.elastic.co/t/very-slow-incrementing-counter/55114 "2016-07-09T14:41:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [July 9, 2016, 10:42pm UTC](https://discuss.elastic.co/t/very-slow-incrementing-counter/55114/2 "2016-07-09T22:42:44Z")

</div>

Incrementing the counter requires reindexing the whole document. In a  
system like postgresql that just involves copying the row, probably to the  
same block. Usually you don't even need to mess with indexes. Elasticsearch  
doesn't work like that. It has to reanalyze all the fields and eventually  
build a new segment, inverted index, doc values, and all.

Relational databases make tradeoffs to make updates faster. Elasticsearch  
makes tradeoffs to make aggregations and full text search faster. Those  
tradeoffs are baked in at a fairly deep level.

That said 160ms is quite a bit. You have lots of fields in that document?  
Network between the shards slowish? I dunno, hard to say.

---

_[View the full topic](https://discuss.elastic.co/t/very-slow-incrementing-counter/55114)._
