0

I have 2 tables named item and itemdetail. The itemdetail table contains more than 200,000 records. The itemdetail table has reference keys to other tables and I'd like to partition this table by date (once per every year).

What I'd like to know is how I could partition the itemdetail table as it contains reference keys to many other tables. I read somewhere that we can not partition or use inheritance if table contains any reference keys.

Does anyone have any suggestions on how to achieve this?

Thanks

1 Answer 1

2

In PostgreSQL (9.3)'s current inheritance-based implementation of partitioning, you pretty much get partitioning or foreign key enforcement.

Partitioned tables can reference other tables as foreign keys, but they cannot really be the subject of a foreign key reference from another table unless the related tables are also partitioned on the same key, so their references can be to the same sub-table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.