# Is \`flatten\_indices\` needed after a \`filter\`?

**URL:** <https://discuss.huggingface.co/t/is-flatten-indices-needed-after-a-filter/46754>\
**Category:** 🤗Datasets\
**Created:** [July 13, 2023, 9:08pm UTC](https://discuss.huggingface.co/t/is-flatten-indices-needed-after-a-filter/46754 "2023-07-13T21:08:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NightMachinery](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nightmachinery/32/3366_2.png) [@NightMachinery](https://discuss.huggingface.co/u/NightMachinery)\
**Post date:** [July 13, 2023, 9:08pm UTC](https://discuss.huggingface.co/t/is-flatten-indices-needed-after-a-filter/46754/1 "2023-07-13T21:08:34Z")

</div>

Is `flatten_indices` needed after a `filter` for better performance?

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](https://discuss.huggingface.co/u/mariosasko)\
**Post date:** [July 14, 2023, 11:59am UTC](https://discuss.huggingface.co/t/is-flatten-indices-needed-after-a-filter/46754/2 "2023-07-14T11:59:45Z")

</div>

Calling `flatten_indices` on a filtered dataset gives the best performance but requires disk space for caching the dataset.
