Skip to content
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

[improve](partition_topn) Add partition threshold check in hash table to control partition nums #39057

Merged
merged 10 commits into from
Sep 20, 2024

Conversation

zhangstar333
Copy link
Contributor

@zhangstar333 zhangstar333 commented Aug 7, 2024

Proposed changes

  1. Add a session variable to control partition_topn partition threshold
  2. move the partition threshold check at emplace data to hash table to control partition nums, so get check every rows.
    this could improve some bad case about 50%+ performance improvement, and some better case before, after move the check in hash table, maybe have performance degradation almost 10%, I think this is within the acceptable result。

@doris-robot
Copy link

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

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

github-actions bot commented Aug 7, 2024

clang-tidy review says "All clean, LGTM! 👍"

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

github-actions bot commented Aug 7, 2024

clang-tidy review says "All clean, LGTM! 👍"

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

github-actions bot commented Aug 7, 2024

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18171	4619	4323	4323
q2	2020	182	181	181
q3	10536	1144	1079	1079
q4	10153	686	756	686
q5	7520	2615	2569	2569
q6	226	138	138	138
q7	993	598	601	598
q8	9218	1971	1941	1941
q9	8840	6603	6613	6603
q10	7040	2326	2238	2238
q11	522	247	251	247
q12	394	228	229	228
q13	17766	3017	2989	2989
q14	279	244	230	230
q15	518	488	475	475
q16	504	390	388	388
q17	1008	746	721	721
q18	8314	7661	7487	7487
q19	5074	1102	958	958
q20	675	329	335	329
q21	5970	4749	4746	4746
q22	1109	1009	1028	1009
Total cold run time: 116850 ms
Total hot run time: 40163 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4565	4344	4337	4337
q2	392	271	259	259
q3	2893	2657	2636	2636
q4	1883	1692	1632	1632
q5	5306	5329	5362	5329
q6	224	134	135	134
q7	2078	1711	1686	1686
q8	3232	3356	3372	3356
q9	8560	8430	8487	8430
q10	3407	3195	3147	3147
q11	615	482	492	482
q12	800	653	614	614
q13	17422	3018	3016	3016
q14	309	268	288	268
q15	529	482	490	482
q16	463	428	425	425
q17	1805	1524	1495	1495
q18	7644	7466	7527	7466
q19	1693	1539	1567	1539
q20	2004	1812	1773	1773
q21	5354	5207	5211	5207
q22	1100	1019	1022	1019
Total cold run time: 72278 ms
Total hot run time: 54732 ms

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	19021	8213	4292	4292
q2	2022	176	178	176
q3	10598	1117	1083	1083
q4	10264	832	729	729
q5	7515	2529	2537	2529
q6	224	136	139	136
q7	968	586	608	586
q8	9237	1919	1896	1896
q9	8661	6507	6497	6497
q10	7048	2262	2207	2207
q11	475	250	253	250
q12	394	222	214	214
q13	17794	2991	2985	2985
q14	289	232	237	232
q15	524	504	479	479
q16	523	398	389	389
q17	965	643	722	643
q18	8167	7367	7353	7353
q19	3785	971	960	960
q20	670	337	313	313
q21	5377	4503	4607	4503
q22	1121	1013	1021	1013
Total cold run time: 115642 ms
Total hot run time: 39465 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4455	4246	4252	4246
q2	381	275	261	261
q3	2879	2742	2773	2742
q4	2036	1688	1706	1688
q5	5585	5519	5494	5494
q6	226	142	132	132
q7	2138	1780	1762	1762
q8	3212	3432	3434	3432
q9	8759	8765	8817	8765
q10	3544	3290	3181	3181
q11	589	501	495	495
q12	824	666	645	645
q13	16926	3200	3160	3160
q14	323	300	288	288
q15	526	503	482	482
q16	502	439	434	434
q17	1827	1539	1518	1518
q18	8097	8033	7903	7903
q19	1754	1619	1504	1504
q20	2106	1877	1867	1867
q21	9290	5258	5306	5258
q22	1157	1032	1062	1032
Total cold run time: 77136 ms
Total hot run time: 56289 ms

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

github-actions bot commented Aug 9, 2024

clang-tidy review says "All clean, LGTM! 👍"

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18137	4739	4320	4320
q2	2034	183	178	178
q3	11498	1036	1181	1036
q4	10507	698	692	692
q5	7770	2887	2798	2798
q6	225	142	144	142
q7	986	600	596	596
q8	9335	2068	2103	2068
q9	8875	6578	6552	6552
q10	7033	2258	2146	2146
q11	445	244	251	244
q12	403	230	223	223
q13	17761	3012	3014	3012
q14	286	243	230	230
q15	522	483	497	483
q16	495	399	389	389
q17	1027	789	727	727
q18	8190	7500	7327	7327
q19	5993	1044	1001	1001
q20	701	325	350	325
q21	5799	4599	4631	4599
q22	1134	1073	1040	1040
Total cold run time: 119156 ms
Total hot run time: 40128 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4455	4248	4256	4248
q2	366	274	256	256
q3	2905	2788	2786	2786
q4	1975	1823	1786	1786
q5	5585	5596	5561	5561
q6	231	139	131	131
q7	2197	1806	1768	1768
q8	3362	3473	3445	3445
q9	8941	8979	8863	8863
q10	3471	3190	3253	3190
q11	639	505	522	505
q12	802	672	656	656
q13	16018	3234	3145	3145
q14	317	294	286	286
q15	531	481	499	481
q16	490	451	433	433
q17	1828	1561	1528	1528
q18	8208	7894	7837	7837
q19	4224	1768	1692	1692
q20	2177	1886	1874	1874
q21	5677	5470	5289	5289
q22	1132	1079	1036	1036
Total cold run time: 75531 ms
Total hot run time: 56796 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 189905 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 6a24f85eba97ed7986f020d429a12b585017dbbe, data reload: false

query1	1246	892	877	877
query2	6455	1882	1906	1882
query3	10600	3864	3545	3545
query4	58337	24428	23320	23320
query5	5734	514	473	473
query6	492	161	161	161
query7	6474	291	307	291
query8	301	202	197	197
query9	8875	2461	2451	2451
query10	495	267	267	267
query11	18110	15049	15163	15049
query12	160	100	106	100
query13	1657	379	394	379
query14	12387	7830	7158	7158
query15	254	176	173	173
query16	7649	509	483	483
query17	1116	576	563	563
query18	2046	292	299	292
query19	291	153	143	143
query20	112	111	109	109
query21	211	115	107	107
query22	4588	4258	4374	4258
query23	34240	33341	33239	33239
query24	5516	2868	2822	2822
query25	541	417	373	373
query26	677	158	156	156
query27	1786	271	285	271
query28	4029	2064	2052	2052
query29	690	408	411	408
query30	233	147	154	147
query31	918	716	714	714
query32	77	52	53	52
query33	452	281	278	278
query34	861	468	470	468
query35	799	701	725	701
query36	1062	933	938	933
query37	133	77	81	77
query38	3891	3801	3763	3763
query39	1428	1367	1380	1367
query40	197	124	119	119
query41	49	46	45	45
query42	118	98	100	98
query43	505	462	461	461
query44	1092	742	724	724
query45	195	168	164	164
query46	1084	764	771	764
query47	1857	1764	1760	1760
query48	365	298	303	298
query49	762	434	434	434
query50	803	405	418	405
query51	6754	6667	6754	6667
query52	106	92	100	92
query53	255	190	182	182
query54	572	462	453	453
query55	82	76	77	76
query56	283	259	259	259
query57	1122	1022	1045	1022
query58	222	231	225	225
query59	2969	2707	2814	2707
query60	315	269	271	269
query61	114	115	125	115
query62	767	644	655	644
query63	209	182	183	182
query64	3303	1810	1775	1775
query65	3229	3173	3130	3130
query66	681	331	341	331
query67	15224	14901	14801	14801
query68	4879	564	544	544
query69	457	279	276	276
query70	1153	1128	1111	1111
query71	462	284	279	279
query72	7245	2416	2211	2211
query73	768	335	330	330
query74	9096	8687	8738	8687
query75	3466	2678	2708	2678
query76	2720	974	937	937
query77	558	319	320	319
query78	9749	8939	8939	8939
query79	8313	535	535	535
query80	2006	490	500	490
query81	556	229	223	223
query82	1363	134	136	134
query83	261	149	144	144
query84	270	77	78	77
query85	1530	309	267	267
query86	435	269	302	269
query87	4351	4182	4161	4161
query88	4719	2486	2503	2486
query89	567	291	276	276
query90	2036	205	196	196
query91	122	98	97	97
query92	63	48	48	48
query93	6751	543	540	540
query94	836	275	280	275
query95	337	259	262	259
query96	628	271	277	271
query97	3231	3053	3065	3053
query98	217	204	194	194
query99	1629	1298	1312	1298
Total cold run time: 328931 ms
Total hot run time: 189905 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.04
query2	0.07	0.03	0.04
query3	0.22	0.06	0.06
query4	1.65	0.08	0.09
query5	0.51	0.49	0.49
query6	1.14	0.72	0.73
query7	0.02	0.01	0.01
query8	0.05	0.05	0.04
query9	0.56	0.52	0.49
query10	0.55	0.53	0.54
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.60	0.60	0.58
query14	0.77	0.77	0.79
query15	0.84	0.82	0.81
query16	0.37	0.37	0.37
query17	0.95	0.99	1.00
query18	0.22	0.22	0.21
query19	1.80	1.71	1.72
query20	0.01	0.01	0.00
query21	15.42	0.74	0.65
query22	4.20	7.78	1.47
query23	18.33	1.32	1.22
query24	2.13	0.22	0.21
query25	0.16	0.08	0.08
query26	0.30	0.21	0.21
query27	0.46	0.23	0.22
query28	13.40	1.01	0.99
query29	12.57	3.35	3.26
query30	0.23	0.06	0.06
query31	2.89	0.38	0.38
query32	3.29	0.50	0.47
query33	2.93	2.87	3.03
query34	16.94	4.32	4.34
query35	4.43	4.39	4.38
query36	0.66	0.45	0.48
query37	0.18	0.17	0.15
query38	0.16	0.15	0.15
query39	0.05	0.03	0.04
query40	0.15	0.12	0.12
query41	0.09	0.04	0.05
query42	0.07	0.04	0.05
query43	0.05	0.04	0.03
Total cold run time: 109.77 s
Total hot run time: 29.96 s

@zhangstar333 zhangstar333 force-pushed the add_session_partition_topn branch 2 times, most recently from 345ebcd to 8259137 Compare August 23, 2024 02:28
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@zhangstar333 zhangstar333 changed the title [improve](partition_topn) Add a session variable to control parition_topn parition threshold [improve](partition_topn) Add partition threshold check in hash table to control partition nums Aug 23, 2024
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@zhangstar333
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.33% (9581/25669)
Line Coverage: 28.70% (79186/275918)
Region Coverage: 28.19% (41007/145479)
Branch Coverage: 24.80% (20892/84232)
Coverage Report: http://coverage.selectdb-in.cc/coverage/5b9de17a073456f606cbf101c77e348602e517e0_5b9de17a073456f606cbf101c77e348602e517e0/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17956	7495	7345	7345
q2	2056	163	168	163
q3	10656	1120	1226	1120
q4	10306	799	673	673
q5	7768	3065	3100	3065
q6	234	152	150	150
q7	1030	627	605	605
q8	9425	2057	2066	2057
q9	6840	6422	6444	6422
q10	6994	2351	2283	2283
q11	428	240	248	240
q12	409	220	217	217
q13	17776	3022	2977	2977
q14	233	212	224	212
q15	576	514	530	514
q16	695	640	621	621
q17	989	815	823	815
q18	7397	6730	6795	6730
q19	1422	1034	1047	1034
q20	591	284	291	284
q21	3990	3248	3303	3248
q22	1099	996	1020	996
Total cold run time: 108870 ms
Total hot run time: 41771 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7294	7203	7220	7203
q2	322	234	228	228
q3	3028	2985	2944	2944
q4	2049	1837	1827	1827
q5	5612	5636	5699	5636
q6	228	146	150	146
q7	2196	1766	1767	1766
q8	3334	3450	3458	3450
q9	8760	8937	8789	8789
q10	3487	3376	3489	3376
q11	588	489	484	484
q12	834	619	608	608
q13	9525	3131	3170	3131
q14	289	294	272	272
q15	564	532	529	529
q16	729	676	663	663
q17	1838	1609	1580	1580
q18	8303	7787	7774	7774
q19	1755	1589	1505	1505
q20	2083	1905	1919	1905
q21	5667	5293	5460	5293
q22	1161	1081	1060	1060
Total cold run time: 69646 ms
Total hot run time: 60169 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 198489 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 5b9de17a073456f606cbf101c77e348602e517e0, data reload: false

query1	1299	882	935	882
query2	6394	2002	2027	2002
query3	10819	3910	3905	3905
query4	64479	29285	23435	23435
query5	5016	486	444	444
query6	404	166	162	162
query7	5456	312	299	299
query8	301	210	223	210
query9	8461	2652	2650	2650
query10	443	299	263	263
query11	17163	15170	15831	15170
query12	148	110	102	102
query13	1459	435	413	413
query14	10784	7196	7529	7196
query15	206	174	186	174
query16	6763	494	477	477
query17	1220	614	579	579
query18	1562	312	325	312
query19	210	150	145	145
query20	128	108	108	108
query21	218	101	105	101
query22	4843	4544	4598	4544
query23	34747	34011	33863	33863
query24	5995	2944	2852	2852
query25	482	381	392	381
query26	629	152	154	152
query27	1634	284	279	279
query28	4136	2471	2434	2434
query29	651	397	399	397
query30	226	156	152	152
query31	932	760	792	760
query32	70	53	51	51
query33	403	289	281	281
query34	920	493	477	477
query35	846	720	720	720
query36	1066	957	959	957
query37	146	87	85	85
query38	4035	3922	3911	3911
query39	1441	1387	1376	1376
query40	200	92	90	90
query41	46	46	46	46
query42	117	99	95	95
query43	532	479	480	479
query44	1158	820	796	796
query45	191	159	158	158
query46	1115	749	775	749
query47	1946	1825	1861	1825
query48	449	351	353	351
query49	696	387	378	378
query50	839	395	396	395
query51	7034	6867	6907	6867
query52	97	81	84	81
query53	245	181	177	177
query54	552	440	461	440
query55	78	72	72	72
query56	251	248	252	248
query57	1240	1083	1082	1082
query58	215	222	219	219
query59	3071	2891	3112	2891
query60	283	267	259	259
query61	122	99	98	98
query62	761	648	642	642
query63	219	188	183	183
query64	1343	723	654	654
query65	3219	3161	3202	3161
query66	618	306	300	300
query67	15938	15775	15490	15490
query68	1250	568	569	568
query69	445	277	284	277
query70	1180	1136	1067	1067
query71	327	265	266	265
query72	5089	3977	3910	3910
query73	753	321	327	321
query74	9266	8988	9005	8988
query75	3311	2644	2730	2644
query76	1297	852	865	852
query77	412	302	310	302
query78	9996	9555	9360	9360
query79	1316	902	877	877
query80	913	583	567	567
query81	535	253	256	253
query82	1292	226	238	226
query83	235	155	160	155
query84	287	101	101	101
query85	742	424	373	373
query86	339	323	314	314
query87	4350	4353	4352	4352
query88	4507	4103	4076	4076
query89	397	364	363	363
query90	1702	309	308	308
query91	162	167	164	164
query92	74	72	72	72
query93	949	903	902	902
query94	681	356	358	356
query95	446	415	414	414
query96	493	490	479	479
query97	3175	3141	3171	3141
query98	226	238	231	231
query99	1486	1284	1301	1284
Total cold run time: 306343 ms
Total hot run time: 198489 ms

@doris-robot
Copy link

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

query1	0.04	0.05	0.04
query2	0.07	0.04	0.03
query3	0.22	0.06	0.05
query4	1.67	0.08	0.08
query5	0.50	0.49	0.51
query6	1.14	0.74	0.74
query7	0.02	0.02	0.02
query8	0.06	0.05	0.05
query9	0.55	0.51	0.50
query10	0.55	0.57	0.54
query11	0.17	0.12	0.12
query12	0.15	0.13	0.13
query13	0.62	0.60	0.59
query14	3.08	3.00	2.99
query15	0.88	0.83	0.83
query16	0.37	0.37	0.39
query17	0.98	0.99	1.08
query18	0.18	0.18	0.20
query19	1.94	1.92	1.97
query20	0.02	0.01	0.00
query21	15.37	0.69	0.68
query22	3.43	7.64	2.28
query23	18.31	1.38	1.29
query24	2.12	0.25	0.23
query25	0.16	0.08	0.08
query26	0.28	0.19	0.18
query27	0.07	0.08	0.09
query28	13.22	1.15	1.15
query29	12.69	3.44	3.44
query30	0.25	0.06	0.05
query31	2.86	0.41	0.40
query32	3.26	0.48	0.48
query33	2.98	3.03	2.98
query34	17.12	4.44	4.41
query35	4.48	4.51	4.48
query36	0.66	0.47	0.48
query37	0.19	0.16	0.15
query38	0.15	0.15	0.14
query39	0.05	0.04	0.04
query40	0.15	0.13	0.14
query41	0.09	0.05	0.06
query42	0.07	0.05	0.04
query43	0.05	0.04	0.05
Total cold run time: 111.22 s
Total hot run time: 33.93 s

Copy link
Contributor

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

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Sep 20, 2024
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

@zhangstar333 zhangstar333 merged commit 51ba957 into apache:master Sep 20, 2024
25 of 30 checks passed
dataroaring pushed a commit that referenced this pull request Oct 9, 2024
… to control partition nums (#39057)

## Proposed changes
1.  Add a session variable to control partition_topn partition threshold
2. move the partition threshold check at emplace data to hash table to
control partition nums, so get check every rows.
this could improve some bad case about 50%+ performance improvement, and
some better case before, after move the check in hash table, maybe have
performance degradation almost 10%, I think this is within the
acceptable result。

<!--Describe your changes.-->
zhangstar333 added a commit to zhangstar333/incubator-doris that referenced this pull request Oct 16, 2024
… to control partition nums (apache#39057)

1.  Add a session variable to control partition_topn partition threshold
2. move the partition threshold check at emplace data to hash table to
control partition nums, so get check every rows.
this could improve some bad case about 50%+ performance improvement, and
some better case before, after move the check in hash table, maybe have
performance degradation almost 10%, I think this is within the
acceptable result。

<!--Describe your changes.-->
yiguolei pushed a commit that referenced this pull request Oct 17, 2024
## Proposed changes

pick from master (#39057) (#41352)

<!--Describe your changes.-->

---------

Co-authored-by: Mryange <59914473+Mryange@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants