查询很简单的SQL命中不了物化视图?

问题:非常简单的SQL,物化视图都命中不了?是哪里有问题还是说starrocks对物化视图支持很弱?

建表SQL:CREATE TABLE ads_guanxing_day_org_pro_sptm_sal_ds (
tm_product_no varchar(65533) NULL COMMENT “天猫商品编码”,
tm_shop_no varchar(65533) NULL COMMENT “天猫店铺编码”,
category2_no varchar(65533) NULL COMMENT “二级分类编码”,
category3_no varchar(65533) NULL COMMENT “三级分类编码”,
category4_no varchar(65533) NULL COMMENT “四级分类编码”,
period_sdate varchar(65533) NULL COMMENT “销售时间”,
tm_shop_name varchar(65533) NULL COMMENT “天猫店铺名称”,
tm_brand_name varchar(65533) NULL COMMENT “天猫商品品牌”,
title varchar(65533) NULL COMMENT “标题”,
category2_name varchar(65533) NULL COMMENT “二级分类名称”,
category3_name varchar(65533) NULL COMMENT “三级分类名称”,
category4_name varchar(65533) NULL COMMENT “四级分类名称”,
estimated_amt decimal64(18, 4) NULL COMMENT “预估到手价”,
view_amt decimal64(18, 4) NULL COMMENT “页面价”,
sal_qty int(11) NULL COMMENT “日销量”,
sal_amt decimal64(18, 4) NULL COMMENT “日销额”,
collect_num int(11) NULL COMMENT “日收藏数据”,
spider_inv_qty int(11) NULL COMMENT “当日库存”,
etl_time varchar(65533) NULL COMMENT “etl时间”,
partition_day date NULL COMMENT “分区时间(YYYY-MM-DD)”
) ENGINE=OLAP DISTRIBUTED BY HASH
DUPLICATE KEY(tm_product_no, tm_shop_no, category2_no, category3_no, category4_no)
PARTITION BY RANGE(partition_day)
(
PARTITION p20231231 VALUES [(“2023-12-31”), (“2024-01-01”)),
PARTITION p20240101 VALUES [(“2024-01-01”), (“2024-01-02”)),
PARTITION p20240102 VALUES [(“2024-01-02”), (“2024-01-03”)),
PARTITION p20240103 VALUES [(“2024-01-03”), (“2024-01-04”)))
DISTRIBUTED BY HASH(partition_day) BUCKETS 3
PROPERTIES (
“replication_num” = “3”,
“dynamic_partition.enable” = “true”,
“dynamic_partition.time_unit” = “DAY”,
“dynamic_partition.time_zone” = “Asia/Shanghai”,
“dynamic_partition.start” = “-2147483648”,
“dynamic_partition.end” = “1”,
“dynamic_partition.prefix” = “p”,
“dynamic_partition.buckets” = “3”,
“dynamic_partition.history_partition_num” = “0”,
“in_memory” = “false”,
“storage_format” = “DEFAULT”,
“enable_persistent_index” = “false”,
“compression” = “LZ4”
);

物化视图:
CREATE MATERIALIZED VIEW ads_guanxing_day_org_pro_sptm_sal_ds_view_02
DISTRIBUTED BY HASH(tm_product_no)
REFRESH ASYNC START(‘2024-01-04 17:39:00’) EVERY (interval 1 day)
AS
select
tm_product_no ,
partition_day as period_sdate ,
sum(sal_qty) as current_sal_qty ,
sum(sal_amt) as current_sal_amt ,
sum(collect_num) as current_mockdata_num
from
ads_hy_guanxing.ads_guanxing_day_org_pro_sptm_sal_ds
group by
tm_product_no ,
partition_day ;

查看是否命中:
explain
select
tm_product_no ,
partition_day as period_sdate ,
sum(sal_qty) as current_sal_qty ,
sum(sal_amt) as current_sal_amt ,
sum(collect_num) as current_mockdata_num
from
ads_hy_guanxing.ads_guanxing_day_org_pro_sptm_sal_ds
group by
tm_product_no ,
partition_day ;

执行一下 trace rewrite 看下原因

这样吗?语法不对?还是版本不支持,版本是2.5.8

mysql> trace rewrite
-> select
-> tm_product_no ,
-> partition_day as period_sdate ,
-> sum(sal_qty) as current_sal_qty ,
-> sum(sal_amt) as current_sal_amt ,
-> sum(collect_num) as current_mockdata_num
-> from
-> ads_hy_guanxing.ads_guanxing_day_org_pro_sptm_sal_ds 
-> group by
-> tm_product_no ,
-> partition_day ;

ERROR 1064 (HY000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘rewrite’ at line 1
mysql>

可能是物化视图刷新失败了(比如oom),导致没有改写。可以确认下物化视图状态吗?

  • show materialized view
  • select * from information_schema.materialized_views

能正常查出来。

mysql> show materialized view;
+-----------+-------------+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+
| id        | name        | database_name   | text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | rows |
+-----------+-------------+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+
| 102381315 | order_mv_01 | ads_hy_guanxing | CREATE MATERIALIZED VIEW `order_mv_01`
DISTRIBUTED BY HASH(`tm_product_no`)
REFRESH ASYNC START("2024-01-04 17:38:00") EVERY(INTERVAL 1 DAY)
PROPERTIES (
"replication_num" = "3",
"storage_medium" = "HDD"
)
AS SELECT `ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day` AS `period_sdate`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_qty`) AS `current_sal_qty`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_amt`) AS `current_sal_amt`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`collect_num`) AS `current_mockdata_num`
FROM `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`
GROUP BY `ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day`; | 0    |
+-----------+-------------+-----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+
1 row in set (0.01 sec)
mysql> select * from information_schema.materialized_views;
+----------------------+-----------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| MATERIALIZED_VIEW_ID | TABLE_SCHEMA    | TABLE_NAME  | MATERIALIZED_VIEW_DEFINITION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | TABLE_ROWS |
+----------------------+-----------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| 102381315            | ads_hy_guanxing | order_mv_01 | CREATE MATERIALIZED VIEW `order_mv_01`
DISTRIBUTED BY HASH(`tm_product_no`)
REFRESH ASYNC START("2024-01-04 17:38:00") EVERY(INTERVAL 1 DAY)
PROPERTIES (
"replication_num" = "3",
"storage_medium" = "HDD"
)
AS SELECT `ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day` AS `period_sdate`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_qty`) AS `current_sal_qty`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_amt`) AS `current_sal_amt`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`collect_num`) AS `current_mockdata_num`
FROM `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`
GROUP BY `ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day`; | 0          |
+----------------------+-----------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
1 row in set (0.01 sec)

嗯, 物化视图里的数据都正常吗?

正常的,但是物化视图查不出来数据。是不是基表的数据量太大了啊?

mysql> select * from information_schema.materialized_views;
+----------------------+-----------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| MATERIALIZED_VIEW_ID | TABLE_SCHEMA    | TABLE_NAME  | MATERIALIZED_VIEW_DEFINITION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | TABLE_ROWS |
+----------------------+-----------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| 102381315            | ads_hy_guanxing | order_mv_01 | CREATE MATERIALIZED VIEW `order_mv_01`
DISTRIBUTED BY HASH(`tm_product_no`)
REFRESH ASYNC START("2024-01-04 17:38:00") EVERY(INTERVAL 1 DAY)
PROPERTIES (
"replication_num" = "3",
"storage_medium" = "HDD"
)
AS SELECT `ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day` AS `period_sdate`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_qty`) AS `current_sal_qty`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_amt`) AS `current_sal_amt`, sum(`ads_guanxing_day_org_pro_sptm_sal_ds`.`collect_num`) AS `current_mockdata_num`
FROM `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`
GROUP BY `ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day`; | 0          |
+----------------------+-----------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
1 row in set (0.01 sec)

mysql> select * from ads_hy_guanxing.order_mv_01;
Empty set (0.00 sec)

mysql> select count(1) from ads_hy_guanxing.ads_guanxing_day_org_pro_sptm_sal_ds;
+-----------+
| count(1)  |
+-----------+
| 825004518 |
+-----------+
1 row in set (0.16 sec)

可能是那个 SQL 聚合 Key 基数高,占用太多内存,导致执行失败了;
如果是这个问题的话,当前有两个解决方案:

  1. 对物化视图分区,CREATE MV partition by (partition_day) properties(‘partition_refresh_number’=‘1’) xxxx
  2. 升级 3.1 版本,通过 Spill 功能规避 OOM问题

加了分区还是不行呀

CREATE MATERIALIZED VIEW ads_guanxing_day_org_pro_sptm_sal_ds_view_02
PARTITION BY `period_sdate`
DISTRIBUTED BY HASH(tm_product_no)
REFRESH ASYNC START('2024-01-09 10:40:00') EVERY (interval 1 day)
AS
select
tm_product_no ,
partition_day as period_sdate ,
sum(sal_qty) as current_sal_qty ,
sum(sal_amt) as current_sal_amt ,
sum(collect_num) as current_mockdata_num
from
ads_hy_guanxing.ads_guanxing_day_org_pro_sptm_sal_ds
group by
tm_product_no ,
partition_day ;
mysql> explain
    -> select
    -> tm_product_no ,
    -> partition_day as period_sdate ,
    -> sum(sal_qty) as current_sal_qty ,
    -> sum(sal_amt) as current_sal_amt ,
    -> sum(collect_num) as current_mockdata_num
    -> from
    -> ads_hy_guanxing.ads_guanxing_day_org_pro_sptm_sal_ds
    -> group by
    -> tm_product_no ,
    -> partition_day ;
+---------------------------------------------------------------------------------------------------------------+
| Explain String                                                                                                |
+---------------------------------------------------------------------------------------------------------------+
| PLAN FRAGMENT 0                                                                                               |
|  OUTPUT EXPRS:1: tm_product_no | 20: partition_day | 21: sum | 22: sum | 23: sum                              |
|   PARTITION: UNPARTITIONED                                                                                    |
|                                                                                                               |
|   RESULT SINK                                                                                                 |
|                                                                                                               |
|   4:EXCHANGE                                                                                                  |
|                                                                                                               |
| PLAN FRAGMENT 1                                                                                               |
|  OUTPUT EXPRS:                                                                                                |
|   PARTITION: HASH_PARTITIONED: 1: tm_product_no, 20: partition_day                                            |
|                                                                                                               |
|   STREAM DATA SINK                                                                                            |
|     EXCHANGE ID: 04                                                                                           |
|     UNPARTITIONED                                                                                             |
|                                                                                                               |
|   3:AGGREGATE (merge finalize)                                                                                |
|   |  output: sum(21: sum), sum(22: sum), sum(23: sum)                                                         |
|   |  group by: 1: tm_product_no, 20: partition_day                                                            |
|   |                                                                                                           |
|   2:EXCHANGE                                                                                                  |
|                                                                                                               |
| PLAN FRAGMENT 2                                                                                               |
|  OUTPUT EXPRS:                                                                                                |
|   PARTITION: RANDOM                                                                                           |
|                                                                                                               |
|   STREAM DATA SINK                                                                                            |
|     EXCHANGE ID: 02                                                                                           |
|     HASH_PARTITIONED: 1: tm_product_no, 20: partition_day                                                     |
|                                                                                                               |
|   1:AGGREGATE (update serialize)                                                                              |
|   |  STREAMING                                                                                                |
|   |  output: sum(15: sal_qty), sum(16: sal_amt), sum(17: collect_num)                                         |
|   |  group by: 1: tm_product_no, 20: partition_day                                                            |
|   |                                                                                                           |
|   0:OlapScanNode                                                                                              |
|      TABLE: ads_guanxing_day_org_pro_sptm_sal_ds                                                              |
|      PREAGGREGATION: ON                                                                                       |
|      partitions=807/1460                                                                                      |
|      rollup: ads_guanxing_day_org_pro_sptm_sal_ds                                                             |
|      tabletRatio=2421/2421                                                                                    |
|      tabletList=38694420,38694424,38694428,38694433,38694437,38694441,38694446,38694450,38694454,38694459 ... |
|      cardinality=116436070                                                                                    |
|      avgRowSize=31.999102                                                                                     |
|      numNodes=0                                                                                               |
+---------------------------------------------------------------------------------------------------------------+
45 rows in set (0.72 sec)

还在吗?能解决吗?这个

看下default_catalog.information_schema.task_runs这个物化视图是否刷新成功了,确认物化视图刷新成功后基表数据是没有变化的。

看着失败报错了,说是内存超出限制,是不是像这种几亿条数据的大表不能创建物化视图啊?

mysql> select * from information_schema.task_runs  \G;
*************************** 1. row ***************************
     QUERY_ID: 620598dd-ae98-11ee-8c5d-b4055dfc9e39
    TASK_NAME: mv-105398162
  CREATE_TIME: 2024-01-09 10:39:59
  FINISH_TIME: 2024-01-09 10:40:10
        STATE: FAILED
     DATABASE: ads_hy_guanxing
   DEFINITION: insert overwrite ads_guanxing_day_org_pro_sptm_sal_ds_view_02 SELECT `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day` AS `period_sdate`, sum(`ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_qty`) AS `current_sal_qty`, sum(`ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`sal_amt`) AS `current_sal_amt`, sum(`ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`collect_num`) AS `current_mockdata_num`
FROM `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`
GROUP BY `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`tm_product_no`, `ads_hy_guanxing`.`ads_guanxing_day_org_pro_sptm_sal_ds`.`partition_day`
  EXPIRE_TIME: 2024-01-10 10:39:59
   ERROR_CODE: -1
ERROR_MESSAGE: com.starrocks.sql.common.DmlException: Memory of Query620598dd-ae98-11ee-8c5d-b4055dfc9e39 exceed limit. Pipeline Backend: 10.250.84.30, fragment: 620598dd-ae98-11ee-8c5d-b4055dfc9e42 Used: 4295378153, Limit: 4294967296. Mem usage has exceed the limit of single query, You can change the limit by set session variable exec_mem_limit or query_mem_limit.
     PROGRESS: 0%
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql> 

enable_spill(3.0 及以后)

是否启用中间结果落盘。默认值: false 。如果将其设置为 true ,StarRocks 会将中间结果落盘,以减少在查询中处理聚合、排序或连接算子时的内存使用量。

====================

PROPERTIES (选填)

异步物化视图的属性。您可以使用 ALTER MATERIALIZED VIEW 修改已有异步物化视图的属性。

  • session. : 如果您想要更改与物化视图相关的 Session 变量属性,必须在属性前添加 session. 前缀,例如。

=====================
可以在定义物化视图指定session的enable_spill参数的,可以试下看看。如果不行的话就只能增加内存了。

我们版本是2.5.8的,那是不是用不了?这些是3.0版本才有的属性吗?另外我们集群机器配置也挺大的,be:80core x 256G,这个物化视图为什么会要这么大内存?

mysql> SHOW backends ;
+-----------+--------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------+---------------+--------------------------------------------------------+-------------------+-------------+----------+-------------------+------------+------------+
| BackendId | IP           | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime       | LastHeartbeat       | Alive | SystemDecommissioned | ClusterDecommissioned | TabletNum | DataUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | ErrMsg | Version       | Status                                                 | DataTotalCapacity | DataUsedPct | CpuCores | NumRunningQueries | MemUsedPct | CpuUsedPct |
+-----------+--------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+--------+---------------+--------------------------------------------------------+-------------------+-------------+----------+-------------------+------------+------------+
| 20486190  | 192.198.10.10 | 9050          | 9060   | 8040     | 8060     | 2023-12-05 13:49:36 | 2024-01-10 10:49:24 | true  | false                | false                 | 178218    | 133.961 GB       | 87.135 TB     | 87.289 TB     | 0.18 %  | 0.20 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:49:23"} | 87.266 TB         | 0.15 %      | 80       | 5                 | 33.30 %    | 7.5 %      |
| 20486083  | 192.198.10.11 | 9050          | 9060   | 8040     | 8060     | 2023-07-12 16:10:00 | 2024-01-10 10:49:24 | true  | false                | false                 | 200373    | 246.774 GB       | 87.030 TB     | 87.289 TB     | 0.30 %  | 0.31 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:24"} | 87.271 TB         | 0.28 %      | 80       | 5                 | 36.29 %    | 8.1 %      |
| 20485688  | 192.198.10.12 | 9050          | 9060   | 8040     | 8060     | 2023-07-12 16:08:25 | 2024-01-10 10:49:24 | true  | false                | false                 | 200834    | 247.696 GB       | 87.020 TB     | 87.289 TB     | 0.31 %  | 0.33 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:49:24"} | 87.262 TB         | 0.28 %      | 80       | 5                 | 35.96 %    | 10.0 %     |
| 20484283  | 192.198.10.13 | 9050          | 9060   | 8040     | 8060     | 2023-07-12 16:05:29 | 2024-01-10 10:49:24 | true  | false                | false                 | 200710    | 246.202 GB       | 87.021 TB     | 87.289 TB     | 0.31 %  | 0.33 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:41"} | 87.261 TB         | 0.28 %      | 80       | 5                 | 36.46 %    | 8.7 %      |
| 10004     | 192.198.10.27 | 9050          | 9060   | 8040     | 8060     | 2023-07-25 15:58:26 | 2024-01-10 10:49:24 | true  | false                | false                 | 201482    | 292.141 GB       | 50.602 TB     | 50.938 TB     | 0.66 %  | 0.72 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:26"} | 50.887 TB         | 0.56 %      | 96       | 3                 | 41.01 %    | 29.1 %     |
| 10005     | 192.198.10.28 | 9050          | 9060   | 8040     | 8060     | 2023-07-20 16:02:26 | 2024-01-10 10:49:24 | true  | false                | false                 | 201885    | 287.672 GB       | 50.604 TB     | 50.938 TB     | 0.66 %  | 0.72 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:25"} | 50.885 TB         | 0.55 %      | 96       | 2                 | 41.27 %    | 21.1 %     |
| 2252461   | 192.198.10.29 | 9050          | 9060   | 8040     | 8060     | 2023-07-18 16:37:50 | 2024-01-10 10:49:24 | true  | false                | false                 | 201431    | 299.782 GB       | 50.581 TB     | 50.938 TB     | 0.70 %  | 0.78 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:36"} | 50.874 TB         | 0.58 %      | 96       | 3                 | 41.85 %    | 24.7 %     |
| 5322006   | 192.198.10.30 | 9050          | 9060   | 8040     | 8060     | 2023-07-11 17:52:21 | 2024-01-10 10:49:24 | true  | false                | false                 | 200561    | 310.035 GB       | 43.346 TB     | 43.662 TB     | 0.72 %  | 0.72 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:39"} | 43.648 TB         | 0.69 %      | 96       | 4                 | 35.67 %    | 6.4 %      |
| 20486599  | 192.198.10.8  | 9050          | 9060   | 8040     | 8060     | 2023-07-12 16:13:15 | 2024-01-10 10:49:24 | true  | false                | false                 | 202288    | 246.095 GB       | 87.019 TB     | 87.289 TB     | 0.31 %  | 0.33 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:28"} | 87.259 TB         | 0.28 %      | 80       | 6                 | 36.21 %    | 9.6 %      |
| 20486397  | 192.198.10.9  | 9050          | 9060   | 8040     | 8060     | 2023-07-12 16:12:15 | 2024-01-10 10:49:24 | true  | false                | false                 | 200739    | 265.663 GB       | 87.006 TB     | 87.289 TB     | 0.32 %  | 0.42 %         |        | 2.5.8-0a371e0 | {"lastSuccessReportTabletsTime":"2024-01-10 10:48:41"} | 87.265 TB         | 0.30 %      | 80       | 8                 | 36.06 %    | 12.0 %     |
+-----------+--------------+---------------+--------+----------+----------+---------------------+---------------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+-------

嗯,升级下吧,很快的,把配置文件cp到新版本的二进制目录下重启下

内存大就把内存限制调大呗

创建物化视图的时候指定内存大小吗?怎么调大?

show variables like “%query_mem_limit%”; 现在内存限制是多大,物化视图的查询直接执行查询也会报错内存超限是吧,可以调大上限。 group by使用内存高可以参考看下是否可以使用该优化:
Sorted streaming aggregate | StarRocks

现在内存是0没有限制的吧,是用到机器的所有内存吧?

mysql> show variables like "%query_mem_limit%";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| query_mem_limit | 0     |
+-----------------+-------+
1 row in set (0.00 sec)

从报错信息来看,限制了使用4个G内存 @dongquan @ikun