select '订单主数据' as tbchname, 'aufk' as tbname, count(1)  as sl from  aufk union all
select '销售凭证：项目数据' as tbchname, 'Vbap' as tbname, count(2)  as sl from Vbap union all
select '销售合同流程' as tbchname, 'SalesContractProcess' as tbname, count(3)  as sl from SalesContractProcess union all
select '订单项' as tbchname, 'Afpo' as tbname, count(4)  as sl from Afpo union all
select '订单表头数据 PP 订单' as tbchname, 'Afko' as tbname, count(5)  as sl from Afko union all
select '常规物料数据' as tbchname, 'Mara' as tbname, count(6)  as sl from Mara union all
select '物料描述' as tbchname, 'Makt' as tbname, count(7)  as sl from Makt union all
select '承诺交期日' as tbchname, 'Zsd06' as tbname, count(8)  as sl from Zsd06 union all
select '销售凭证：抬头数据' as tbchname, 'Vbak' as tbname, count(9)  as sl from Vbak union all
select 'SD凭证：交货：项目数据' as tbchname, 'Lips' as tbname, count(10)  as sl from Lips union all
select 'SD凭证：交货抬头数据' as tbchname, 'Likp' as tbname, count(11)  as sl from Likp union all
select '交货单主表' as tbchname, 'Handover' as tbname, count(12)  as sl from Handover union all
select '送货单(派车单）' as tbchname, 'HandoverTask' as tbname, count(13)  as sl from HandoverTask union all
select '节点信息最新表' as tbchname, 'TransformNewNode' as tbname, count(14)  as sl from TransformNewNode union all
select '销售订单库存' as tbchname, 'Mska' as tbname, count(15)  as sl from Mska union all
select '交货单发货指令信息表' as tbchname, 'Zsdfhzl' as tbname, count(16)  as sl from Zsdfhzl union all
select '销售凭证:计划行数据' as tbchname, 'vbep' as tbname, count(17)  as sl from vbep union all
select '销售凭证：抬头状态和管理数据' as tbchname, 'vbuk' as tbname, count(18)  as sl from vbuk union all
select '客户主文件的一般数据' as tbchname, 'kna1' as tbname, count(19)  as sl from kna1 union all
select '针对订单的货物移动' as tbchname, 'aufm' as tbname, count(20)  as sl from aufm union all
select 'SAP订单返回信息表' as tbchname, 'SysSAPreturnNo' as tbname, count(21)  as sl from SysSAPreturnNo union all
select '发票抬头' as tbchname, 'vbrk' as tbname, count(22)  as sl from vbrk union all
select '发票行项目' as tbchname, 'vbrp' as tbname, count(23)  as sl from vbrp union all
select '物料组描述' as tbchname, 't023t' as tbname, count(24)  as sl from t023t union all
select '条件（事务数据）' as tbchname, 'Konv' as tbname, count(25)  as sl from Konv union all
select '销售订单生产地对照表' as tbchname, 'Zmdpc' as tbname, count(26)  as sl from Zmdpc union all
select '销售凭证合作伙伴' as tbchname, 'vbpa' as tbname, count(27)  as sl from vbpa union all
select 'HR 主记录: 信息类型 0002 (人员数据)' as tbchname, 'pa0002' as tbname, count(28)  as sl from pa0002 union all
select 'Vbap宽表' as tbchname, 'VbapAdv' as tbname, count(29)  as sl from VbapAdv union all
select '销售合同流程MX' as tbchname, 'SalesContractProcessMX' as tbname, count(30)  as sl from SalesContractProcessMX union all
select '工厂/分支机构' as tbchname, 't001w' as tbname, count(31)  as sl from t001w union all
select '销售预测流程' as tbchname, 'SalesForecastProcess' as tbname, count(32)  as sl from SalesForecastProcess union all
select '销售预测流程MX' as tbchname, 'SalesForecastProcessMX' as tbname, count(33)  as sl from SalesForecastProcessMX union all
select '客户表' as tbchname, 'TKeHu' as tbname, count(34)  as sl from TKeHu union all
select '客户销售' as tbchname, 'TKeHuXiaoShouZZ' as tbname, count(35)  as sl from TKeHuXiaoShouZZ union all
select '客户销售业务员' as tbchname, 'TKeHuXiaoShouZZYeWuY' as tbname, count(36)  as sl from TKeHuXiaoShouZZYeWuY union all
select '客户主记录销售数据' as tbchname, 'knvv' as tbname, count(37)  as sl from knvv union all
select '客户主数据信贷管理控制范围数据' as tbchname, 'knkk' as tbname, count(38)  as sl from knkk union all
select '未清订单信贷管理' as tbchname, 's066' as tbname, count(39)  as sl from s066 union all
select '未清交货/发票凭证(KM)' as tbchname, 's067' as tbname, count(40)  as sl from s067 union all
select '会计核算：客户的第二次索引' as tbchname, 'bsid' as tbname, count(41)  as sl from bsid union all
select '会计核算：客户的第二个索引（已结算项目）' as tbchname, 'bsad' as tbname, count(42)  as sl from bsad union all
select '会计核算合并表' as tbchname, 'bsid2bsad' as tbname, count(43)  as sl from bsid2bsad union all
--select '本月回款（视图）' as tbchname, 'V_PayThisMonth' as tbname, count(44)  as sl from V_PayThisMonth union all
--select '本月销售（视图）' as tbchname, 'V_SalesThisMonth' as tbname, count(45)  as sl from V_SalesThisMonth union all
select '客户物料对照表' as tbchname, 'TWuLiaoDB' as tbname, count(46)  as sl from TWuLiaoDB union all
select '人员对照' as tbchname, 'PersonComp' as tbname, count(47)  as sl from PersonComp union all
select '节点信息记录' as tbchname, 'TransformHistoryNode' as tbname, count(48)  as sl from TransformHistoryNode union all
--select '净收额（视图）' as tbchname, 'V_ThisMonth' as tbname, count(49)  as sl from V_ThisMonth union all
select '净收额计算表' as tbchname, 'cavthismonth' as tbname, count(50)  as sl from cavthismonth union all
select '机构单位销售办公室文本' as tbchname, 'tvkbt' as tbname, count(51)  as sl from tvkbt;



truncate aufk			;
truncate Vbap			;
truncate SalesContractProcess	;
truncate Afpo			;
truncate Afko			;
truncate Mara			;
truncate Makt			;
truncate Zsd06			;
truncate Vbak			;
truncate Lips			;
truncate Likp			;
truncate Handover		;
truncate HandoverTask		;
truncate TransformNewNode	;
truncate Mska			;
truncate Zsdfhzl		;
truncate vbep			;
truncate vbuk			;
truncate kna1			;
truncate aufm			;
truncate SysSAPreturnNo		;
truncate vbrk			;
truncate vbrp			;
truncate t023t			;
truncate Konv			;
truncate Zmdpc			;
truncate vbpa			;
truncate pa0002			;
truncate VbapAdv		;
truncate SalesContractProcessMX	;
truncate t001w			;
truncate SalesForecastProcess	;
truncate SalesForecastProcessMX	;


--当前活跃的查询
select pid,sess_id,client_addr,state,backend_start,xact_start,query_start,state_change from pg_stat_activity where state = 'active' and client_addr is not null;
select pg_cancel_backend(pid);
select pg_cancel_backend(880);

--授权ip段访问
vim /data/master/gpseg-1/pg_hba.conf
host all all 192.168.100.1/24 md5
--重载配置文件
gpstop -u
--启动
gpstart

--分区数据分布情况
select gp_segment_id,tableoid::regclass,count(*) from jcbkdata group by 1,2 order by 1,2;

