# LINEAR HASH Partitioning Type

## Syntax

```sql
PARTITION BY LINEAR HASH (partitioning_expression)
[PARTITIONS(number_of_partitions)]
```

## Description

`LINEAR HASH` partitioning is a form of [partitioning](/docs/server/server-usage/partitioning-tables.md), similar to [HASH partitioning](/docs/server/server-usage/partitioning-tables/partitioning-types/hash-partitioning-type.md), in which the server takes care of the partition in which to place the data, ensuring a relatively even distribution among the partitions.

`LINEAR HASH` partitioning makes use of a powers-of-two algorithm, while `HASH` partitioning uses the modulus of the hashing function's value. Adding, dropping, merging and splitting partitions is much faster than with the [HASH partitioning type](/docs/server/server-usage/partitioning-tables/partitioning-types/hash-partitioning-type.md), however, data is less likely to be evenly distributed over the partitions.

## Example

```sql
CREATE OR REPLACE TABLE t1 (c1 INT, c2 DATETIME) 
  PARTITION BY LINEAR HASH(TO_DAYS(c2)) 
  PARTITIONS 5;
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/server-usage/partitioning-tables/partitioning-types/linear-hash-partitioning-type.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
