clickhouse_central_update_20250120.sql 12 KB

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