clickhouse_central_update_20241101.sql 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. create table tb_promotion_advertiser_report
  2. (
  3. app_code String default '' comment '应用编码',
  4. company String default '' comment '广告平台',
  5. advertiser_id String default '' comment '广告主id',
  6. time_granularity String default '' comment '时间维度DAILY或HOURLY',
  7. time_number Int64 default 0 comment '数据时间yyyyMMdd或yyyyMMddHH',
  8. add_timestamp Int64 default 0 comment '数据插入时间',
  9. cost Float64 default 0 comment '消耗(元)',
  10. show Int32 default 0 comment '展现(次)',
  11. click Int32 default 0 comment '点击(次)',
  12. convert Int32 default 0 comment '转化(个)',
  13. convert_cost Float64 default 0 comment '每个转化所付出的平均成本(元)',
  14. avg_show_cost Float64 default 0 comment '平均千次展现费用(元)',
  15. avg_click_cost Float64 default 0 comment '平均点击单价',
  16. dau Int32 default 0 comment '日活跃用户数',
  17. reg Int32 default 0 comment '新增用户数',
  18. st_activate Int32 default 0 comment '标准_激活数',
  19. st_first_pay_count Int32 default 0 comment '标准_首次付费数',
  20. st_first_pay_amount Float64 default 0 comment '标准_首次付费金额',
  21. st_first_day_pay_count Int32 default 0 comment '标准_首日付费次数',
  22. st_first_day_pay_user Int32 default 0 comment '标准_首日付费人数',
  23. st_first_day_pay_amount Float64 default 0 comment '标准_首日付费金额',
  24. st_total_pay_count Int32 default 0 comment '标准_首日付费金额',
  25. st_total_pay_user Int32 default 0 comment '标准_总付费人数',
  26. st_total_pay_amount Float64 default 0 comment '标准_总付费金额',
  27. transfer_count Int32 default 0 comment '提现次数',
  28. transfer_user Int32 default 0 comment '提现人数',
  29. transfer_total_amount Float64 default 0 comment '提现总金额',
  30. rewarded_video_ad_count Int32 default 0 comment '激励视频_广告总数',
  31. rewarded_video_ad_income Float64 default 0 comment '激励视频_广告收入',
  32. rewarded_video_ad_monetize_user Int32 default 0 comment '激励视频_广告变现人数',
  33. rewarded_video_ad_ecpm Float64 default 0 comment '激励视频_广告ECPM',
  34. banner_ad_count Int32 default 0 comment '横幅_广告总数',
  35. banner_ad_income Float64 default 0 comment '横幅_广告收入',
  36. banner_ad_monetize_user Int32 default 0 comment '横幅_广告变现人数',
  37. banner_ad_ecpm Float64 default 0 comment '横幅_广告ECPM',
  38. feeds_ad_count Int32 default 0 comment '信息流_广告总数',
  39. feeds_ad_income Float64 default 0 comment '信息流_广告收入',
  40. feeds_ad_monetize_user Int32 default 0 comment '信息流_广告变现人数',
  41. feeds_ad_ecpm Float64 default 0 comment '信息流_广告ECPM',
  42. interstitial_ad_count Int32 default 0 comment '插屏_广告总数',
  43. interstitial_ad_income Float64 default 0 comment '插屏_广告收入',
  44. interstitial_ad_monetize_user Int32 default 0 comment '插屏_广告变现人数',
  45. interstitial_ad_ecpm Float64 default 0 comment '插屏_广告ECPM',
  46. splash_ad_count Int32 default 0 comment '开屏_广告总数',
  47. splash_ad_income Float64 default 0 comment '开屏_广告收入',
  48. splash_ad_monetize_user Int32 default 0 comment '开屏_广告变现人数',
  49. splash_ad_ecpm Float64 default 0 comment '开屏_广告ECPM',
  50. first_day_ad_income Float64 default 0 comment '首日广告收入',
  51. total_ad_income Float64 default 0 comment '总广告收入'
  52. )
  53. engine = ReplacingMergeTree PARTITION BY time_number
  54. ORDER BY (app_code, company, advertiser_id, time_granularity, time_number)
  55. SETTINGS index_granularity = 8192;
  56. create table tb_promotion_advertiser_report_rolling
  57. (
  58. app_code String default '' comment '应用编码',
  59. company String default '' comment '广告平台',
  60. advertiser_id String default '' comment '广告主id',
  61. time_granularity String default '' comment '时间维度DAILY或HOURLY',
  62. time_number Int64 default 0 comment '数据时间yyyyMMdd或yyyyMMddHH',
  63. add_timestamp Int64 default 0 comment '数据插入时间',
  64. cost Float64 default 0 comment '消耗(元)',
  65. show Int32 default 0 comment '展现(次)',
  66. click Int32 default 0 comment '点击(次)',
  67. convert Int32 default 0 comment '转化(个)',
  68. convert_cost Float64 default 0 comment '每个转化所付出的平均成本(元)',
  69. avg_show_cost Float64 default 0 comment '平均千次展现费用(元)',
  70. avg_click_cost Float64 default 0 comment '平均点击单价',
  71. dau Int32 default 0 comment '日活跃用户数',
  72. reg Int32 default 0 comment '新增用户数',
  73. st_activate Int32 default 0 comment '标准_激活数',
  74. st_first_pay_count Int32 default 0 comment '标准_首次付费数',
  75. st_first_pay_amount Float64 default 0 comment '标准_首次付费金额',
  76. st_first_day_pay_count Int32 default 0 comment '标准_首日付费次数',
  77. st_first_day_pay_user Int32 default 0 comment '标准_首日付费人数',
  78. st_first_day_pay_amount Float64 default 0 comment '标准_首日付费金额',
  79. st_total_pay_count Int32 default 0 comment '标准_首日付费金额',
  80. st_total_pay_user Int32 default 0 comment '标准_总付费人数',
  81. st_total_pay_amount Float64 default 0 comment '标准_总付费金额',
  82. transfer_count Int32 default 0 comment '提现次数',
  83. transfer_user Int32 default 0 comment '提现人数',
  84. transfer_total_amount Float64 default 0 comment '提现总金额',
  85. rewarded_video_ad_count Int32 default 0 comment '激励视频_广告总数',
  86. rewarded_video_ad_income Float64 default 0 comment '激励视频_广告收入',
  87. rewarded_video_ad_monetize_user Int32 default 0 comment '激励视频_广告变现人数',
  88. rewarded_video_ad_ecpm Float64 default 0 comment '激励视频_广告ECPM',
  89. banner_ad_count Int32 default 0 comment '横幅_广告总数',
  90. banner_ad_income Float64 default 0 comment '横幅_广告收入',
  91. banner_ad_monetize_user Int32 default 0 comment '横幅_广告变现人数',
  92. banner_ad_ecpm Float64 default 0 comment '横幅_广告ECPM',
  93. feeds_ad_count Int32 default 0 comment '信息流_广告总数',
  94. feeds_ad_income Float64 default 0 comment '信息流_广告收入',
  95. feeds_ad_monetize_user Int32 default 0 comment '信息流_广告变现人数',
  96. feeds_ad_ecpm Float64 default 0 comment '信息流_广告ECPM',
  97. interstitial_ad_count Int32 default 0 comment '插屏_广告总数',
  98. interstitial_ad_income Float64 default 0 comment '插屏_广告收入',
  99. interstitial_ad_monetize_user Int32 default 0 comment '插屏_广告变现人数',
  100. interstitial_ad_ecpm Float64 default 0 comment '插屏_广告ECPM',
  101. splash_ad_count Int32 default 0 comment '开屏_广告总数',
  102. splash_ad_income Float64 default 0 comment '开屏_广告收入',
  103. splash_ad_monetize_user Int32 default 0 comment '开屏_广告变现人数',
  104. splash_ad_ecpm Float64 default 0 comment '开屏_广告ECPM',
  105. first_day_ad_income Float64 default 0 comment '首日广告收入',
  106. total_ad_income Float64 default 0 comment '总广告收入'
  107. )
  108. engine = ReplacingMergeTree PARTITION BY time_number
  109. ORDER BY (app_code, company, advertiser_id, time_granularity, time_number)
  110. TTL toDateTime(add_timestamp / 1000) + toIntervalDay(3)
  111. SETTINGS index_granularity = 8192;