# Function partition\_hash not working as expected

**URL:** <https://forum.yugabyte.com/t/function-partition-hash-not-working-as-expected/1946>\
**Category:** General\
**Created:** [January 11, 2023, 3:43pm UTC](https://forum.yugabyte.com/t/function-partition-hash-not-working-as-expected/1946 "2023-01-11T15:43:45Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)\
**Post date:** [January 12, 2023, 4:06pm UTC](https://forum.yugabyte.com/t/function-partition-hash-not-working-as-expected/1946/15 "2023-01-12T16:06:07Z")

</div>

> [@ulim](#):
>
> So adding time to the partition key would distribute the data,

Yes it will. But you didn’t add `time` to the partition key. Need to be like this:

```cql
PRIMARY KEY ((data_id, time))

```

> [@ulim](#):
>
> what I want in terms of read performance

Depends on your queries. The rows for a single `data_id` will be spread on multiple tablets (probably on all tablets).

> [@ulim](#):
>
> So it seems there is no way to delete large partitions at all?

Is this time-series and you’re deleting old data? If yes, you can do partitioning on multiple tables and then you just “drop” or “truncate” old tables. Like I explained in [Database schema in YugabyteDB for storing statistics collected periodically](https://forum.yugabyte.com/t/database-schema-in-yugabytedb-for-storing-statistics-collected-periodically/1800)

Getting a timeout on a query in a tablet means that there are just too many tombstones that haven’t been compacted. A compact table command should fix this [yb-ts-cli - command line tool for advanced yb-tserver operations | YugabyteDB Docs](https://docs.yugabyte.com/preview/admin/yb-ts-cli/#compact-tablet)

> [@ulim](#):
>
> Or is there a way to increase the timeout beyond 60 seconds for the Java driver?

There should be a way, I’ll ask internally. This is for the `DELETE` statement, correct?

---

_[View the full topic](https://forum.yugabyte.com/t/function-partition-hash-not-working-as-expected/1946)._
