工参治理业务量.sql 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --drop FOREIGN TABLE sqmdb_bak.sdrflow_daily_e
  2. CREATE FOREIGN TABLE sqmdb_bak.sdrflow_daily_e (
  3. starttime numeric NULL,
  4. ran_ne_id varchar NULL,
  5. cgisai varchar NULL,
  6. rat numeric NULL,
  7. l4_ul_throughput numeric NULL,
  8. l4_dl_throughput numeric NULL,
  9. layer2id numeric NULL,
  10. layer3id numeric NULL,
  11. od varchar NULL
  12. )
  13. SERVER pg_file_server
  14. OPTIONS (filename '/data/jyc/SDR_FLOW_CELL/sdrforput.txt', format 'text', header 'false', delimiter '|', null '');
  15. CREATE TABLE sqmdb_bak.sdrflow_daily (
  16. starttime numeric NULL,
  17. ran_ne_id varchar NULL,
  18. cgisai varchar NULL,
  19. rat numeric NULL,
  20. l4_ul_throughput numeric NULL,
  21. l4_dl_throughput numeric NULL,
  22. layer2id numeric NULL,
  23. layer3id numeric NULL,
  24. od varchar NULL,
  25. sdate timestamp NULL
  26. )
  27. select sum(l4_dl_throughput +l4_ul_throughput)/1024/1024/1024/1024 as flow_tb from sqmdb_bak.sdrflow_check where rat=9 and sdate between '2022-04-14' and '2022-04-20';
  28. select date_trunc('day',sdate) as sdate,sum(l4_dl_throughput +l4_ul_throughput)/1024/1024/1024/1024 as flow_tb from sqmdb_bak.sdrflow_check where rat=9 group by date_trunc('day',sdate);
  29. select sdate,rat,sum(l4_dl_throughput +l4_ul_throughput)/1024/1024/1024/1024 as flow_tb from sqmdb_bak.sdrflow_check group by sdate,rat;
  30. select date_trunc('day',sdate) as sdate,sum(l4_dl_throughput +l4_ul_throughput)/1024/1024/1024/1024 as flow_tb from sqmdb_bak.sdrflow where rat=9 and sdate between '2022-05-05' and '2022-05-05' group by date_trunc('day',sdate);
  31. select sum(THROUGHPUT)/1024/1024/1024/1024 as flow_tb
  32. from
  33. (select distinct city_name, cell_id, gnbid, THROUGHPUT
  34. from rpt_1_5g_flow_cell_7d_day
  35. where sdate = (select max(sdate) from rpt_1_5g_flow_cell_7d_day)) a
  36. select
  37. sum(ul_throughput_m+dl_throughput_m)/1024/1024/1024/1024 as flow_tb
  38. from o2p.sdr_1_5g_flow_base_day sgfbd
  39. where sdate between '2022-04-14' and '2022-04-20'
  40. --truncate table sqmdb_bak.sdrflow_check
  41. select sum(l4_dl_throughput +l4_ul_throughput)/1024/1024/1024/1024 as flow_tb
  42. from sqmdb_bak.sdrflow where sdate between '2022-04-14' and '2022-04-20' and rat=9;
  43. select to_char(date_trunc('day',sdate),'yyyymmdd'),cast(cast(('x'||substring(cgisai,6,5)) as bit(20)) as int) as enbid,cast(cast(('x'||substring(cgisai,11,2)) as bit(8)) as int) as cellid,rat,layer2id,'' as region_name,layer3id,'' as county_name,sum(l4_dl_throughput) as l4_dl_throughput,sum(l4_ul_throughput) as l4_ul_throughput,sum(l4_ul_throughput+l4_dl_throughput) as throughput from sqmdb_bak.sdrflow_daily where rat=6 and length(cgisai)=12 and sdate>=date_trunc('day',now())::timestamp + '-2 day' and sdate<date_trunc('day',now())::timestamp + '-1 day' group by date_trunc('day',sdate),cgisai,layer2id,layer3id,rat
  44. select enbid,
  45. cell_id,
  46. max(city_name) city_name,
  47. sum(throughput) throughput
  48. from sdr_0_4g_flow_cell_day k
  49. left join (select distinct city_code,city_name from cfg_0_city_conf where city_code is not null) t
  50. on (k.layer2id = t.city_code)
  51. where k.sdate between '20220718' and '20220718' and k.enbid>0 and city_name is not null
  52. group by enbid, cell_id