# Is \`dataset.select(range(10000))\` efficient?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fis-dataset-select-range-10000-efficient%2F47196%3E%5C
**Category:** 🤗Datasets\
**Created:** [July 18, 2023, 12:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fis-dataset-select-range-10000-efficient%2F47196 "2023-07-18T12:45:53Z")\
**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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNightMachinery)%5C
**Post date:** [July 18, 2023, 12:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fis-dataset-select-range-10000-efficient%2F47196%2F1 "2023-07-18T12:45:53Z")

</div>

Is `dataset.select(range(10000))` efficient?

Is this the best way to select a slice of the dataset?

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmariosasko)%5C
**Post date:** [July 18, 2023, 1:48pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fis-dataset-select-range-10000-efficient%2F47196%2F2 "2023-07-18T13:48:18Z")

</div>

Yes, a monotonically increasing range of numbers allows us to slice the underlying PyArrow table instead of generating an indices mapping (makes indexing slower).
