1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
---
--- This file creates tables and populate the pgcopdyb.table_size cache with
-- fake sizes.
---
-- Create three tables with identical schema and data
create table table_1 (
c_bigserial bigserial primary key,
c_char char(580)
);
create table table_2 (
c_bigserial bigserial primary key,
c_char char(150)
);
create table table_3 (
c_bigserial bigserial primary key,
c_char char(512)
);
-- Insert 100 rows into table_1 and duplicate data in table_2, table_3 is empty.
insert into table_1 (c_char)
select
left (md5(random()::text),
10)
from
generate_series(1, 100) s (i);
insert into table_2
select
*
from
table_1;
--
-- also create tables with names that needs double-quoting to see that our
-- partitioning queries can cope with that
--
CREATE SCHEMA IF NOT EXISTS "Sp1eCial .Char";
CREATE TABLE "Sp1eCial .Char"."source1testing"
(
"s0" int PRIMARY KEY,
"s1" int NOT NULL
);
insert into "Sp1eCial .Char"."source1testing"("s0", "s1")
select x, (x * 2) % 100000
from generate_series(1, 10000) AS t(x);
CREATE TABLE "Sp1eCial .Char"."Tabl e.1testing"
(
"iD" int PRIMARY KEY,
"regId" int,
"status" int,
"nA M.e" character varying(20) NOT NULL,
CONSTRAINT "Tabl e_fk_1_testing"
FOREIGN KEY ("iD")
REFERENCES "Sp1eCial .Char"."source1testing"("s0")
);
insert into "Sp1eCial .Char"."Tabl e.1testing"("iD", "regId", "status", "nA M.e")
select
"s0",
"s0",
random() * 100,
'Name ' || "s0"
from
"Sp1eCial .Char"."source1testing";
-- Create two tables with identical schema and data to test ctid split
create table table_ctid_candidate (
c_char char(512),
d_char char(512)
);
create table table_ctid_candidate_skip (
c_char char(512),
d_char char(512)
);
-- Insert 100 rows into table_ctid_candidate
insert into table_ctid_candidate (c_char, d_char)
select
left (md5(random()::text), 10),
left (md5(random()::text), 10)
from
generate_series(1, 100) s (i);
insert into table_ctid_candidate_skip
select
*
from
table_ctid_candidate;
|