# Reads are suffering badly

**URL:** <https://forum.tiledb.com/t/reads-are-suffering-badly/92>\
**Category:** Uncategorized\
**Created:** [June 27, 2019, 12:51am UTC](https://forum.tiledb.com/t/reads-are-suffering-badly/92 "2019-06-27T00:51:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TileDbUser](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@TileDbUser](https://forum.tiledb.com/u/TileDbUser)\
**Post date:** [June 27, 2019, 12:51am UTC](https://forum.tiledb.com/t/reads-are-suffering-badly/92/1 "2019-06-27T00:51:33Z")

</div>

I have a two dimensional dense array with float properties.

```
domain.add_dimension(Dimension::create<int>(ctx, "rows", {{row_dimension.start, row_dimension.end}}, row_dimension.tileExtent))
            .add_dimension(Dimension::create<int>(ctx, "cols", {{column_dimension.start, column_dimension.end}}, column_dimension.tileExtent));

```

my tile configuration is as below:

(1,5000,1,1,5000000,5000000). In short an array of (5K X 5M) where each tile is (1 row X 5M columns) = total 5k Tiles.

I am writing in this array with Row\_major direction. where each row is a sample that has been processed. I have no issues with write times and it writes pretty fast. However, when it comes to reading. It is severely slow when it comes to large array. When it is a small array (15 rows X 5m columns). Reading is pretty fast but when I try that on (5k Rows X 5m columns) and try to get .slice which is (100 Row X 100k Columns), it is pretty much taking 2 minutes. Which sounds pretty bizarre. Any suggestions?

---

<div class="post-metadata">

**Author:** ![jakebolewski](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/jakebolewski/32/28_2.png) [@jakebolewski](https://forum.tiledb.com/u/jakebolewski)\
**Post date:** [June 27, 2019, 1:58pm UTC](https://forum.tiledb.com/t/reads-are-suffering-badly/92/2 "2019-06-27T13:58:22Z")

</div>

@TileDbUser, I think you have to adjust your tiling scheme a bit to have a better “average case”. Here the tiling is (1, 5\_000\_000). Every time you read a 1 row tile, your IO cost is 5\_000\_000 (compressed) cells, so your io efficiency with 1 row is ~ 5\_000\_000 / (15\_000) if all 15\_000 columns read are contained within one tile. This will work decently well if most of your queries are single row at a time. If they are 15\_000k rows though you can see the io efficiency is probably very low (you can verify this with tiledb::stats output instrumenting the reads).

The solution here to to pick a better compromise for your workload, tile more rows together and reduce the column tiling. By playing with a subset of the data and looking at the stats output you can get a better sense of a good tiling scheme. Unfortunately it’s hard to tell apriori what this is because each use case is different but we are working on solutions to suggest better ones.

-Jake

---

<div class="post-metadata">

**Author:** ![stavros](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@stavros](https://forum.tiledb.com/u/stavros)\
**Post date:** [June 27, 2019, 6:12pm UTC](https://forum.tiledb.com/t/reads-are-suffering-badly/92/3 "2019-06-27T18:12:35Z")

</div>

[These docs](https://docs.tiledb.io/en/stable/performance/performance-factors.html#arrays) might also help get a better understanding of the effect of tiling on performance (e.g., paragraph `Space Tiling`).

---

<div class="post-metadata">

**Author:** ![TileDbUser](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@TileDbUser](https://forum.tiledb.com/u/TileDbUser)\
**Post date:** [June 28, 2019, 6:28pm UTC](https://forum.tiledb.com/t/reads-are-suffering-badly/92/4 "2019-06-28T18:28:48Z")

</div>

Thanks Jake. It was very helpful.

---

<div class="post-metadata">

**Author:** ![TileDbUser](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@TileDbUser](https://forum.tiledb.com/u/TileDbUser)\
**Post date:** [June 28, 2019, 6:29pm UTC](https://forum.tiledb.com/t/reads-are-suffering-badly/92/5 "2019-06-28T18:29:01Z")

</div>

Thank you. I will look into this.
