Partition builds queuing tables using list-based partitioning
`ci_pending_builds` is a queuing-like table. Records are being consumed quickly and continuously. Records older than 24 hours can be expired (deleted).
As such, it is small (< 5MB) but has a significant [rate of churn](https://thanos-query.ops.gitlab.net/graph?g0.expr=sum(rate(pg_stat_user_tables_n_tup_del%7Benv%3D%22gprd%22%2C%20relname%3D%22ci_pending_builds%22%7D%5B5m%5D)%20%2B%20rate(pg_stat_user_tables_n_tup_ins%7Benv%3D%22gprd%22%2C%20relname%3D%22ci_pending_builds%22%7D%5B5m%5D)%20%2B%20rate(pg_stat_user_tables_n_tup_upd%7Benv%3D%22gprd%22%2C%20relname%3D%22ci_pending_builds%22%7D%5B5m%5D))&g0.tab=0&g0.stacked=0&g0.range_input=2d&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=%5B%5D) (updates/deletes).
Due to the high churn rate, autovacuum activity is very frequent (sometimes multiple times per second): https://log.gprd.gitlab.net/goto/5546efb4b33b9cda77fd684df76ea7f1
Overall, we'd like to tune autovacuum activity for this table (separate issue - https://gitlab.com/gitlab-org/gitlab/-/issues/343623).
# Proposal
This issue suggests to prepare `ci_pending_builds` for list-style partitioning to implement a partitioning-based queuing pattern in postgres (todo - we should describe this somewhere as a pattern! => https://gitlab.com/gitlab-org/gitlab/-/issues/347027).
This is in preparation for https://gitlab.com/gitlab-org/gitlab/-/issues/343084, which adds ability to manage those partitions.
To prepare for this, we can do the following:
1. Create new table, partitioned by `LIST(partition_number)`
1. Add one partition, `ci_pending_builds_1`
1. Migrate over to using this table
Once we have migrated to this table, it provides an extension point: We can add a new partition and expire partitions. This allows us to quickly recover from "autovacuum tuning mishaps", bloat accumulated (https://gitlab.com/gitlab-org/gitlab/-/issues/343623#note_714765556) and with https://gitlab.com/gitlab-org/gitlab/-/issues/343084, we may be able to lower autovacuum frequency further. Until we have https://gitlab.com/gitlab-org/gitlab/-/issues/343084, adding partitions can also be a manual operation (a migration).
epic