3.3存算一体 大表加字段内存占满,实时任务报错,查询报错

为了更快的定位您的问题,请提供以下信息,谢谢
【详述】给一张大表,聚合表,5T左右,2.8w个tablet左右,增加一个维度,非常慢,完成的task任务数几个几个增长

ALTER TABLE xxx ADD COLUMN xxx tinyint AFTER xxx;

并且这时候实时入数据程序报错too many 版本,所有报表查询很慢甚至报错,内存直接打满,后期降低schema memory之后影响降低,但是还有

【业务影响】影响实时入数据,任务查询 全都不间断报错
【是否存算分离】存算一体
【StarRocks版本 3.3.14-2ce6e68
【集群规模】例如:3fe(1 follower+2observer)+16be

看源码发现关于fast schema有一个判断,如果是key列那么不走fast schema,那么聚合表的维度列不会走fast schema? 想问下这个理解对吗

这个表是主键模型表吗?

老师 不是主键模型,是聚合模型表

这种有什么好的方向优化吗

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”
);

你的目标是啥,在写入不报错的情况下,SchemaChange成功吗?

如果聚合表加key不能走fast schema,确实是这么慢的话。

目标目前是 希望占用内存不那么多,能慢慢加 实时任务不报错,先满足业务需求,后期我们可以尝试进行业务上的优化。

现在SchemaChange成功了吗?

这个Key列,实在太多了。。

没有老师,因为实时任务报错too many version,导致实时任务入不进去,为了不影响业务先暂停schema change了

如果key列太多的话 是会导致这种加字段慢是把,指标列多一些是没啥问题的?

发个当时SchemaChange时候,1个小时的BE日志,看看,猜测是Key列太多导致。

感谢老师

因为同一个集群改其他表挺快,就这张最大的表不能动,目前也确定了fast schema没有生效,所以我们还是直接拆分表吧,从根源解决问题:-)

1赞