starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

资源隔离限制big_query_scan_rows_limit 参数无法限制住SQL

Open sgtt opened this issue 1 year ago • 17 comments

我设置资源隔离big_query_scan_rows_limit=30000000 ,无法限制实际扫描行数为三千多万的SQL,只有在设置big_query_scan_rows_limit-10000000时候才限制住了实际扫描行数为3000多万的SQL,这个相差非常大。

企业微信截图_16992576274364 企业微信截图_16992576796175 企业微信截图_16992581892252

sgtt avatar Nov 06 '23 08:11 sgtt

实际扫描行数为三千多万

是指一个表扫描的行数,还是该查询所有表的扫描的行数?

Does the actual scan rows refer to the number of rows scanning on one table or that scanning on all the tables of this query?

ZiheLiu avatar Nov 06 '23 08:11 ZiheLiu

该集群有几个 BE?

How many BEs does this cluster contain?

ZiheLiu avatar Nov 06 '23 08:11 ZiheLiu

集群有三个fe, 三个be 。 我所说的扫描行数为fe里面fe.audit.log 日志里面ScanRows 的数值

sgtt avatar Nov 06 '23 08:11 sgtt

big_query_scan_rows_limit 指的是每个 BE 可以扫描的行数,而非整个集群所有 BE 总共扫描的行数。 所以,如果数据在每个 BE 上均匀的话,建议把 big_query_scan_rows_limit 设为 ScanRows/numBEs

ZiheLiu avatar Nov 06 '23 08:11 ZiheLiu

我be 三节点,三副本。 按照ScanRows/numBEs 来算的话,也就是big_query_scan_rows_limit 为ScanRows 三分之一能限制住,但是我刚刚做了一个实验:'big_query_scan_rows_limit' = '100000' 时, select * from app_smartbi_trade_bus_ware_sale_d limit 100001这样查却报限制了。 企业微信截图_16992607074049

Uploading 企业微信截图_16992607074049.png…

sgtt avatar Nov 06 '23 08:11 sgtt

咱们有交流群嘛,qq或者微信啥的

sgtt avatar Nov 06 '23 08:11 sgtt

使用的 StarRocks 的版本号是多少?可以通过 SQL select current_version() 查看。

ZiheLiu avatar Nov 06 '23 08:11 ZiheLiu

2.5.13 a3b58a0

sgtt avatar Nov 06 '23 09:11 sgtt

我be 三节点,三副本。 按照ScanRows/numBEs 来算的话,也就是big_query_scan_rows_limit 为ScanRows 三分之一能限制住,但是我刚刚做了一个实验:'big_query_scan_rows_limit' = '100000' 时, select * from app_smartbi_trade_bus_ware_sale_d limit 100001这样查却报限制了。

Could you offer the result of explain select * from app_smartbi_trade_bus_ware_sale_d limit 100001?

ZiheLiu avatar Nov 06 '23 09:11 ZiheLiu

explain select * from app_smartbi_trade_bus_ware_sale_d limit 100001

PLAN FRAGMENT 0 OUTPUT EXPRS:1: cdate | 2: group_id | 3: company_id | 4: count_sale | 5: order_status | 6: member_order_flag | 7: business_id | 8: order_id | 9: ware_id | 10: shop_assistant_id | 11: member_card_number | 12: chour | 13: cmonth | 14: cquarter | 15: cyear | 16: create_time | 17: final_time | 18: time_stamp | 19: sale_qty | 20: sale_amt | 21: mark_amt | 22: discounts_amt | 23: cost_amt | 24: profit | 25: sale_times | 26: member_sale_qty | 27: member_sale_amt | 28: member_mark_amt | 29: member_discounts_amt | 30: member_cost_amt | 31: member_profit | 32: member_sale_times PARTITION: UNPARTITIONED

RESULT SINK

1:EXCHANGE limit: 100001

PLAN FRAGMENT 1 OUTPUT EXPRS: PARTITION: RANDOM

STREAM DATA SINK EXCHANGE ID: 01 UNPARTITIONED

0:OlapScanNode TABLE: app_smartbi_trade_bus_ware_sale_d PREAGGREGATION: OFF. Reason: None aggregate function partitions=1017/1774 rollup: app_smartbi_trade_bus_ware_sale_d tabletRatio=3051/3051 tabletList=1792086,1792090,1792094,1791654,1791658,1791662,1791642,1791646,1791650,1791678 ... cardinality=100001 avgRowSize=104.08745 numNodes=0 limit: 100001

sgtt avatar Nov 06 '23 09:11 sgtt

Could you offer a profile of select * from app_smartbi_trade_bus_ware_sale_d limit 100001? You should increase big_query_scan_rows_limit to make the query successful.

ZiheLiu avatar Nov 06 '23 09:11 ZiheLiu

咱们有交流群嘛,qq或者微信啥的

可以搜索关注微信公众号StarRocks,点击“联系我们”,添加小助手微信后,会有人拉你进群。

ZiheLiu avatar Nov 06 '23 09:11 ZiheLiu

big_query_scan_rows_limit' = '100000' 时, select * from app_smartbi_trade_bus_ware_sale_d limit 100000 可以查出数据 select * from app_smartbi_trade_bus_ware_sale_d limit 100001 查询报限制

企业微信截图_16992634869734 企业微信截图_16992607074049

sgtt avatar Nov 06 '23 09:11 sgtt

这个报错是预期之内的行为。原因是,虽然 limit 100_001,但是每个 BE 都会分别扫描 100_001 行(超过了 100_000 行),所以会报错。

ZiheLiu avatar Nov 06 '23 09:11 ZiheLiu

感谢回复,今天我测试了下‘’big_query_scan_rows_limit' = '13000000' , select count(*) from app_smartbi_trade_bus_ware_sale_d (表的数据量为37198775) 但是我多次查询时有时候可以限制,有时候直接查询出结果了。 企业微信截图_16993203431062 企业微信截图_16993203277158

sgtt avatar Nov 07 '23 01:11 sgtt

感谢回复,今天我测试了下‘’big_query_scan_rows_limit' = '13000000' , select count(*) from app_smartbi_trade_bus_ware_sale_d (表的数据量为37198775) 但是我多次查询时有时候可以限制,有时候直接查询出结果了。

根源在于 big_query_scan_rows_limit 限制的只是一个查询在单台 BE 上扫描的数据量,只是作为一个兜底的策略。 多次查询之间,一个表分配到每个 BE 上扫描的 tablet 数量可能是不同的。由于 big_query_scan_rows_limit*3=39000000,有的时候可能恰好三个 BE 都没有超过该限制。

ZiheLiu avatar Nov 07 '23 01:11 ZiheLiu

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!

github-actions[bot] avatar May 06 '24 11:05 github-actions[bot]