Skip to content

Partitioning Support in Doctrine for Relational Database #4657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cs-alok-agarwal opened this issue May 24, 2021 · 12 comments
Open

Partitioning Support in Doctrine for Relational Database #4657

cs-alok-agarwal opened this issue May 24, 2021 · 12 comments

Comments

@cs-alok-agarwal
Copy link

Partitioning Support in Doctrine for Relational Databases

Q A
New Feature yes
RFC no
BC Break no

Summary

Request a support for partitioning support in native doctrine.
https://www.postgresql.org/docs/12/ddl-partitioning.html

Main Challenge in implementing partitioning currently is, partitioning needs to be defined while create table itself.
Currently as the option is not available we cannot use same

From Postgres Documentation:
_It is not possible to turn a regular table into a partitioned table or vice versa. However, it is possible to add an existing regular or partitioned table as a partition of a partitioned table, or remove a partition from a partitioned table turning it into a standalone table. Link

Similar to index or unique constraint support we can have partitioning column support too for Databases.
Like partition_option({"type": "range", column: "date", max_partition: 40})

@pierre-cba
Copy link

I'm looking for this feature !

@morozov
Copy link
Member

morozov commented Jul 14, 2021

I don't think we can just add a platform-specific feature to the DBAL API. Even if partitioning is supported by multiple platforms, there are high chances that their APIs and capabilities are different. The only reasonable way to support features like this is to break the Platform API down to smaller pieces and make them extensible independently. Something along the lines documented in #3731.

@SteppingHat
Copy link

I second this! Horizontal partitioning is a powerful feature for large datasets where newer entries are accessed more frequently than older entries.
If Doctrine can natively support this it would be a HUGE feature add. The amount of work required to manually implement this is huge and could definitely be simplified.

Sales pitch aside, I also am an advocate for #3731 as this opens a door to exploring platform specific features, and to my knowledge has no downsides (much like how Symfony is structured).

@SteppingHat
Copy link

Also this isn't PostgreSQL specific, MySQL/MariaDB supports this too.

@BenMorel
Copy link
Contributor

BenMorel commented Apr 3, 2023

Hi, we need this too. Is there a workaround we can implement (in code) in the meantime, to get doctrine:schema:validate correctly validate our table with partitions?

@digitaltim-de
Copy link

Hello, we need this too. Its important feature!

@derrabus
Copy link
Member

Hello, we need this too. Its important feature!

Go ahead and build that feature, then.

@vytsci
Copy link

vytsci commented Feb 21, 2024

Hello, we need this too. Its important feature!

Go ahead and build that feature, then.

Rather than being sarcastic, maybe there is some guidelines, how we can approach this?

@derrabus
Copy link
Member

Rather than being sarcastic

Nobody's being sarcastic. This is a community-driven open source project. If you want a change to happen, make it happen.

@nikophil
Copy link
Contributor

nikophil commented Sep 3, 2024

Hello,

maybe at least we could make the dbal see "partiioned" table, and ignore "partitions"?

this would allow to work with manually partitioned tables as doctrine would consider them as normal tables, and would not suggest to remove partitions

see #6516

derrabus pushed a commit that referenced this issue Sep 4, 2024
<!-- Fill in the relevant information below to help triage your pull
request. -->

|      Q       |   A
|------------- | -----------
| Type         | improvement

Partitioned tables is a complex topic which [is not fully supported by
Doctrine](#4657).

Currently, with PostgreSQL, Doctrine does not "see" partitioned tables,
and only "sees" partitions, which is problematic and should be done the
other way. This PR fixes this in
`PostgreSQLSchemaManager::selectTableColumns()`.

**Before this PR:**
- does not see at all "partitioned tables" (which are the actual tables
related to an entity)
- doctrine suggest to remove all "partitions"

**After this PR:**
- `doctrine:schema:validate` is happy, even if tables have been
partitioned manually

see #4657 (comment)

Note: I'd want to see if maintainers folks are willing to accept such
modification before digging into the tests for this
@nikophil
Copy link
Contributor

nikophil commented Sep 5, 2024

Is there a workaround we can implement (in code) in the meantime, to get doctrine:schema:validate correctly validate our table with partitions?

@BenMorel in #6516, in dbal v4.2, you'll be able to transparently use partitions tables with doctrine

@BenMorel
Copy link
Contributor

BenMorel commented Sep 5, 2024

@nikophil Well done, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants