Closed fatkodima closed 4 months ago
Hi @fatkodima,
fill
functionality is designed for append-only tables.Thanks for the quick answer! Had you considered it to be not only for append-only tables or prefer for it to be that way? We have a usecase to partition the table where any row can be updated.
Not sure I'd like to include the complexity, but if you put together a general way, feel free to share.
I have a few suggestions and want to verify my understanding of the approaches used by this gem. Questions are related to declarative partitioning.
pgslice add_partitions
, it adds primary keys per partition with unique values generated per partition. This is problematic, for example, when we try to search the record by id and forgot to use partitioning key in the query. It can return incorrect row. I think we should create a global sequence for the parent table, something like described in https://www.dragonflydb.io/faq/postgresql-partition-auto-incrementI think, the step 8 is not really needed and is dangerous. Imagine after the steps 5 and 7 were completed, we now have a partitioned table swapped in place and new rows were inserted with the next id numbers from what it currently has. What happens if we try to run step 8 and copying rows with already existing ids?
What we should really do, is remove step 8, but suggest people to run step 5 again exactly before the step 7, and in step 7 lock both tables, copy missing rows and do the swap.