老师 不是主键模型,是聚合模型表
这种有什么好的方向优化吗
CREATE TABLE okspin_common_report
(
__d
date NOT NULL COMMENT “”,
__time
bigint(20) NOT NULL COMMENT “”,
pub_app_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
placement_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
ad_group_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
campaign_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
pub_source_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
publisher_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
bundle
varchar(2000) NOT NULL DEFAULT “” COMMENT “”,
ad_type
int(11) NOT NULL DEFAULT “0” COMMENT “”,
template_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
ptml_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
bm_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
network_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
n_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
n_bm_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
advertiser_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
app_id
varchar(300) NOT NULL DEFAULT “” COMMENT “”,
creative_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
material_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
endcard_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
country
varchar(3) NOT NULL DEFAULT “” COMMENT “”,
lang
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
osv
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
appv
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
sdkv
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
event
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
pmodel
int(11) NOT NULL DEFAULT “0” COMMENT “”,
bist
int(11) NOT NULL DEFAULT “0” COMMENT “”,
pcrid
int(11) NOT NULL DEFAULT “0” COMMENT “”,
pmid
int(11) NOT NULL DEFAULT “0” COMMENT “”,
old_user
int(11) NOT NULL DEFAULT “0” COMMENT “”,
a_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
a_bm_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
ag_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
ad_sence
int(11) NOT NULL DEFAULT “0” COMMENT “”,
src_type
int(11) NOT NULL DEFAULT “0” COMMENT “1:sdk, 2:js tag”,
ad_plat
int(11) NOT NULL DEFAULT “0” COMMENT “”,
adn_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
pub_app_type
int(11) NOT NULL DEFAULT “0” COMMENT “”,
source_app_id
varchar(200) NOT NULL DEFAULT “” COMMENT “”,
template_type
int(11) NOT NULL DEFAULT “0” COMMENT “”,
aaid
int(11) NOT NULL DEFAULT “0” COMMENT “advertiser app id”,
reward_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
csid
int(11) NOT NULL DEFAULT “0” COMMENT “”,
game_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
task_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
pub_region
varchar(3) NOT NULL DEFAULT “” COMMENT “”,
is_apk
int(11) NOT NULL DEFAULT “0” COMMENT “”,
billing_type
int(11) NOT NULL DEFAULT “0” COMMENT “”,
pub_task_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
abt
int(11) NOT NULL DEFAULT “0” COMMENT “”,
abtid
int(11) NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_source
int(11) NOT NULL DEFAULT “0” COMMENT “”,
alg_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
rankab
int(11) NOT NULL DEFAULT “0” COMMENT “”,
make
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
brand
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
model
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
region
varchar(50) NOT NULL DEFAULT “” COMMENT “”,
mmp
int(11) NOT NULL DEFAULT “0” COMMENT “”,
gstid
int(11) NOT NULL DEFAULT “0” COMMENT “”,
gspos
varchar(256) NOT NULL DEFAULT “” COMMENT “”,
event_value
varchar(128) NOT NULL DEFAULT “” COMMENT “”,
std_event
varchar(512) NOT NULL DEFAULT “” COMMENT “”,
is_invalid
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
rtb_pos
varchar(64) NOT NULL DEFAULT “” COMMENT “”,
is_wv
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
s_tag
int(11) NOT NULL DEFAULT “0” COMMENT “”,
n_origin
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
bidm
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
t_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
floor_bid
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
rank_group
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
endcard_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
ocpa_bid
int(11) NOT NULL DEFAULT “0” COMMENT “”,
rtb_auto_tml
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
ad_scene
int(11) NOT NULL DEFAULT “0” COMMENT “”,
tgt
tinyint(4) NULL COMMENT “”,
template_size
varchar(20) NULL COMMENT “”,
mexpd
tinyint(4) NULL COMMENT “”,
adx_id
int(11) NULL COMMENT “”,
pub_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
bundle_tag
int(11) NOT NULL DEFAULT “0” COMMENT “”,
app_tag
int(11) NOT NULL DEFAULT “0” COMMENT “”,
adm_tech
int(11) NOT NULL DEFAULT “-1” COMMENT “”,
adt_cid
bigint(20) NULL COMMENT “”,
rat
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
pwa
tinyint(4) NULL COMMENT “”,
e_did
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
audit_reason
varchar(30) NOT NULL DEFAULT “” COMMENT “”,
deal_id
varchar(256) NOT NULL DEFAULT “” COMMENT “”,
deal_type
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
adt_ml_group
int(11) NOT NULL DEFAULT “0” COMMENT “”,
adt_ml_group_index
int(11) NOT NULL DEFAULT “0” COMMENT “”,
is_reward
tinyint(4) NULL COMMENT “”,
publisher_source_type
tinyint(4) NOT NULL DEFAULT “0” COMMENT “”,
adx_am_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
adx_bm_id
int(11) NOT NULL DEFAULT “0” COMMENT “”,
init_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
lad_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
plc_impr_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
plc_click_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
tml_view_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
tml_play_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
impr_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
click_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
install_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
event_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
revenue
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
cost
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
no_billing_event_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
pub_event_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
ocpa_event_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_show
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
open_app
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
div_impr
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
div_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
effective_cpc_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
tml_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
cl_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_check_in
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_check_in_earn
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_bind_sns
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_bind_sns_earn
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_reward_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_reward_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_success
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_cost
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_success_oks
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_okspin_cost
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_pub_app_cost
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_hd_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_hd_play
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_hd_ad_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_hd_ad_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_task_impr
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_task_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_task_finish
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_daily_task_earn
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_pub_task_earn
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_invite_show
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_invite
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
ow_reward
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_la_reward
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
user_earn
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_play
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_redeem_gsp
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
game_list_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
game_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
game_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
game_play
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
game_over
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in1
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in2
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in3
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in4
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in5
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in6
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
check_in7
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_list_fill
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_list_no_fill
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_game_user_earn
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
data_loaded
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
gspace_dur
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_load
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
offer_load_success
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
adn_load
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
adn_load_success
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
payment_event_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_hd_expend
decimal(38, 2) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_contract_expend
decimal(38, 2) SUM NOT NULL DEFAULT “0” COMMENT “”,
uc_contract_earn
decimal(38, 2) SUM NOT NULL DEFAULT “0” COMMENT “”,
key_event_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
ec_view
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
ec_click
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
cpc_revenue
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
af_revenue
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
plc_view_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
filled_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
bid_price
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”,
nf_price_cnt
bigint(20) SUM NOT NULL DEFAULT “0” COMMENT “”,
no_bid_price
decimal(38, 6) SUM NOT NULL DEFAULT “0” COMMENT “”
) ENGINE=OLAP
AGGREGATE KEY(__d
, __time
, pub_app_id
, placement_id
, ad_group_id
, campaign_id
, pub_source_id
, publisher_id
, bundle
, ad_type
, template_id
, ptml_id
, bm_id
, am_id
, network_id
, n_am_id
, n_bm_id
, advertiser_id
, app_id
, creative_id
, material_id
, endcard_id
, country
, lang
, osv
, appv
, sdkv
, event
, pmodel
, bist
, pcrid
, pmid
, old_user
, a_am_id
, a_bm_id
, ag_am_id
, ad_sence
, src_type
, ad_plat
, adn_id
, pub_app_type
, source_app_id
, template_type
, aaid
, reward_id
, csid
, game_id
, task_id
, pub_region
, is_apk
, billing_type
, pub_task_id
, abt
, abtid
, uc_redeem_source
, alg_id
, rankab
, make
, brand
, model
, region
, mmp
, gstid
, gspos
, event_value
, std_event
, is_invalid
, rtb_pos
, is_wv
, s_tag
, n_origin
, bidm
, t_am_id
, floor_bid
, rank_group
, endcard_am_id
, ocpa_bid
, rtb_auto_tml
, ad_scene
, tgt
, template_size
, mexpd
, adx_id
, pub_am_id
, bundle_tag
, app_tag
, adm_tech
, adt_cid
, rat
, pwa
, e_did
, audit_reason
, deal_id
, deal_type
, adt_ml_group
, adt_ml_group_index
, is_reward
, publisher_source_type
, adx_am_id
, adx_bm_id
)
COMMENT “OLAP”
PARTITION BY date_trunc(‘day’, __d)
DISTRIBUTED BY HASH(__time
, publisher_id
, pub_app_id
)
PROPERTIES (
“compression” = “LZ4”,
“fast_schema_evolution” = “true”,
“partition_live_number” = “400”,
“replicated_storage” = “true”,
“replication_num” = “3”,
“storage_cooldown_ttl” = “2 YEAR”
);