@
kiddult 确实是批量插入,不过在 jdbc 端有这样的方式,至少可以在数据流中不用把数据落地就能快速的入库,另外一个关键点就在于不用拼 insert 语句,对方不管什么数据库,只要按照约定格式把数据给过来基本上不存在性能的瓶颈。我们现在实时数据接入、计算都采取的这种方式。这功能也不算新,再配上 spark+kafka 简直不要太好用
数据大小 34G
索引大小 11G
表一共 100 张,每张表上面一个索引,都是建在数字上的
数据样例:
表 A
表
CREATE TABLE A (
storegid integer,
gid integer,
code character varying(20),
name character varying(80),
spec character varying(40),
sort character varying(255),
munit character varying(255),
rtlprc numeric(24,4),
inprc numeric(24,4),
mbrprc numeric(24,4),
isdisp integer,
alword integer,
alwsord integer,
prctype integer,
promote integer,
lwtrtlprc numeric(24,4),
gft integer,
mcode character varying(20),
dep character varying(64),
shortname character varying(40),
catalog character varying(1),
alcprc numeric(24,4),
brand character varying(20),
description character varying(255),
alwout integer,
costtype integer,
extendedattributes character varying(255),
validperiod integer,
code2 character varying(32),
brandname character varying(64),
origin character varying(40),
vdrcode character varying(100),
sortname character varying(255),
impprc numeric(24,4),
bgnwarnday integer,
endwarnday integer,
busgatename character varying(255),
permilgoal numeric(24,4),
ordflag character varying(4),
isbind integer,
indeadvalidday integer,
outdeadvalidday integer,
validdayunit character varying(4),
dayalc integer,
orddatelst character varying(20),
acode character varying(20),
bcode character varying(20),
ccode character varying(20),
dcode character varying(20),
usevalidate integer,
storenature character varying(20),
invprc numeric(24,4),
isgft integer,
originalcreator character varying(20),
validperioddes character varying(100),
alwmodprc integer,
stdrtlprc numeric(24,4),
stdmbrprc numeric(24,4),
highrtlprc numeric(24,4),
alwxf integer,
alwmod integer,
specreturnmemo character varying(255),
alwinputckqty integer,
cntinprc numeric(24,4),
vdrname character varying(100),
validdaycalc integer,
unsaleproperty integer,
strcol1 character varying(80),
strcol2 character varying(80),
strcol3 character varying(80),
strcol4 character varying(80),
strcol5 character varying(80),
strcol6 character varying(80),
numcol1 numeric(20,4),
numcol2 numeric(20,4),
numcol3 numeric(20,4),
numcol4 numeric(20,4)
);
索引 btree (storegid, gid)
1000021 | 3000035 | 06020125 | 泰优美牛肚 30g | 30g | 0802 | 包 | 5.0000 | 0.0000 | 5.0000 | 0 | 1 | 1 | 0 | -1 | 0.0000 | 0 |
| - | | A | 4.0000 | 1076 | | 1 | 0 | | | 6923405100516 | 泰优美 | | 800
328 | 牛肉类 | 5.0000 | 0 | 0 | - | | 00 | 0 | 0 | 0 | | |
| 08 | 0802 | 0802 | 0802 | | 默认 | 0.0000 | | | | 0 | 5.0000 | 5.0000 | 9999.0
000 | 1 | 1 | | | 3.3000 | | | | | | | | |
| | | |
表 B
CREATE TABLE B
storegid integer,
gdgid integer,
highinv numeric(24,4),
lowinv numeric(24,4),
stdshow numeric(24,2),
alc character varying(10),
busgate integer,
busgatename character varying(255),
abctype character varying(20)
);
索引
btree (storegid, gdgid);
数据
1000025 | 3004329 | 9999.0000 | 0.0000 | 0.00 | 直送 | 7000020 | 正常 |
表 C
CREATE TABLE C (
storegid integer,
gid integer,
qpc numeric(24,4),
rtlprc numeric(24,4),
mbrprc numeric(24,4),
lwtrtlprc numeric(24,4),
impprc numeric(24,4)
);
索引:btree (storegid, gid, qpc)
数据: 1000036 | 3001832 | 1.0000 | 5.0000 | 4.5000 | 0.0000 | 5.0000
表 D
CREATE TABLE D (
storegid integer,
gid integer,
qpcstr character varying(20),
qpc numeric(24,4),
isdu integer,
ispu integer,
iswu integer,
isru integer
);
索引:btree (storegid, gid)
1000033 | 3053299 | 1*1 | 1.0000 | 2 | 2 | 2 | 2
表 E
表:CREATE TABLE E (
storegid integer,
code character varying(20),
codetype integer,
gid integer,
rtlprc numeric(24,4),
qpc numeric(24,4),
munit character varying(6),
mbrprc numeric(24,4),
lwtrtlprc numeric(24,4),
score integer,
catalog character varying(6),
impprc numeric(24,4)
);
索引:btree (storegid, gid)
数据: 1000033 | 6917246013081 | 0 | 3003501 | 23.9000 | 1.0000 | 支 | 23.9000 | 0.0000 | 0 | A | 23.9000
很期待那几位经验丰富的大神能给出好的方案。