Skip to content

[fix](mtmv) Fix materialized rewrite oom when the num of relation mapping is too large #48887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 3, 2025

Conversation

seawinde
Copy link
Contributor

What problem does this PR solve?

Fix materialized rewrite oom when the num of relation mapping is two large

In a database query with 10 self-joins on the same table, there would be 10! = 3,628,800 unique permutation combinations. These need to be pruned in advance through query optimization to avoid excessive memory consumption

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

Fix materialized rewrite oom when the num of relation mapping is two large

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@seawinde
Copy link
Contributor Author

run buildall

1 similar comment
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 32236 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 718fc167251391e7763c9d6bb7e5c820bd225cad, data reload: false

------ Round 1 ----------------------------------
q1	17601	5174	5064	5064
q2	2050	280	165	165
q3	10946	1258	751	751
q4	10255	1040	534	534
q5	7928	2331	2336	2331
q6	188	158	130	130
q7	888	742	615	615
q8	9288	1271	1086	1086
q9	4816	4695	4595	4595
q10	6835	2312	1894	1894
q11	491	269	260	260
q12	352	356	213	213
q13	17796	3684	3081	3081
q14	228	238	207	207
q15	538	499	486	486
q16	626	627	593	593
q17	585	863	336	336
q18	6694	6511	6246	6246
q19	1293	956	534	534
q20	307	328	196	196
q21	2985	2178	1918	1918
q22	1086	1056	1001	1001
Total cold run time: 103776 ms
Total hot run time: 32236 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5199	5092	5147	5092
q2	235	325	231	231
q3	2160	2664	2295	2295
q4	1401	1823	1397	1397
q5	4262	4131	4134	4131
q6	204	160	130	130
q7	1874	1907	1748	1748
q8	2584	2616	2572	2572
q9	7272	7246	7160	7160
q10	3012	3225	2778	2778
q11	565	516	503	503
q12	740	788	587	587
q13	3511	3884	3263	3263
q14	276	292	282	282
q15	536	473	481	473
q16	641	700	637	637
q17	1122	1554	1353	1353
q18	7632	7642	7534	7534
q19	795	830	978	830
q20	1970	2001	1861	1861
q21	5468	5048	4638	4638
q22	1127	1071	1040	1040
Total cold run time: 52586 ms
Total hot run time: 50535 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192253 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 718fc167251391e7763c9d6bb7e5c820bd225cad, data reload: false

query1	1384	1003	972	972
query2	6113	1862	1898	1862
query3	11141	4626	4754	4626
query4	56908	25776	23347	23347
query5	5138	503	465	465
query6	380	185	166	166
query7	5149	488	279	279
query8	331	258	252	252
query9	6839	2630	2641	2630
query10	423	301	244	244
query11	15149	15146	14925	14925
query12	160	112	108	108
query13	1236	526	428	428
query14	10898	6357	6323	6323
query15	217	206	179	179
query16	7083	663	519	519
query17	1090	761	580	580
query18	1575	405	329	329
query19	194	222	197	197
query20	131	123	119	119
query21	214	127	103	103
query22	4612	4539	4313	4313
query23	33839	33553	33438	33438
query24	5729	2419	2426	2419
query25	459	473	404	404
query26	699	275	151	151
query27	1811	512	338	338
query28	2868	2477	2464	2464
query29	574	601	416	416
query30	268	223	188	188
query31	889	872	793	793
query32	72	65	70	65
query33	435	350	309	309
query34	746	860	505	505
query35	811	870	791	791
query36	976	995	879	879
query37	116	99	74	74
query38	4134	4174	4274	4174
query39	1490	1405	1422	1405
query40	223	115	106	106
query41	51	50	47	47
query42	119	102	102	102
query43	506	507	474	474
query44	1309	818	843	818
query45	175	175	177	175
query46	847	1035	635	635
query47	1865	1914	1807	1807
query48	393	424	311	311
query49	706	515	442	442
query50	714	752	428	428
query51	4264	4258	4272	4258
query52	109	108	99	99
query53	240	299	191	191
query54	501	492	430	430
query55	89	76	78	76
query56	261	274	242	242
query57	1197	1166	1124	1124
query58	242	261	241	241
query59	2838	2902	2846	2846
query60	276	270	264	264
query61	119	116	134	116
query62	736	759	686	686
query63	235	185	184	184
query64	1828	1044	678	678
query65	4513	4405	4380	4380
query66	715	395	287	287
query67	15802	15696	15289	15289
query68	7426	865	505	505
query69	551	298	252	252
query70	1210	1080	1110	1080
query71	507	301	275	275
query72	5735	3648	3791	3648
query73	1097	741	347	347
query74	8964	9270	8864	8864
query75	3656	3174	2706	2706
query76	4192	1177	748	748
query77	567	366	267	267
query78	10258	10078	9318	9318
query79	2830	821	588	588
query80	751	531	475	475
query81	489	252	226	226
query82	760	125	94	94
query83	262	169	155	155
query84	294	106	80	80
query85	780	358	305	305
query86	415	317	287	287
query87	4653	4610	4478	4478
query88	3564	2218	2232	2218
query89	419	324	284	284
query90	1778	213	212	212
query91	203	136	110	110
query92	78	57	59	57
query93	2496	1064	584	584
query94	671	406	270	270
query95	357	281	260	260
query96	492	564	275	275
query97	3359	3445	3320	3320
query98	234	204	194	194
query99	1418	1382	1256	1256
Total cold run time: 303620 ms
Total hot run time: 192253 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.62 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 718fc167251391e7763c9d6bb7e5c820bd225cad, data reload: false

query1	0.03	0.03	0.04
query2	0.07	0.03	0.04
query3	0.23	0.06	0.07
query4	1.62	0.10	0.11
query5	0.56	0.55	0.54
query6	1.16	0.73	0.73
query7	0.02	0.02	0.02
query8	0.04	0.03	0.03
query9	0.60	0.51	0.52
query10	0.59	0.58	0.59
query11	0.16	0.11	0.11
query12	0.14	0.11	0.10
query13	0.62	0.60	0.60
query14	2.82	2.66	2.73
query15	0.92	0.84	0.87
query16	0.37	0.39	0.39
query17	1.04	1.04	1.05
query18	0.21	0.19	0.19
query19	1.86	1.81	2.04
query20	0.01	0.02	0.01
query21	15.35	0.90	0.55
query22	0.76	1.20	0.63
query23	14.93	1.37	0.61
query24	6.64	2.61	0.55
query25	0.52	0.30	0.14
query26	0.67	0.16	0.14
query27	0.05	0.05	0.04
query28	9.16	0.78	0.42
query29	12.59	3.98	3.36
query30	0.26	0.10	0.05
query31	2.81	0.60	0.40
query32	3.22	0.54	0.47
query33	3.05	3.06	3.13
query34	15.76	5.09	4.49
query35	4.56	4.53	4.52
query36	0.67	0.50	0.48
query37	0.09	0.06	0.07
query38	0.06	0.04	0.04
query39	0.03	0.02	0.03
query40	0.16	0.14	0.14
query41	0.08	0.02	0.02
query42	0.04	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 104.56 s
Total hot run time: 30.62 s

@seawinde seawinde changed the title [fix](mtmv) Fix materialized rewrite oom when the num of relation mapping is two large [fix](mtmv) Fix materialized rewrite oom when the num of relation mapping is too large Mar 12, 2025
boolean[] used, MappedRelation[] current, List<Pair<MappedRelation[], MappedRelation[]>> results,
int maxMappingCount) {
if (results.size() >= maxMappingCount) {
LOG.warn("queryToViewTableMappings is over limit and be intercepted");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log size and other key info here

@seawinde seawinde force-pushed the fix_relation_mapping_oom branch from 718fc16 to 61ff18d Compare March 19, 2025 02:37
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 32610 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 61ff18db95f5e9ffb28c20e9ebed007b7db5bd47, data reload: false

------ Round 1 ----------------------------------
q1	24304	5057	5027	5027
q2	2049	306	179	179
q3	10436	1236	672	672
q4	10217	989	555	555
q5	7521	2803	2357	2357
q6	188	163	133	133
q7	922	762	613	613
q8	9333	1237	1102	1102
q9	4997	4983	4716	4716
q10	6821	2309	1907	1907
q11	491	285	283	283
q12	352	362	217	217
q13	17763	3708	3123	3123
q14	245	253	209	209
q15	518	483	483	483
q16	643	612	593	593
q17	587	852	348	348
q18	7076	6525	6402	6402
q19	1851	979	585	585
q20	312	330	201	201
q21	2715	2191	1920	1920
q22	1036	1004	985	985
Total cold run time: 110377 ms
Total hot run time: 32610 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5240	5172	5148	5148
q2	239	338	235	235
q3	2161	2701	2302	2302
q4	1472	1867	1442	1442
q5	4245	4177	4433	4177
q6	205	166	123	123
q7	1995	1939	1816	1816
q8	2586	2685	2586	2586
q9	7284	7390	7260	7260
q10	2957	3135	2803	2803
q11	574	522	516	516
q12	699	795	593	593
q13	3510	3938	3290	3290
q14	278	292	269	269
q15	571	503	497	497
q16	647	689	675	675
q17	1142	1642	1310	1310
q18	7773	7641	7593	7593
q19	817	818	840	818
q20	1956	2021	1873	1873
q21	5348	4923	4991	4923
q22	1135	1058	1056	1056
Total cold run time: 52834 ms
Total hot run time: 51305 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192447 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 61ff18db95f5e9ffb28c20e9ebed007b7db5bd47, data reload: false

query1	1394	1059	1037	1037
query2	6136	1908	1921	1908
query3	11087	4854	4715	4715
query4	25828	23678	22986	22986
query5	4943	650	459	459
query6	317	211	193	193
query7	3984	508	305	305
query8	301	249	250	249
query9	8485	2609	2593	2593
query10	492	305	249	249
query11	15905	15184	15068	15068
query12	167	107	105	105
query13	1711	502	403	403
query14	9960	6085	6149	6085
query15	200	186	169	169
query16	7609	679	497	497
query17	1262	737	565	565
query18	2050	411	319	319
query19	198	188	162	162
query20	127	127	117	117
query21	216	129	113	113
query22	4330	4627	4484	4484
query23	34267	33511	33484	33484
query24	8463	2447	2424	2424
query25	503	457	404	404
query26	790	270	151	151
query27	2675	503	324	324
query28	4826	2448	2407	2407
query29	638	579	451	451
query30	274	220	200	200
query31	950	885	816	816
query32	73	61	64	61
query33	541	369	293	293
query34	781	880	532	532
query35	781	838	757	757
query36	970	1004	923	923
query37	126	108	76	76
query38	4217	4275	4235	4235
query39	1478	1468	1481	1468
query40	214	118	107	107
query41	53	55	49	49
query42	118	104	105	104
query43	511	502	486	486
query44	1315	790	798	790
query45	179	170	171	170
query46	830	1027	664	664
query47	1831	1858	1802	1802
query48	392	441	324	324
query49	702	491	405	405
query50	698	743	410	410
query51	4265	4327	4288	4288
query52	117	106	98	98
query53	242	255	198	198
query54	491	500	410	410
query55	84	77	83	77
query56	265	269	262	262
query57	1190	1198	1101	1101
query58	252	240	244	240
query59	2695	2941	2923	2923
query60	285	274	260	260
query61	122	127	119	119
query62	783	744	665	665
query63	231	191	193	191
query64	3212	1134	769	769
query65	4495	4469	4494	4469
query66	867	418	309	309
query67	16353	15504	15411	15411
query68	9297	877	498	498
query69	493	319	263	263
query70	1213	1105	1116	1105
query71	479	287	270	270
query72	5140	3499	3473	3473
query73	767	704	357	357
query74	9269	8922	9152	8922
query75	4417	3126	2675	2675
query76	3722	1172	734	734
query77	953	370	268	268
query78	9861	10143	9293	9293
query79	4858	824	563	563
query80	588	522	438	438
query81	477	254	220	220
query82	365	128	98	98
query83	167	170	151	151
query84	283	95	71	71
query85	752	356	317	317
query86	355	289	293	289
query87	4568	4666	4386	4386
query88	2899	2275	2255	2255
query89	447	308	279	279
query90	2126	221	216	216
query91	141	136	107	107
query92	78	58	58	58
query93	3093	1029	576	576
query94	679	423	309	309
query95	396	271	267	267
query96	492	558	281	281
query97	3330	3426	3286	3286
query98	236	209	209	209
query99	1409	1404	1325	1325
Total cold run time: 285197 ms
Total hot run time: 192447 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.97 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 61ff18db95f5e9ffb28c20e9ebed007b7db5bd47, data reload: false

query1	0.04	0.04	0.03
query2	0.12	0.10	0.10
query3	0.26	0.19	0.18
query4	1.59	0.19	0.19
query5	0.59	0.57	0.59
query6	1.23	0.72	0.70
query7	0.02	0.02	0.01
query8	0.04	0.03	0.04
query9	0.58	0.51	0.52
query10	0.58	0.62	0.58
query11	0.16	0.12	0.11
query12	0.15	0.12	0.11
query13	0.62	0.61	0.61
query14	2.80	2.71	2.68
query15	0.93	0.86	0.85
query16	0.37	0.38	0.38
query17	1.06	1.02	1.01
query18	0.20	0.20	0.19
query19	1.93	1.89	1.85
query20	0.02	0.01	0.01
query21	15.36	0.90	0.55
query22	0.76	1.20	0.74
query23	14.87	1.38	0.64
query24	7.26	1.94	0.53
query25	0.51	0.25	0.09
query26	0.57	0.16	0.13
query27	0.05	0.05	0.05
query28	9.41	0.91	0.45
query29	12.56	4.03	3.30
query30	0.25	0.08	0.06
query31	2.83	0.59	0.39
query32	3.27	0.55	0.47
query33	2.94	3.04	3.02
query34	15.66	5.15	4.50
query35	4.57	4.56	4.56
query36	0.67	0.50	0.48
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.03	0.02	0.02
query40	0.17	0.13	0.12
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 105.32 s
Total hot run time: 30.97 s

Comment on lines 202 to 204
LOG.warn(String.format("queryToViewTableMappings is over limit and be intercepted, "
+ "results size is %s,\n MappedRelation left is %s,\n MappedRelation right is %s \n",
results.size(), Arrays.toString(left), Arrays.toString(right)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use String.format use log place holder instead. do not use \n in log normally, because it is not friendly for auto log analysis

Suggested change
LOG.warn(String.format("queryToViewTableMappings is over limit and be intercepted, "
+ "results size is %s,\n MappedRelation left is %s,\n MappedRelation right is %s \n",
results.size(), Arrays.toString(left), Arrays.toString(right)));
LOG.warn("queryToViewTableMappings is over limit and be intercepted, "
+ "results size is {}, MappedRelation left is {}, MappedRelation right is {}",
results.size(), left, right);

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 32710 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 034451bf8fd6faa662b58656b9f877df53a8470a, data reload: false

------ Round 1 ----------------------------------
q1	24360	5086	5048	5048
q2	2044	306	199	199
q3	10366	1274	731	731
q4	10225	992	539	539
q5	7524	2412	2393	2393
q6	184	164	133	133
q7	938	763	618	618
q8	9307	1324	1089	1089
q9	5026	4813	4736	4736
q10	6818	2301	1896	1896
q11	470	284	262	262
q12	361	353	236	236
q13	17761	3762	3116	3116
q14	234	236	205	205
q15	531	475	484	475
q16	626	622	575	575
q17	573	869	371	371
q18	6846	6337	6328	6328
q19	1222	1089	566	566
q20	325	342	197	197
q21	2878	2291	2007	2007
q22	1037	1029	990	990
Total cold run time: 109656 ms
Total hot run time: 32710 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5159	5132	5158	5132
q2	241	320	225	225
q3	2161	2712	2292	2292
q4	1416	1823	1382	1382
q5	4255	4154	4446	4154
q6	211	171	131	131
q7	2051	1953	1782	1782
q8	2665	2688	2550	2550
q9	7143	7209	7306	7209
q10	2982	3319	2755	2755
q11	572	528	513	513
q12	661	765	600	600
q13	3631	3860	3338	3338
q14	289	303	267	267
q15	527	495	469	469
q16	652	667	640	640
q17	1140	1678	1357	1357
q18	7677	7526	7376	7376
q19	835	851	899	851
q20	1955	2033	1876	1876
q21	5446	4901	4690	4690
q22	1077	1054	1015	1015
Total cold run time: 52746 ms
Total hot run time: 50604 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 185973 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 034451bf8fd6faa662b58656b9f877df53a8470a, data reload: false

query1	1011	498	476	476
query2	6558	1928	1894	1894
query3	6809	229	224	224
query4	26284	23745	23232	23232
query5	4374	681	514	514
query6	298	209	189	189
query7	4603	503	302	302
query8	295	251	258	251
query9	8606	2604	2603	2603
query10	477	311	264	264
query11	15944	15107	14814	14814
query12	176	109	105	105
query13	1665	532	405	405
query14	9367	6445	6480	6445
query15	213	188	175	175
query16	7707	617	444	444
query17	1198	710	578	578
query18	1992	410	317	317
query19	192	227	158	158
query20	119	113	117	113
query21	209	117	109	109
query22	4333	4214	4213	4213
query23	33951	32979	32930	32930
query24	7992	2418	2413	2413
query25	508	451	393	393
query26	1226	267	165	165
query27	2631	475	329	329
query28	4419	2401	2404	2401
query29	728	572	430	430
query30	279	218	190	190
query31	945	866	763	763
query32	72	63	67	63
query33	565	343	303	303
query34	791	898	500	500
query35	779	815	753	753
query36	981	992	876	876
query37	117	93	77	77
query38	4079	4155	4024	4024
query39	1461	1396	1411	1396
query40	205	120	102	102
query41	54	56	51	51
query42	126	108	104	104
query43	497	522	479	479
query44	1314	804	803	803
query45	179	175	174	174
query46	853	1012	619	619
query47	1799	1788	1714	1714
query48	376	416	314	314
query49	796	488	421	421
query50	688	747	406	406
query51	4230	4216	4109	4109
query52	98	101	94	94
query53	236	253	192	192
query54	496	489	408	408
query55	84	80	81	80
query56	280	275	276	275
query57	1120	1133	1075	1075
query58	248	233	235	233
query59	2817	2677	2727	2677
query60	278	267	251	251
query61	124	122	122	122
query62	793	756	650	650
query63	242	192	196	192
query64	4262	1010	672	672
query65	4430	4309	4362	4309
query66	1058	420	312	312
query67	15971	15530	15336	15336
query68	8031	840	503	503
query69	455	303	313	303
query70	1200	1157	1111	1111
query71	455	295	265	265
query72	5558	3598	3841	3598
query73	770	724	352	352
query74	8960	9171	8935	8935
query75	3782	3154	2696	2696
query76	3709	1184	765	765
query77	790	381	335	335
query78	9955	10196	9282	9282
query79	2432	835	592	592
query80	639	527	458	458
query81	492	267	223	223
query82	592	132	97	97
query83	185	177	157	157
query84	243	93	82	82
query85	794	346	308	308
query86	382	305	272	272
query87	4374	4585	4457	4457
query88	3861	2265	2260	2260
query89	388	317	286	286
query90	1878	228	219	219
query91	141	141	113	113
query92	75	62	59	59
query93	1795	1038	587	587
query94	672	418	312	312
query95	363	279	268	268
query96	479	571	278	278
query97	3367	3389	3291	3291
query98	228	205	203	203
query99	1482	1388	1301	1301
Total cold run time: 276135 ms
Total hot run time: 185973 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 31.26 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 034451bf8fd6faa662b58656b9f877df53a8470a, data reload: false

query1	0.03	0.03	0.03
query2	0.12	0.10	0.11
query3	0.26	0.19	0.19
query4	1.59	0.20	0.10
query5	0.57	0.55	0.55
query6	1.18	0.71	0.72
query7	0.03	0.02	0.02
query8	0.04	0.03	0.04
query9	0.59	0.53	0.52
query10	0.63	0.58	0.59
query11	0.16	0.11	0.11
query12	0.14	0.11	0.11
query13	0.62	0.60	0.61
query14	2.67	2.68	2.69
query15	0.92	0.85	0.85
query16	0.39	0.39	0.39
query17	1.03	1.08	1.01
query18	0.21	0.20	0.20
query19	2.00	1.86	1.85
query20	0.01	0.01	0.01
query21	15.38	0.92	0.55
query22	0.76	1.20	0.68
query23	14.87	1.37	0.65
query24	6.98	0.85	1.01
query25	0.56	0.20	0.22
query26	0.51	0.16	0.13
query27	0.05	0.06	0.05
query28	9.94	0.86	0.43
query29	12.57	3.90	3.32
query30	0.26	0.09	0.06
query31	2.82	0.57	0.39
query32	3.23	0.54	0.47
query33	3.04	3.05	3.05
query34	15.75	5.14	4.48
query35	4.51	4.53	4.51
query36	0.67	0.49	0.49
query37	0.08	0.06	0.06
query38	0.05	0.04	0.03
query39	0.04	0.02	0.02
query40	0.17	0.14	0.13
query41	0.09	0.03	0.02
query42	0.04	0.03	0.02
query43	0.03	0.03	0.03
Total cold run time: 105.59 s
Total hot run time: 31.26 s

@seawinde seawinde force-pushed the fix_relation_mapping_oom branch from 034451b to 6592ea6 Compare March 20, 2025 03:31
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 32114 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 6592ea6b0c810509916f024dff4f2ad2346fef66, data reload: false

------ Round 1 ----------------------------------
q1	24377	5080	5022	5022
q2	2047	305	176	176
q3	10394	1257	691	691
q4	10224	1028	526	526
q5	7551	2652	2392	2392
q6	186	178	134	134
q7	911	742	621	621
q8	9323	1292	1092	1092
q9	4868	4860	4528	4528
q10	6812	2319	1894	1894
q11	458	275	252	252
q12	347	352	222	222
q13	17762	3655	3053	3053
q14	226	237	207	207
q15	529	488	479	479
q16	618	614	580	580
q17	567	865	343	343
q18	6771	6506	6251	6251
q19	1213	950	547	547
q20	335	337	200	200
q21	2739	2257	1916	1916
q22	1026	1028	988	988
Total cold run time: 109284 ms
Total hot run time: 32114 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5127	5095	5113	5095
q2	239	325	233	233
q3	2147	2655	2283	2283
q4	1391	1846	1378	1378
q5	4273	4152	4344	4152
q6	212	178	128	128
q7	2009	1951	1793	1793
q8	2606	2654	2568	2568
q9	7395	7106	7223	7106
q10	2984	3201	2757	2757
q11	581	490	488	488
q12	669	746	649	649
q13	3521	3881	3313	3313
q14	311	294	278	278
q15	533	492	491	491
q16	656	719	679	679
q17	1148	1581	1361	1361
q18	7877	7676	7588	7588
q19	805	790	886	790
q20	1947	1944	1840	1840
q21	5407	4789	4806	4789
q22	1110	1054	1026	1026
Total cold run time: 52948 ms
Total hot run time: 50785 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192356 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 6592ea6b0c810509916f024dff4f2ad2346fef66, data reload: false

query1	1386	1068	1058	1058
query2	6057	1903	1874	1874
query3	11009	4694	4339	4339
query4	52684	24467	23474	23474
query5	5153	546	460	460
query6	338	202	176	176
query7	4927	504	301	301
query8	312	246	224	224
query9	6096	2595	2634	2595
query10	432	319	265	265
query11	15227	15425	14919	14919
query12	158	112	108	108
query13	1064	519	395	395
query14	10585	6879	6498	6498
query15	219	195	173	173
query16	7063	698	502	502
query17	1088	722	588	588
query18	1556	428	330	330
query19	211	196	179	179
query20	129	130	120	120
query21	213	128	109	109
query22	4399	4601	4409	4409
query23	33906	33793	33458	33458
query24	5802	2400	2423	2400
query25	445	459	415	415
query26	738	276	171	171
query27	2007	489	341	341
query28	2919	2444	2410	2410
query29	608	556	427	427
query30	274	226	192	192
query31	866	852	818	818
query32	69	65	62	62
query33	465	372	344	344
query34	771	858	544	544
query35	800	836	764	764
query36	962	1004	897	897
query37	123	107	75	75
query38	4227	4428	4144	4144
query39	1488	1435	1429	1429
query40	215	124	105	105
query41	52	52	51	51
query42	124	109	107	107
query43	523	529	497	497
query44	1360	821	832	821
query45	184	174	165	165
query46	853	1029	646	646
query47	1793	1844	1774	1774
query48	404	430	338	338
query49	736	531	441	441
query50	728	775	427	427
query51	4435	4305	4248	4248
query52	110	112	97	97
query53	249	267	202	202
query54	501	522	439	439
query55	87	85	84	84
query56	295	285	265	265
query57	1166	1226	1126	1126
query58	253	240	255	240
query59	2677	2692	2481	2481
query60	283	271	271	271
query61	125	117	124	117
query62	713	745	675	675
query63	225	189	186	186
query64	2167	1002	687	687
query65	4409	4333	4335	4333
query66	757	392	295	295
query67	15711	15769	15277	15277
query68	7316	876	502	502
query69	543	299	270	270
query70	1193	1131	1095	1095
query71	495	289	273	273
query72	5745	3749	3858	3749
query73	1347	760	346	346
query74	9030	9161	8939	8939
query75	3843	3134	2724	2724
query76	4387	1199	762	762
query77	640	368	297	297
query78	10009	10104	9289	9289
query79	3097	833	579	579
query80	767	525	444	444
query81	480	250	221	221
query82	549	132	98	98
query83	276	179	154	154
query84	282	90	79	79
query85	798	355	310	310
query86	354	311	279	279
query87	4661	4487	4458	4458
query88	3146	2272	2257	2257
query89	414	321	279	279
query90	1990	219	227	219
query91	138	136	113	113
query92	72	60	54	54
query93	1193	1056	581	581
query94	685	418	303	303
query95	358	277	259	259
query96	489	559	279	279
query97	3389	3388	3312	3312
query98	218	199	201	199
query99	1418	1411	1251	1251
Total cold run time: 297233 ms
Total hot run time: 192356 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.82 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 6592ea6b0c810509916f024dff4f2ad2346fef66, data reload: false

query1	0.04	0.03	0.03
query2	0.12	0.10	0.11
query3	0.25	0.19	0.19
query4	1.60	0.18	0.20
query5	0.60	0.57	0.58
query6	1.23	0.71	0.72
query7	0.02	0.02	0.01
query8	0.04	0.04	0.04
query9	0.58	0.51	0.53
query10	0.58	0.59	0.57
query11	0.15	0.11	0.11
query12	0.14	0.11	0.12
query13	0.61	0.60	0.60
query14	2.72	2.71	2.80
query15	0.92	0.85	0.83
query16	0.37	0.38	0.39
query17	1.02	1.04	1.01
query18	0.22	0.20	0.20
query19	1.90	1.88	1.84
query20	0.01	0.01	0.01
query21	15.36	0.91	0.55
query22	0.74	1.11	0.59
query23	15.14	1.36	0.62
query24	6.51	1.82	0.56
query25	0.54	0.21	0.17
query26	0.63	0.15	0.13
query27	0.05	0.05	0.05
query28	10.05	0.88	0.42
query29	12.56	3.99	3.27
query30	0.25	0.10	0.06
query31	2.80	0.59	0.38
query32	3.22	0.55	0.46
query33	3.03	3.10	2.99
query34	15.69	5.13	4.52
query35	4.57	4.58	4.54
query36	0.66	0.49	0.48
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.02
query40	0.16	0.13	0.13
query41	0.08	0.02	0.02
query42	0.03	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 105.41 s
Total hot run time: 30.82 s

@seawinde seawinde requested a review from morrySnow March 25, 2025 02:51
Copy link
Contributor

@zfr9527 zfr9527 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

PR approved by anyone and no changes requested.

@seawinde seawinde force-pushed the fix_relation_mapping_oom branch from e3ea000 to c801da8 Compare April 1, 2025 08:57
@seawinde
Copy link
Contributor Author

seawinde commented Apr 1, 2025

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 35606 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit c801da81e1ef1fc054c55bb49d375b4deb90351e, data reload: false

------ Round 1 ----------------------------------
q1	26026	5024	5004	5004
q2	2526	281	192	192
q3	12322	1232	687	687
q4	10230	1006	527	527
q5	8001	2308	2385	2308
q6	182	161	133	133
q7	906	746	621	621
q8	9322	1291	1082	1082
q9	6944	5088	5129	5088
q10	6912	2365	1958	1958
q11	505	296	272	272
q12	358	361	229	229
q13	18213	4031	3449	3449
q14	247	265	228	228
q15	620	506	490	490
q16	634	625	586	586
q17	619	862	392	392
q18	8912	7186	7188	7186
q19	1233	946	558	558
q20	349	352	246	246
q21	4499	3460	3364	3364
q22	1045	1065	1006	1006
Total cold run time: 120605 ms
Total hot run time: 35606 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5089	5123	5073	5073
q2	236	320	231	231
q3	2177	2689	2406	2406
q4	1458	1917	1531	1531
q5	4490	4389	4329	4329
q6	212	167	135	135
q7	1970	1911	1761	1761
q8	2616	2663	2524	2524
q9	7072	7148	7173	7148
q10	2933	3198	2737	2737
q11	590	499	475	475
q12	666	769	604	604
q13	3569	4072	3291	3291
q14	293	292	276	276
q15	526	492	493	492
q16	667	697	658	658
q17	1149	1638	1325	1325
q18	7773	7590	7358	7358
q19	779	802	861	802
q20	1950	2047	1892	1892
q21	5298	4903	4729	4729
q22	1113	1033	1014	1014
Total cold run time: 52626 ms
Total hot run time: 50791 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192989 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit c801da81e1ef1fc054c55bb49d375b4deb90351e, data reload: false

query1	1410	1053	1050	1050
query2	6138	1903	1893	1893
query3	10980	4482	4442	4442
query4	25391	23296	23005	23005
query5	3990	603	449	449
query6	301	203	198	198
query7	4003	483	286	286
query8	339	246	235	235
query9	8500	2557	2522	2522
query10	437	327	262	262
query11	15306	15190	14729	14729
query12	171	111	102	102
query13	1553	511	404	404
query14	8868	6155	6194	6155
query15	193	185	168	168
query16	7184	626	494	494
query17	1214	739	600	600
query18	1987	415	319	319
query19	194	189	184	184
query20	129	130	131	130
query21	218	123	106	106
query22	4605	4570	4592	4570
query23	34052	33676	33271	33271
query24	8522	2438	2405	2405
query25	511	471	427	427
query26	1167	275	154	154
query27	2839	498	345	345
query28	4849	2433	2418	2418
query29	731	563	446	446
query30	285	231	228	228
query31	986	896	789	789
query32	82	67	63	63
query33	560	396	323	323
query34	892	874	525	525
query35	800	856	780	780
query36	959	1004	893	893
query37	117	97	81	81
query38	4183	4103	4084	4084
query39	1521	1464	1473	1464
query40	206	118	103	103
query41	52	51	50	50
query42	125	108	110	108
query43	487	504	477	477
query44	1302	830	824	824
query45	187	175	169	169
query46	820	1018	648	648
query47	1815	1888	1788	1788
query48	379	412	305	305
query49	783	519	414	414
query50	679	705	425	425
query51	4211	4326	4302	4302
query52	108	108	105	105
query53	233	274	191	191
query54	611	583	540	540
query55	90	82	86	82
query56	321	319	306	306
query57	1182	1236	1123	1123
query58	287	276	284	276
query59	2730	2826	2739	2739
query60	342	330	331	330
query61	160	152	153	152
query62	814	758	686	686
query63	231	196	197	196
query64	4181	1036	697	697
query65	4353	4231	4246	4231
query66	1095	414	305	305
query67	15929	15603	15496	15496
query68	8950	895	518	518
query69	477	317	271	271
query70	1183	1134	1109	1109
query71	462	391	300	300
query72	5587	4757	4675	4675
query73	720	606	423	423
query74	8917	9011	8989	8989
query75	4077	3208	2700	2700
query76	3756	1177	743	743
query77	781	407	289	289
query78	10118	10110	9232	9232
query79	2616	815	561	561
query80	618	514	458	458
query81	486	259	218	218
query82	493	127	98	98
query83	341	256	232	232
query84	296	109	83	83
query85	801	353	317	317
query86	385	326	286	286
query87	4502	4528	4459	4459
query88	3423	2228	2224	2224
query89	408	315	291	291
query90	1886	219	220	219
query91	146	149	115	115
query92	75	61	57	57
query93	1912	962	591	591
query94	672	425	306	306
query95	383	301	292	292
query96	485	568	273	273
query97	3195	3278	3121	3121
query98	232	203	209	203
query99	1464	1380	1269	1269
Total cold run time: 279727 ms
Total hot run time: 192989 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 31.87 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit c801da81e1ef1fc054c55bb49d375b4deb90351e, data reload: false

query1	0.04	0.04	0.03
query2	0.12	0.10	0.11
query3	0.26	0.19	0.20
query4	1.58	0.20	0.20
query5	0.58	0.59	0.59
query6	1.19	0.74	0.71
query7	0.02	0.02	0.02
query8	0.04	0.03	0.04
query9	0.58	0.52	0.54
query10	0.56	0.58	0.57
query11	0.16	0.12	0.11
query12	0.14	0.12	0.11
query13	0.61	0.61	0.60
query14	2.78	2.73	2.82
query15	0.92	0.86	0.84
query16	0.39	0.38	0.38
query17	1.02	1.01	1.03
query18	0.21	0.20	0.19
query19	1.91	2.00	1.86
query20	0.01	0.01	0.01
query21	15.38	0.91	0.54
query22	0.75	1.28	0.90
query23	14.70	1.45	0.60
query24	6.68	2.00	1.30
query25	0.52	0.23	0.09
query26	0.53	0.16	0.13
query27	0.05	0.05	0.04
query28	10.57	0.91	0.44
query29	12.55	4.00	3.32
query30	0.25	0.10	0.06
query31	2.81	0.60	0.39
query32	3.23	0.56	0.47
query33	3.11	3.01	3.03
query34	15.81	5.10	4.50
query35	4.49	4.50	4.49
query36	0.67	0.50	0.48
query37	0.09	0.07	0.06
query38	0.04	0.04	0.04
query39	0.03	0.03	0.02
query40	0.17	0.12	0.12
query41	0.08	0.03	0.02
query42	0.04	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 105.71 s
Total hot run time: 31.87 s

@seawinde
Copy link
Contributor Author

seawinde commented Apr 2, 2025

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 33953 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 22c9c4cccfeff2a3b9d0cb6c0183df76e4eb0c47, data reload: false

------ Round 1 ----------------------------------
q1	25770	5047	5031	5031
q2	2066	274	183	183
q3	10411	1261	690	690
q4	10214	991	511	511
q5	7517	2362	2275	2275
q6	183	161	131	131
q7	914	796	606	606
q8	9317	1298	1040	1040
q9	6874	5135	5179	5135
q10	6849	2283	1886	1886
q11	470	280	275	275
q12	345	347	216	216
q13	17768	3628	3038	3038
q14	228	233	236	233
q15	527	494	490	490
q16	638	602	590	590
q17	574	839	349	349
q18	7487	7210	7170	7170
q19	1607	935	556	556
q20	308	337	215	215
q21	4053	2602	2376	2376
q22	1029	1024	957	957
Total cold run time: 115149 ms
Total hot run time: 33953 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5149	5076	5203	5076
q2	242	320	235	235
q3	2134	2621	2240	2240
q4	1411	1811	1388	1388
q5	4406	4436	4513	4436
q6	211	172	127	127
q7	2038	1912	1826	1826
q8	2624	2667	2583	2583
q9	7368	7284	6981	6981
q10	3010	3170	2703	2703
q11	565	500	495	495
q12	669	747	607	607
q13	3480	3906	3292	3292
q14	273	300	293	293
q15	528	480	482	480
q16	674	676	652	652
q17	1133	1498	1391	1391
q18	7677	7495	7476	7476
q19	782	794	820	794
q20	2031	1953	1833	1833
q21	5277	4943	4776	4776
q22	1080	1053	999	999
Total cold run time: 52762 ms
Total hot run time: 50683 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 193095 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 22c9c4cccfeff2a3b9d0cb6c0183df76e4eb0c47, data reload: false

query1	1404	1082	1000	1000
query2	6029	1944	1961	1944
query3	11025	4496	4443	4443
query4	52970	24952	23025	23025
query5	5219	532	468	468
query6	377	208	192	192
query7	4984	485	276	276
query8	316	228	227	227
query9	5909	2583	2584	2583
query10	436	341	279	279
query11	15238	15081	14754	14754
query12	164	109	103	103
query13	1064	491	394	394
query14	10024	6288	6524	6288
query15	201	218	173	173
query16	7026	645	494	494
query17	1096	739	556	556
query18	1536	394	301	301
query19	210	195	165	165
query20	131	133	121	121
query21	224	128	106	106
query22	4546	4527	4405	4405
query23	34032	33316	33384	33316
query24	6697	2401	2412	2401
query25	469	451	393	393
query26	665	271	151	151
query27	2213	519	336	336
query28	3339	2440	2468	2440
query29	581	550	431	431
query30	273	224	205	205
query31	879	898	806	806
query32	77	106	59	59
query33	464	361	304	304
query34	767	861	536	536
query35	810	847	756	756
query36	938	1010	907	907
query37	115	101	78	78
query38	4408	4307	4141	4141
query39	1515	1477	1485	1477
query40	206	118	104	104
query41	51	52	52	52
query42	127	108	109	108
query43	493	516	495	495
query44	1305	820	816	816
query45	186	177	169	169
query46	836	1045	665	665
query47	1831	1868	1813	1813
query48	385	434	336	336
query49	693	499	457	457
query50	647	702	408	408
query51	4232	4322	4244	4244
query52	111	111	104	104
query53	231	261	183	183
query54	573	580	530	530
query55	91	91	91	91
query56	347	315	310	310
query57	1158	1201	1122	1122
query58	277	265	265	265
query59	2825	2857	2783	2783
query60	376	313	298	298
query61	133	130	128	128
query62	719	741	638	638
query63	223	186	195	186
query64	1471	1067	722	722
query65	4395	4455	4344	4344
query66	735	447	314	314
query67	15527	15600	15328	15328
query68	7104	821	527	527
query69	543	307	267	267
query70	1181	1112	1102	1102
query71	452	315	287	287
query72	5787	4968	5039	4968
query73	1171	693	350	350
query74	9006	9126	8728	8728
query75	3286	3172	2716	2716
query76	3882	1180	757	757
query77	552	362	283	283
query78	9944	10152	9424	9424
query79	2207	780	575	575
query80	593	524	441	441
query81	485	250	224	224
query82	455	123	100	100
query83	253	257	236	236
query84	307	106	87	87
query85	794	361	336	336
query86	393	299	290	290
query87	4464	4543	4302	4302
query88	3594	2267	2256	2256
query89	404	312	280	280
query90	1754	300	218	218
query91	143	152	114	114
query92	67	62	56	56
query93	1837	939	582	582
query94	702	420	308	308
query95	369	304	288	288
query96	479	567	276	276
query97	3176	3188	3142	3142
query98	239	207	198	198
query99	1510	1429	1330	1330
Total cold run time: 295688 ms
Total hot run time: 193095 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.86 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 22c9c4cccfeff2a3b9d0cb6c0183df76e4eb0c47, data reload: false

query1	0.03	0.03	0.03
query2	0.12	0.11	0.11
query3	0.25	0.19	0.19
query4	1.59	0.19	0.20
query5	0.59	0.57	0.58
query6	1.19	0.72	0.71
query7	0.02	0.01	0.01
query8	0.04	0.04	0.04
query9	0.58	0.53	0.54
query10	0.58	0.58	0.57
query11	0.16	0.12	0.11
query12	0.15	0.12	0.12
query13	0.61	0.61	0.60
query14	2.83	2.68	2.80
query15	0.91	0.84	0.84
query16	0.39	0.38	0.38
query17	1.07	1.08	1.01
query18	0.21	0.19	0.19
query19	1.90	1.99	1.83
query20	0.02	0.01	0.02
query21	15.35	0.90	0.56
query22	0.74	1.08	0.66
query23	15.07	1.40	0.61
query24	7.41	1.27	0.52
query25	0.56	0.22	0.12
query26	0.67	0.15	0.14
query27	0.05	0.05	0.04
query28	9.25	0.86	0.44
query29	12.52	4.02	3.33
query30	0.25	0.08	0.06
query31	2.83	0.59	0.38
query32	3.23	0.55	0.47
query33	2.98	3.08	3.05
query34	16.09	5.08	4.50
query35	4.52	4.46	4.49
query36	0.66	0.49	0.49
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.03	0.03	0.02
query40	0.17	0.13	0.12
query41	0.08	0.02	0.02
query42	0.04	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 105.92 s
Total hot run time: 30.86 s

Copy link
Contributor

github-actions bot commented Apr 2, 2025

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 2, 2025
@morrySnow morrySnow merged commit 6835efe into apache:master Apr 3, 2025
23 of 24 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 3, 2025
…ping is too large (#48887)

### What problem does this PR solve?

Fix materialized rewrite oom when the num of relation mapping is two
large

In a database query with 10 self-joins on the same table, there would be
10! = 3,628,800 unique permutation combinations. These need to be pruned
in advance through query optimization to avoid excessive memory
consumption
seawinde added a commit to seawinde/doris that referenced this pull request Apr 7, 2025
…ping is too large (apache#48887)

Fix materialized rewrite oom when the num of relation mapping is two
large

In a database query with 10 self-joins on the same table, there would be
10! = 3,628,800 unique permutation combinations. These need to be pruned
in advance through query optimization to avoid excessive memory
consumption
yiguolei pushed a commit that referenced this pull request Apr 8, 2025
dataroaring pushed a commit that referenced this pull request Apr 22, 2025
…relation mapping is too large #48887 (#49801)

Cherry-picked from #48887

Co-authored-by: seawinde <wusi@selectdb.com>
koarz pushed a commit to koarz/doris that referenced this pull request Jun 4, 2025
…ping is too large (apache#48887)

### What problem does this PR solve?

Fix materialized rewrite oom when the num of relation mapping is two
large

In a database query with 10 self-joins on the same table, there would be
10! = 3,628,800 unique permutation combinations. These need to be pruned
in advance through query optimization to avoid excessive memory
consumption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.1.10-merged dev/3.0.6-merged p0_b reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants