Skip to content

[feature-WIP](query cache) cache tablets aggregate result, BE part (#40171)#42375

Merged
HappenLee merged 1 commit intoapache:branch-3.0from
HappenLee:branch-3.0
Oct 24, 2024
Merged

[feature-WIP](query cache) cache tablets aggregate result, BE part (#40171)#42375
HappenLee merged 1 commit intoapache:branch-3.0from
HappenLee:branch-3.0

Conversation

@HappenLee
Copy link
Contributor

support cache tablets aggregate result

for example

SQL 1:

select key, sum(value)
from tbl
where dt between '2024-08-01' and '2024-08-10'
group by key

SQL 2:

select key, sum(value)
from tbl
where dt between '2024-08-5' and '2024-08-15'
group by key

SQL 1 will update the tablets aggregate result which partition between '2024-08-01' and '2024-08-10'.
Then SQL 2 will reuse the tablets aggregate which partition between '2024-08-05' and '2024-08-10', and compute aggregate which partition between '2024-08-11' and '2024-08-15'

We only support simple aggregate which not contains join with runtime filter, at present.

set enable_query_cache=true;

@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.

@HappenLee
Copy link
Contributor Author

run buildall

@HappenLee HappenLee force-pushed the branch-3.0 branch 2 times, most recently from 88cb8c9 to c8dea90 Compare October 24, 2024 07:16
@HappenLee
Copy link
Contributor Author

run buildall

@HappenLee HappenLee force-pushed the branch-3.0 branch 2 times, most recently from a00c284 to 20e8ae4 Compare October 24, 2024 08:31
…pache#40171)

    support cache tablets aggregate result

    for example

    SQL 1:
    ```sql
    select key, sum(value)
    from tbl
    where dt between '2024-08-01' and '2024-08-10'
    group by key
    ```

    SQL 2:
    ```sql
    select key, sum(value)
    from tbl
    where dt between '2024-08-5' and '2024-08-15'
    group by key
    ```

    SQL 1 will update the tablets aggregate result which partition between
    '2024-08-01' and '2024-08-10'.
    Then SQL 2 will reuse the tablets aggregate which partition between
    '2024-08-05' and '2024-08-10', and compute aggregate which partition
    between '2024-08-11' and '2024-08-15'

    We only support simple aggregate which not contains join with runtime
    filter, at present.

    ```sql
    set enable_query_cache=true;
    ```
@HappenLee
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17937	7499	7299	7299
q2	2046	150	162	150
q3	10659	1106	1139	1106
q4	10273	713	787	713
q5	7771	2800	2801	2800
q6	240	150	146	146
q7	963	602	606	602
q8	9340	1917	1892	1892
q9	6607	6416	6410	6410
q10	6959	2301	2322	2301
q11	444	245	246	245
q12	420	215	217	215
q13	17779	2969	2979	2969
q14	244	209	208	208
q15	556	499	524	499
q16	670	581	603	581
q17	1001	643	564	564
q18	7418	6822	6587	6587
q19	4489	1020	1033	1020
q20	515	191	202	191
q21	3943	3141	3233	3141
q22	1097	975	980	975
Total cold run time: 111371 ms
Total hot run time: 40614 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7445	7613	7285	7285
q2	324	240	223	223
q3	2860	2720	2720	2720
q4	1890	1673	1715	1673
q5	5389	5435	5439	5435
q6	230	148	143	143
q7	2039	1659	1669	1659
q8	3216	3387	3343	3343
q9	8521	8495	8485	8485
q10	3440	3421	3418	3418
q11	583	478	482	478
q12	747	560	581	560
q13	16867	2972	2997	2972
q14	281	254	265	254
q15	544	507	497	497
q16	705	668	667	667
q17	1829	1562	1550	1550
q18	7699	7312	7328	7312
q19	1636	1505	1450	1450
q20	2004	1826	1782	1782
q21	5164	5325	5115	5115
q22	1085	978	956	956
Total cold run time: 74498 ms
Total hot run time: 57977 ms

@doris-robot
Copy link

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

query1	976	383	360	360
query2	6507	2086	1981	1981
query3	6707	224	229	224
query4	36441	23346	23340	23340
query5	4368	464	464	464
query6	265	175	192	175
query7	4628	303	301	301
query8	258	205	230	205
query9	9548	2679	2673	2673
query10	462	281	273	273
query11	18101	15109	15226	15109
query12	148	109	94	94
query13	1615	404	406	404
query14	9777	6718	7102	6718
query15	227	173	167	167
query16	7914	469	467	467
query17	1585	554	546	546
query18	2032	292	292	292
query19	198	145	135	135
query20	117	108	104	104
query21	209	103	104	103
query22	4473	4503	4473	4473
query23	34597	34383	33906	33906
query24	12126	2767	2749	2749
query25	696	372	381	372
query26	1790	162	161	161
query27	2975	298	303	298
query28	8075	2486	2470	2470
query29	1061	415	419	415
query30	323	156	150	150
query31	1016	765	810	765
query32	98	55	54	54
query33	780	284	284	284
query34	1000	489	490	489
query35	893	721	737	721
query36	1091	930	923	923
query37	285	85	85	85
query38	3927	3873	3792	3792
query39	1470	1453	1414	1414
query40	287	95	94	94
query41	52	47	49	47
query42	115	96	95	95
query43	516	494	489	489
query44	1264	754	760	754
query45	197	163	160	160
query46	1135	733	760	733
query47	1880	1813	1855	1813
query48	460	370	364	364
query49	1235	385	377	377
query50	802	403	398	398
query51	7024	6917	6865	6865
query52	94	93	87	87
query53	255	190	185	185
query54	1232	467	446	446
query55	82	77	75	75
query56	271	241	243	241
query57	1215	1083	1112	1083
query58	254	228	228	228
query59	3122	2947	2908	2908
query60	281	267	262	262
query61	110	100	102	100
query62	857	657	682	657
query63	217	190	178	178
query64	5290	638	606	606
query65	3266	3200	3165	3165
query66	1414	302	320	302
query67	15696	15330	15355	15330
query68	3526	551	567	551
query69	442	284	295	284
query70	1124	1110	1127	1110
query71	332	277	272	272
query72	6116	4103	4041	4041
query73	750	334	343	334
query74	9807	8918	8877	8877
query75	3401	2599	2645	2599
query76	2472	880	890	880
query77	478	328	325	325
query78	10518	9529	9505	9505
query79	6964	579	580	579
query80	2809	463	467	463
query81	590	241	255	241
query82	1026	142	143	142
query83	325	143	143	143
query84	262	80	83	80
query85	2216	341	333	333
query86	506	311	290	290
query87	4547	4195	4306	4195
query88	5538	2410	2376	2376
query89	405	286	283	283
query90	1905	181	182	181
query91	174	138	138	138
query92	74	50	46	46
query93	4725	535	528	528
query94	955	270	277	270
query95	347	241	251	241
query96	631	277	278	277
query97	3353	3161	3153	3153
query98	210	200	202	200
query99	1696	1258	1272	1258
Total cold run time: 315606 ms
Total hot run time: 189893 ms

@HappenLee HappenLee merged commit e993b6a into apache:branch-3.0 Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants