Split out list-related records into separate partitions
This commit is contained in:
parent
765b7b792b
commit
0898658acb
1 changed files with 17 additions and 0 deletions
17
db-migration/20240221_partition-lists.sql
Normal file
17
db-migration/20240221_partition-lists.sql
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
alter table records detach partition records_default;
|
||||||
|
|
||||||
|
create table records_list
|
||||||
|
partition of records for values in ('app.bsky.graph.list');
|
||||||
|
create table records_listblock
|
||||||
|
partition of records for values in ('app.bsky.graph.listblock');
|
||||||
|
create table records_listitem
|
||||||
|
partition of records for values in ('app.bsky.graph.listitem');
|
||||||
|
|
||||||
|
with moved_rows as (
|
||||||
|
delete from records_default r
|
||||||
|
where collection in ('app.bsky.graph.list', 'app.bsky.graph.listblock', 'app.bsky.graph.listitem')
|
||||||
|
returning r.*
|
||||||
|
)
|
||||||
|
insert into records select * from moved_rows;
|
||||||
|
|
||||||
|
alter table records attach partition records_default default;
|
Loading…
Add table
Add a link
Reference in a new issue