1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2025-07-03 00:58:12 +02:00
Files
explain.depesz.com/sql/patch-005.sql
Hubert depesz Lubaczewski 5fc15d5ed8 Move to partitioned plans
We don't have that many of them, but on slow(ish) server dumps or vacuums
take long time. Partitioning will make it possible to handle work in
smaller increments
2016-04-05 14:57:53 +02:00

63 lines
6.9 KiB
SQL

with x as (delete from only public.plans where id ~ '^0' returning *) insert into plans."part_0" select * from x;
with x as (delete from only public.plans where id ~ '^1' returning *) insert into plans."part_1" select * from x;
with x as (delete from only public.plans where id ~ '^2' returning *) insert into plans."part_2" select * from x;
with x as (delete from only public.plans where id ~ '^3' returning *) insert into plans."part_3" select * from x;
with x as (delete from only public.plans where id ~ '^4' returning *) insert into plans."part_4" select * from x;
with x as (delete from only public.plans where id ~ '^5' returning *) insert into plans."part_5" select * from x;
with x as (delete from only public.plans where id ~ '^6' returning *) insert into plans."part_6" select * from x;
with x as (delete from only public.plans where id ~ '^7' returning *) insert into plans."part_7" select * from x;
with x as (delete from only public.plans where id ~ '^8' returning *) insert into plans."part_8" select * from x;
with x as (delete from only public.plans where id ~ '^9' returning *) insert into plans."part_9" select * from x;
with x as (delete from only public.plans where id ~ '^A' returning *) insert into plans."part_A" select * from x;
with x as (delete from only public.plans where id ~ '^B' returning *) insert into plans."part_B" select * from x;
with x as (delete from only public.plans where id ~ '^C' returning *) insert into plans."part_C" select * from x;
with x as (delete from only public.plans where id ~ '^D' returning *) insert into plans."part_D" select * from x;
with x as (delete from only public.plans where id ~ '^E' returning *) insert into plans."part_E" select * from x;
with x as (delete from only public.plans where id ~ '^F' returning *) insert into plans."part_F" select * from x;
with x as (delete from only public.plans where id ~ '^G' returning *) insert into plans."part_G" select * from x;
with x as (delete from only public.plans where id ~ '^H' returning *) insert into plans."part_H" select * from x;
with x as (delete from only public.plans where id ~ '^I' returning *) insert into plans."part_I" select * from x;
with x as (delete from only public.plans where id ~ '^J' returning *) insert into plans."part_J" select * from x;
with x as (delete from only public.plans where id ~ '^K' returning *) insert into plans."part_K" select * from x;
with x as (delete from only public.plans where id ~ '^L' returning *) insert into plans."part_L" select * from x;
with x as (delete from only public.plans where id ~ '^M' returning *) insert into plans."part_M" select * from x;
with x as (delete from only public.plans where id ~ '^N' returning *) insert into plans."part_N" select * from x;
with x as (delete from only public.plans where id ~ '^O' returning *) insert into plans."part_O" select * from x;
with x as (delete from only public.plans where id ~ '^P' returning *) insert into plans."part_P" select * from x;
with x as (delete from only public.plans where id ~ '^Q' returning *) insert into plans."part_Q" select * from x;
with x as (delete from only public.plans where id ~ '^R' returning *) insert into plans."part_R" select * from x;
with x as (delete from only public.plans where id ~ '^S' returning *) insert into plans."part_S" select * from x;
with x as (delete from only public.plans where id ~ '^T' returning *) insert into plans."part_T" select * from x;
with x as (delete from only public.plans where id ~ '^U' returning *) insert into plans."part_U" select * from x;
with x as (delete from only public.plans where id ~ '^V' returning *) insert into plans."part_V" select * from x;
with x as (delete from only public.plans where id ~ '^W' returning *) insert into plans."part_W" select * from x;
with x as (delete from only public.plans where id ~ '^X' returning *) insert into plans."part_X" select * from x;
with x as (delete from only public.plans where id ~ '^Y' returning *) insert into plans."part_Y" select * from x;
with x as (delete from only public.plans where id ~ '^Z' returning *) insert into plans."part_Z" select * from x;
with x as (delete from only public.plans where id ~ '^a' returning *) insert into plans."part_a" select * from x;
with x as (delete from only public.plans where id ~ '^b' returning *) insert into plans."part_b" select * from x;
with x as (delete from only public.plans where id ~ '^c' returning *) insert into plans."part_c" select * from x;
with x as (delete from only public.plans where id ~ '^d' returning *) insert into plans."part_d" select * from x;
with x as (delete from only public.plans where id ~ '^e' returning *) insert into plans."part_e" select * from x;
with x as (delete from only public.plans where id ~ '^f' returning *) insert into plans."part_f" select * from x;
with x as (delete from only public.plans where id ~ '^g' returning *) insert into plans."part_g" select * from x;
with x as (delete from only public.plans where id ~ '^h' returning *) insert into plans."part_h" select * from x;
with x as (delete from only public.plans where id ~ '^i' returning *) insert into plans."part_i" select * from x;
with x as (delete from only public.plans where id ~ '^j' returning *) insert into plans."part_j" select * from x;
with x as (delete from only public.plans where id ~ '^k' returning *) insert into plans."part_k" select * from x;
with x as (delete from only public.plans where id ~ '^l' returning *) insert into plans."part_l" select * from x;
with x as (delete from only public.plans where id ~ '^m' returning *) insert into plans."part_m" select * from x;
with x as (delete from only public.plans where id ~ '^n' returning *) insert into plans."part_n" select * from x;
with x as (delete from only public.plans where id ~ '^o' returning *) insert into plans."part_o" select * from x;
with x as (delete from only public.plans where id ~ '^p' returning *) insert into plans."part_p" select * from x;
with x as (delete from only public.plans where id ~ '^q' returning *) insert into plans."part_q" select * from x;
with x as (delete from only public.plans where id ~ '^r' returning *) insert into plans."part_r" select * from x;
with x as (delete from only public.plans where id ~ '^s' returning *) insert into plans."part_s" select * from x;
with x as (delete from only public.plans where id ~ '^t' returning *) insert into plans."part_t" select * from x;
with x as (delete from only public.plans where id ~ '^u' returning *) insert into plans."part_u" select * from x;
with x as (delete from only public.plans where id ~ '^v' returning *) insert into plans."part_v" select * from x;
with x as (delete from only public.plans where id ~ '^w' returning *) insert into plans."part_w" select * from x;
with x as (delete from only public.plans where id ~ '^x' returning *) insert into plans."part_x" select * from x;
with x as (delete from only public.plans where id ~ '^y' returning *) insert into plans."part_y" select * from x;
with x as (delete from only public.plans where id ~ '^z' returning *) insert into plans."part_z" select * from x;