Skip to content
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

Partitioning and Foreign Keys #27

Closed
openrijal opened this issue Mar 25, 2016 · 2 comments
Closed

Partitioning and Foreign Keys #27

openrijal opened this issue Mar 25, 2016 · 2 comments
Assignees
Labels

Comments

@openrijal
Copy link

Hello.

Is the foreignkey limitation only when you try to partition based on a column which is a foreignkey? Or is it like you cannot partition a table if any of its columns are involved in foreignkeys?

I'm using PostgreSQL and have followed all the methods described in the docs. When I add partition to a table with the foreignkey column as the column name, it prevents with foreignkey violation, again if I re-create the partition based on a date field which is not a foreignkey it also gives the same error.

I was just asking if I was doing something very wrong here?

@maxtepkeev
Copy link
Owner

Hi Nitesh,

Yes, currently table partitioning isn't supported for tables which have at least one foreign key and it doesn't matter whether you're going to partition on a column which is a foreign key or not. So currently the rule is, if table have at least one foreign key, partitioning won't work.

This is a PostgreSQL limitation and all the approaches which exist for supporting table partitioning with foreign keys (like the one described in #25) are just workarounds which have (sometimes significant) performance costs.

@maxtepkeev
Copy link
Owner

I believe this can be closed.

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

No branches or pull requests

2 participants