# What does “column stride field” mean regarding “doc values ” in elasticsearch/lecune

**URL:** <https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332>\
**Category:** Elasticsearch\
**Created:** [December 12, 2017, 12:36pm UTC](https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332 "2017-12-12T12:36:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nadiGam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nadigam/32/124078_2.png) [@nadiGam](https://discuss.elastic.co/u/nadiGam)\
**Post date:** [December 12, 2017, 12:36pm UTC](https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332/1 "2017-12-12T12:36:33Z")

</div>

I post this question also in stackoverflow :

> <https://stackoverflow.com/questions/47760307/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-le>

I'm trying to understand specifically what does colum-stride mean ? and why is this so efficient for sorting/aggregation ?  
is it just the fact that there's a mapping from documentid to its fields ? or its also something specific of the implementation of this data structure that make it so efficient ?

Thanks !

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [December 12, 2017, 3:21pm UTC](https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332/2 "2017-12-12T15:21:43Z")

</div>

> [@nadiGam](#):
>
> why is this so efficient for sorting/aggregation ?

Historically an O(1) data structure that could be directly addressed using a doc ID.  
Sparse values were an issue so more recently moved to an iterator API with skip-ahead support when retrieving values for matching docs.

See [Sparse versus dense document values with Apache Lucene | Elastic Blog](https://www.elastic.co/blog/sparse-versus-dense-document-values-with-apache-lucene) for more.

---

<div class="post-metadata">

**Author:** ![nadiGam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nadigam/32/124078_2.png) [@nadiGam](https://discuss.elastic.co/u/nadiGam)\
**Post date:** [December 12, 2017, 4:40pm UTC](https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332/3 "2017-12-12T16:40:12Z")

</div>

What does column stride mean ?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [December 12, 2017, 4:56pm UTC](https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332/4 "2017-12-12T16:56:04Z")

</div>

It means data is organized in a columnar fashion. For instance say you have 3 records: [{A: 1, B:42}, {A: 5, B:12}, {A: 5, B:6}], a column store would actually store something that looks like: { A: [1, 5, 5], B: [42, 12, 6]}. The benefit is that it is usually easier to compress since data is typically homogeneous in a single field, and more efficient for queries that target a limited number of fields by making better use of CPU caches and of the filesystem cache. The downside is that if you want to retrieve all field/value pairs for a given record, this will perform a number of random access that is linear with the number of fields while a row store could do one seek and then read a single chunk that contains all field/value pairs.

---

<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:** [January 9, 2018, 4:56pm UTC](https://discuss.elastic.co/t/what-does-column-stride-field-mean-regarding-doc-values-in-elasticsearch-lecune/111332/5 "2018-01-09T16:56:19Z")

</div>

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