Skip to content

[improvement](catalog) avoid loading every table for SHOW TABLES on external catalogs - #66080

Merged
morningman merged 7 commits into
apache:masterfrom
Baymine:improvement/show-tables-external-perf
Aug 11, 2026
Merged

[improvement](catalog) avoid loading every table for SHOW TABLES on external catalogs#66080
morningman merged 7 commits into
apache:masterfrom
Baymine:improvement/show-tables-external-perf

Conversation

@Baymine

@Baymine Baymine commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #66079

Problem Summary:

SHOW TABLES on an external catalog iterated dbIf.getTables(), which
eagerly initializes every table via the meta cache (one getTableNullable()
-> remote metadata load per table). For catalogs with many tables this turned
a cheap name listing into N remote loads.

This adds a fast path for the common case only -- a non-verbose SHOW TABLES
on an external catalog -- that lists names via
dbIf.getTableNamesOrEmptyWithLock() without initializing any table. The
per-table SHOW privilege filter is preserved (it is name-based and needs no
table load), so no table name is leaked to a user who lacks SHOW on it.

Everything else keeps the original getTables() loop unchanged:

  • Internal-catalog SHOW TABLES / SHOW FULL TABLES.
  • External-catalog SHOW FULL TABLES (verbose): it still needs getMysqlType()
    and the storage-format columns, so it takes the original path and its
    4-column output (Table_type, Storage_format,
    Inverted_index_storage_format) is unchanged.
  • SHOW VIEWS (needs getEngine() to filter views) and SHOW STREAMS.

Release note

None (performance optimization; SHOW TABLES output for accessible tables is
unchanged, SHOW FULL TABLES / SHOW VIEWS are unaffected).

Check List (For Author)

  • Test:
    • Manual test on a live cluster with an HMS catalog: SHOW TABLES and
      SHOW TABLES LIKE list names via the fast path; SHOW FULL TABLES
      returns the correct 4 columns (name, Table_type, Storage_format,
      Inverted_index_storage_format) with no column mismatch.
    • Ran existing ShowTableCommandTest (2 passed); FE build (build.sh --fe)
      • checkstyle green.
    • No new unit test: exercising the external-catalog branch needs an
      ExternalCatalog with a working getTableNamesOrEmptyWithLock(), which is
      not available in the FE unit-test harness; a portable regression .out
      needs the docker HMS test environment.
  • Behavior changed: No material change (a non-loadable external table's name is
    now listed by SHOW TABLES where the old path silently omitted it on load
    failure, which is arguably more correct).
  • Does this need documentation: No

…xternal catalogs

### What problem does this PR solve?

Issue Number: close apache#66079

Problem Summary:

`SHOW TABLES` on an external catalog iterated `dbIf.getTables()`, which
eagerly initializes every table via the meta cache (one `getTableNullable()`
-> remote metadata load per table). For catalogs with many tables this turned
a cheap name listing into N remote loads.

This adds a fast path for the common case only -- a non-verbose `SHOW TABLES`
on an external catalog -- that lists names via
`dbIf.getTableNamesOrEmptyWithLock()` without initializing any table. The
per-table `SHOW` privilege filter is preserved (it is name-based and needs no
table load), so no table name is leaked to a user who lacks `SHOW` on it.

Everything else keeps the original `getTables()` loop unchanged:
- Internal-catalog `SHOW TABLES` / `SHOW FULL TABLES`.
- External-catalog `SHOW FULL TABLES` (verbose): it still needs `getMysqlType()`
  and the storage-format columns, so it takes the original path and its
  4-column output (`Table_type`, `Storage_format`,
  `Inverted_index_storage_format`) is unchanged.
- `SHOW VIEWS` (needs `getEngine()` to filter views) and `SHOW STREAMS`.

### Release note

None (performance optimization; `SHOW TABLES` output for accessible tables is
unchanged, `SHOW FULL TABLES` / `SHOW VIEWS` are unaffected).

### Check List (For Author)

- Test:
    - Manual test on a live cluster with an HMS catalog: `SHOW TABLES` and
      `SHOW TABLES LIKE` list names via the fast path; `SHOW FULL TABLES`
      returns the correct 4 columns (name, `Table_type`, `Storage_format`,
      `Inverted_index_storage_format`) with no column mismatch.
    - Ran existing `ShowTableCommandTest`; FE build (`build.sh --fe`) +
      checkstyle green.
    - No new unit test: exercising the external-catalog branch needs an
      ExternalCatalog with a working `getTableNamesOrEmptyWithLock()`, which is
      not available in the FE unit-test harness; a portable regression `.out`
      needs the docker HMS test environment.
- Behavior changed: No material change (a non-loadable external table's name is
  now listed by `SHOW TABLES` where the old path silently omitted it on load
  failure, which is arguably more correct).
- Does this need documentation: No
@hello-stephen

Copy link
Copy Markdown
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?

@Baymine

Baymine commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 60.00% (6/10) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17639	4070	4127	4070
q2	2030	343	202	202
q3	10249	1437	815	815
q4	4681	474	335	335
q5	7502	863	555	555
q6	186	173	139	139
q7	784	817	607	607
q8	9317	1505	1487	1487
q9	5510	4353	4379	4353
q10	6739	1764	1474	1474
q11	514	361	328	328
q12	710	581	459	459
q13	18092	3537	2675	2675
q14	261	259	247	247
q15	q16	779	771	709	709
q17	972	981	1025	981
q18	6988	5789	5514	5514
q19	1374	1363	1136	1136
q20	825	690	557	557
q21	5938	2571	2456	2456
q22	439	350	293	293
Total cold run time: 101529 ms
Total hot run time: 29392 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4403	4284	4307	4284
q2	287	326	218	218
q3	4552	4936	4438	4438
q4	2053	2146	1376	1376
q5	4384	4267	4259	4259
q6	225	175	126	126
q7	1773	1617	2055	1617
q8	2602	2180	2205	2180
q9	7907	8136	7894	7894
q10	4698	4612	4152	4152
q11	574	420	400	400
q12	792	779	550	550
q13	3274	3608	2959	2959
q14	299	314	277	277
q15	q16	723	776	642	642
q17	1350	1328	1309	1309
q18	7975	7225	7213	7213
q19	1159	1127	1084	1084
q20	2185	2188	1936	1936
q21	5209	4570	4474	4474
q22	505	450	416	416
Total cold run time: 56929 ms
Total hot run time: 51804 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 177307 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 0e95d71f26bb37fe48d141c79d427ab1a77ee93d, data reload: false

query5	4314	650	487	487
query6	482	221	220	220
query7	4850	574	326	326
query8	341	186	167	167
query9	8769	4007	3955	3955
query10	471	374	310	310
query11	5874	2325	2104	2104
query12	163	104	105	104
query13	1251	591	408	408
query14	6219	5195	4874	4874
query14_1	4227	4209	4208	4208
query15	219	206	179	179
query16	1019	455	460	455
query17	1165	725	570	570
query18	2459	465	356	356
query19	209	188	152	152
query20	112	107	107	107
query21	236	162	136	136
query22	13479	13682	13266	13266
query23	17292	16441	16131	16131
query23_1	16241	16357	16213	16213
query24	7617	1754	1284	1284
query24_1	1291	1276	1284	1276
query25	569	470	394	394
query26	1315	358	230	230
query27	2594	641	372	372
query28	4435	1962	1933	1933
query29	1083	627	490	490
query30	349	268	225	225
query31	1132	1095	977	977
query32	111	65	68	65
query33	535	326	253	253
query34	1185	1098	677	677
query35	766	782	670	670
query36	1223	1176	1024	1024
query37	156	107	95	95
query38	1879	1701	1642	1642
query39	909	868	843	843
query39_1	833	841	824	824
query40	260	170	149	149
query41	64	61	62	61
query42	98	92	90	90
query43	322	325	274	274
query44	1403	759	744	744
query45	193	185	177	177
query46	1072	1237	712	712
query47	2193	2119	2002	2002
query48	406	428	286	286
query49	580	414	298	298
query50	1084	418	320	320
query51	11115	11037	10768	10768
query52	87	85	75	75
query53	261	266	205	205
query54	276	228	247	228
query55	74	70	64	64
query56	304	298	283	283
query57	1321	1304	1217	1217
query58	278	266	255	255
query59	1552	1660	1406	1406
query60	306	279	244	244
query61	145	147	150	147
query62	560	498	427	427
query63	240	201	197	197
query64	2835	1053	889	889
query65	4711	4633	4622	4622
query66	1823	516	382	382
query67	29249	29156	29003	29003
query68	3136	1659	985	985
query69	394	299	258	258
query70	1066	962	903	903
query71	363	343	326	326
query72	2997	2687	2337	2337
query73	853	749	431	431
query74	5030	4890	4693	4693
query75	2530	2487	2131	2131
query76	2327	1156	763	763
query77	345	371	275	275
query78	11871	11692	11526	11526
query79	1391	1163	711	711
query80	1190	549	474	474
query81	551	334	286	286
query82	586	154	120	120
query83	409	319	297	297
query84	282	162	130	130
query85	1021	619	518	518
query86	454	293	276	276
query87	1852	1812	1749	1749
query88	3668	2767	2745	2745
query89	431	385	318	318
query90	1896	194	192	192
query91	206	190	163	163
query92	65	58	52	52
query93	1623	1570	940	940
query94	653	336	291	291
query95	764	572	485	485
query96	1037	856	358	358
query97	2631	2598	2499	2499
query98	209	207	207	207
query99	1075	1120	979	979
Total cold run time: 263411 ms
Total hot run time: 177307 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.25 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 0e95d71f26bb37fe48d141c79d427ab1a77ee93d, data reload: false

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.25	0.14	0.13
query4	1.62	0.14	0.15
query5	0.24	0.23	0.24
query6	1.23	1.06	1.09
query7	0.05	0.01	0.00
query8	0.06	0.04	0.04
query9	0.40	0.32	0.33
query10	0.58	0.61	0.57
query11	0.19	0.14	0.13
query12	0.19	0.14	0.14
query13	0.47	0.47	0.49
query14	1.00	1.01	1.00
query15	0.63	0.59	0.60
query16	0.34	0.33	0.34
query17	1.10	1.10	1.08
query18	0.23	0.22	0.22
query19	2.03	1.89	1.99
query20	0.02	0.02	0.01
query21	15.43	0.23	0.14
query22	4.71	0.06	0.05
query23	16.15	0.30	0.11
query24	3.04	0.42	0.33
query25	0.11	0.04	0.04
query26	0.74	0.19	0.14
query27	0.05	0.04	0.03
query28	3.54	0.97	0.53
query29	12.48	4.19	3.33
query30	0.28	0.16	0.16
query31	2.77	0.60	0.33
query32	3.23	0.61	0.50
query33	3.16	3.26	3.31
query34	15.49	4.21	3.55
query35	3.52	3.54	3.58
query36	0.58	0.45	0.43
query37	0.10	0.07	0.07
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.19	0.15	0.15
query41	0.10	0.03	0.03
query42	0.05	0.03	0.03
query43	0.05	0.03	0.03
Total cold run time: 96.58 s
Total hot run time: 25.25 s

morrySnow
morrySnow previously approved these changes Jul 27, 2026
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

…sensitive name conflicts

### What problem does this PR solve?

Problem Summary: The fast path for non-verbose SHOW TABLES on external catalogs
used dbIf.getTableNamesOrEmptyWithLock(), which is a defensive wrapper that
catches all exceptions and returns an empty set. This swallowed the
case-insensitive name-conflict / meta_names_mapping exception (FOUND_CONFLICTING)
that is raised while listing table names in the meta cache. The previous
dbIf.getTables() path called getTableNamesWithLock() directly and propagated
that exception, so SHOW TABLES correctly reported conflicting remote table
names. As a result, external regression tests test_conflict_name and
test_meta_names_mapping failed: they expect SHOW TABLES to throw "Found
conflicting table names under case-insensitive conditions ... Please use
meta_names_mapping to handle name mapping." but the exception was silently
swallowed and an empty result was returned.

Fix: use getTableNamesWithLock() instead of getTableNamesOrEmptyWithLock().
This keeps the performance benefit of the fast path (list names only, one
remote list call, no per-table metadata load) while restoring the
name-conflict detection contract that matches the old getTables() behavior.

### Release note

None

### Check List (For Author)

- Test: Regression test (external_table_p0/lower_case/test_conflict_name, test_meta_names_mapping)
- Behavior changed: No
- Does this need documentation: No
@Baymine

Baymine commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions github-actions Bot removed the approved Indicates a PR has been approved by one committer. label Jul 28, 2026
@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17635	4184	4163	4163
q2	2052	328	201	201
q3	10239	1415	836	836
q4	4683	466	340	340
q5	7597	860	589	589
q6	179	167	138	138
q7	758	806	618	618
q8	9329	1684	1537	1537
q9	5701	4393	4391	4391
q10	6756	1758	1480	1480
q11	536	371	326	326
q12	736	572	464	464
q13	18083	3413	2783	2783
q14	276	269	245	245
q15	q16	787	784	717	717
q17	972	933	948	933
q18	7191	5693	5716	5693
q19	1299	1325	1078	1078
q20	834	699	562	562
q21	5925	2632	2563	2563
q22	422	363	303	303
Total cold run time: 101990 ms
Total hot run time: 29960 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4419	4312	4318	4312
q2	286	326	219	219
q3	4608	4934	4346	4346
q4	2086	2150	1378	1378
q5	4407	4280	4299	4280
q6	232	172	128	128
q7	1724	2124	1814	1814
q8	2584	2163	2143	2143
q9	8045	8206	7822	7822
q10	4720	4642	4269	4269
q11	558	410	382	382
q12	762	774	563	563
q13	3313	3649	2940	2940
q14	291	312	273	273
q15	q16	701	725	643	643
q17	1363	1322	1345	1322
q18	7942	7241	7192	7192
q19	1175	1155	1155	1155
q20	2197	2194	1937	1937
q21	5242	4569	4392	4392
q22	500	457	387	387
Total cold run time: 57155 ms
Total hot run time: 51897 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 177540 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 6f1500906f20e08cb202365f17eacf936f8f6983, data reload: false

query5	4313	626	472	472
query6	465	223	225	223
query7	4849	584	370	370
query8	336	183	172	172
query9	8789	4055	4021	4021
query10	483	351	313	313
query11	5961	2299	2127	2127
query12	160	108	105	105
query13	1307	588	414	414
query14	6237	5204	4910	4910
query14_1	4222	4198	4248	4198
query15	218	204	179	179
query16	1055	523	466	466
query17	1152	730	587	587
query18	2655	478	356	356
query19	221	194	198	194
query20	120	107	106	106
query21	227	155	135	135
query22	13580	13445	13267	13267
query23	17384	16552	16145	16145
query23_1	16227	16297	16116	16116
query24	7440	1739	1279	1279
query24_1	1309	1282	1269	1269
query25	531	431	361	361
query26	1317	380	218	218
query27	2535	585	379	379
query28	4390	1938	1954	1938
query29	1041	596	468	468
query30	336	265	224	224
query31	1118	1084	971	971
query32	115	62	59	59
query33	505	310	249	249
query34	1171	1118	620	620
query35	749	793	657	657
query36	1003	1026	891	891
query37	159	112	91	91
query38	1875	1710	1680	1680
query39	881	887	847	847
query39_1	824	813	831	813
query40	246	160	144	144
query41	66	64	62	62
query42	92	91	87	87
query43	320	325	271	271
query44	1403	766	743	743
query45	197	185	181	181
query46	1058	1203	712	712
query47	2123	2092	2059	2059
query48	403	397	286	286
query49	580	427	314	314
query50	1047	441	331	331
query51	10699	10662	10697	10662
query52	84	84	75	75
query53	260	281	203	203
query54	275	227	216	216
query55	72	67	63	63
query56	292	296	292	292
query57	1329	1297	1183	1183
query58	290	257	255	255
query59	1559	1606	1411	1411
query60	315	264	259	259
query61	157	159	153	153
query62	542	489	434	434
query63	253	199	198	198
query64	2807	1063	895	895
query65	4688	4633	4644	4633
query66	1795	500	379	379
query67	29340	29241	28940	28940
query68	3318	1619	987	987
query69	419	346	278	278
query70	911	819	790	790
query71	359	351	304	304
query72	3081	2956	2364	2364
query73	816	768	455	455
query74	5051	4896	4716	4716
query75	2563	2503	2146	2146
query76	2314	1189	759	759
query77	347	386	286	286
query78	11941	11733	11365	11365
query79	1260	1169	737	737
query80	607	558	459	459
query81	445	333	289	289
query82	229	155	122	122
query83	331	323	294	294
query84	279	163	130	130
query85	905	602	561	561
query86	290	252	232	232
query87	1804	1825	1762	1762
query88	3633	2744	2738	2738
query89	396	369	325	325
query90	2176	201	191	191
query91	204	193	167	167
query92	64	62	55	55
query93	1571	1452	1059	1059
query94	551	364	317	317
query95	792	623	482	482
query96	1050	767	384	384
query97	2615	2596	2506	2506
query98	212	207	200	200
query99	1085	1106	961	961
Total cold run time: 261505 ms
Total hot run time: 177540 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.11	0.05	0.05
query3	0.26	0.14	0.14
query4	1.62	0.13	0.14
query5	0.23	0.22	0.22
query6	1.25	1.04	1.08
query7	0.04	0.01	0.00
query8	0.06	0.04	0.03
query9	0.38	0.33	0.31
query10	0.54	0.53	0.54
query11	0.19	0.15	0.13
query12	0.18	0.14	0.13
query13	0.47	0.48	0.46
query14	1.01	0.99	1.00
query15	0.62	0.59	0.59
query16	0.30	0.32	0.33
query17	1.05	1.06	1.11
query18	0.23	0.21	0.21
query19	2.06	1.97	1.99
query20	0.02	0.01	0.01
query21	15.47	0.20	0.14
query22	4.99	0.06	0.05
query23	16.10	0.31	0.12
query24	2.95	0.42	0.33
query25	0.11	0.05	0.05
query26	0.73	0.20	0.15
query27	0.05	0.03	0.04
query28	3.50	0.91	0.56
query29	12.49	4.02	3.26
query30	0.28	0.17	0.15
query31	2.77	0.59	0.31
query32	3.21	0.58	0.49
query33	3.12	3.20	3.15
query34	15.59	4.22	3.54
query35	3.54	3.52	3.51
query36	0.55	0.44	0.41
query37	0.09	0.07	0.06
query38	0.05	0.03	0.04
query39	0.04	0.03	0.03
query40	0.19	0.16	0.15
query41	0.08	0.03	0.03
query42	0.04	0.03	0.04
query43	0.04	0.03	0.04
Total cold run time: 96.61 s
Total hot run time: 24.94 s

morningman
morningman previously approved these changes Aug 3, 2026
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

…al catalogs

Cover the SHOW TABLES fast path added in apache#66080:
- plain SHOW TABLES on an external catalog lists names via
  getTableNamesWithLock() and never initializes table objects
- LIKE pattern and SHOW privilege filters still apply on the fast path
- name-listing failures (case-insensitive name conflicts) propagate
  instead of being swallowed into an empty result
- SHOW FULL TABLES / SHOW VIEWS / internal catalog keep iterating
  table objects (temporary tables still hidden)
@u70b3

u70b3 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Unit tests are ready for your review: Baymine#1 — 7 cases covering the fast path, LIKE/privilege filters, conflict-error propagation, and the unchanged verbose/view/internal paths. All pass against your branch; merge it if you'd like them included here.

@github-actions github-actions Bot removed the approved Indicates a PR has been approved by one committer. label Aug 4, 2026
@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17666	4163	4136	4136
q2	2011	339	214	214
q3	10249	1458	796	796
q4	4679	474	337	337
q5	7502	835	545	545
q6	177	190	136	136
q7	738	805	589	589
q8	9330	1560	1525	1525
q9	5287	4098	4019	4019
q10	6729	1644	1380	1380
q11	499	359	336	336
q12	725	579	468	468
q13	18110	3321	2829	2829
q14	273	262	245	245
q15	q16	740	728	663	663
q17	928	872	994	872
q18	6673	5662	5550	5550
q19	1344	1186	1076	1076
q20	838	669	561	561
q21	6178	2843	2758	2758
q22	473	385	324	324
Total cold run time: 101149 ms
Total hot run time: 29359 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5136	4738	4774	4738
q2	319	332	246	246
q3	4946	5248	4640	4640
q4	2197	2243	1427	1427
q5	4792	4488	4420	4420
q6	235	171	131	131
q7	1962	1701	1487	1487
q8	2421	2110	2082	2082
q9	7152	6833	6657	6657
q10	4260	4258	3856	3856
q11	527	379	347	347
q12	696	716	504	504
q13	2985	3305	2755	2755
q14	268	282	249	249
q15	q16	671	688	612	612
q17	1253	1227	1216	1216
q18	12143	11054	11798	11054
q19	1114	1053	1099	1053
q20	2218	2185	1922	1922
q21	5356	4534	4550	4534
q22	513	482	410	410
Total cold run time: 61164 ms
Total hot run time: 54340 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 166186 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 cad2f74d1ccdf9c7a6fa2ee4a6a6132102d7904c, data reload: false

query5	4320	608	444	444
query6	472	217	202	202
query7	4863	565	347	347
query8	324	169	150	150
query9	8755	4016	4026	4016
query10	472	344	327	327
query11	5835	2248	2033	2033
query12	158	132	94	94
query13	1271	613	432	432
query14	6056	4277	3931	3931
query14_1	3755	3751	3788	3751
query15	204	195	179	179
query16	1006	438	449	438
query17	899	672	521	521
query18	2472	501	348	348
query19	213	199	148	148
query20	104	103	100	100
query21	231	154	140	140
query22	13011	13031	12817	12817
query23	15865	14976	14623	14623
query23_1	14652	14769	14611	14611
query24	7536	1712	1231	1231
query24_1	1264	1233	1241	1233
query25	564	463	391	391
query26	1320	373	227	227
query27	2549	623	392	392
query28	4576	2066	2014	2014
query29	1075	648	509	509
query30	346	270	224	224
query31	1189	1132	1075	1075
query32	112	63	63	63
query33	545	323	256	256
query34	1206	1183	645	645
query35	765	763	639	639
query36	776	791	694	694
query37	171	111	106	106
query38	1845	1783	1671	1671
query39	810	832	802	802
query39_1	799	789	827	789
query40	252	175	150	150
query41	79	70	68	68
query42	102	98	100	98
query43	316	323	279	279
query44	1504	797	794	794
query45	193	175	171	171
query46	1111	1259	719	719
query47	1557	1541	1452	1452
query48	428	406	298	298
query49	595	441	300	300
query50	1147	433	349	349
query51	10281	10658	10493	10493
query52	90	91	78	78
query53	264	291	210	210
query54	304	252	238	238
query55	80	76	68	68
query56	305	303	303	303
query57	1042	1003	968	968
query58	292	283	256	256
query59	1569	1626	1448	1448
query60	328	288	273	273
query61	176	177	207	177
query62	398	316	264	264
query63	235	198	202	198
query64	2852	1019	846	846
query65	3877	3826	3806	3806
query66	1844	525	365	365
query67	28315	27460	28005	27460
query68	3126	1503	1004	1004
query69	401	299	256	256
query70	866	792	784	784
query71	375	348	326	326
query72	3089	2637	2287	2287
query73	846	819	457	457
query74	4616	4501	4315	4315
query75	2467	2365	1985	1985
query76	2306	1202	760	760
query77	360	383	280	280
query78	11257	11044	10601	10601
query79	1384	1144	779	779
query80	1284	554	473	473
query81	516	324	286	286
query82	670	173	143	143
query83	373	318	295	295
query84	316	163	134	134
query85	962	630	506	506
query86	403	238	210	210
query87	1995	1957	1838	1838
query88	3791	2816	2811	2811
query89	392	323	282	282
query90	1901	203	187	187
query91	199	191	162	162
query92	62	63	56	56
query93	1710	1580	933	933
query94	729	366	328	328
query95	805	497	591	497
query96	1034	794	365	365
query97	2501	2450	2328	2328
query98	203	185	180	180
query99	731	719	630	630
Total cold run time: 253680 ms
Total hot run time: 166186 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.08	0.05	0.04
query3	0.22	0.14	0.14
query4	1.03	0.13	0.13
query5	0.23	0.23	0.22
query6	0.88	0.81	0.76
query7	0.03	0.01	0.00
query8	0.06	0.03	0.04
query9	0.39	0.31	0.31
query10	0.58	0.55	0.56
query11	0.20	0.14	0.14
query12	0.19	0.14	0.13
query13	0.54	0.53	0.53
query14	1.01	0.99	1.00
query15	0.72	0.68	0.66
query16	0.32	0.31	0.32
query17	1.08	1.07	1.11
query18	0.21	0.20	0.19
query19	2.06	1.96	1.99
query20	0.01	0.01	0.01
query21	11.33	0.30	0.12
query22	3.35	0.05	0.04
query23	11.98	0.42	0.12
query24	1.84	0.41	0.31
query25	0.07	0.04	0.04
query26	0.56	0.23	0.14
query27	0.04	0.03	0.02
query28	2.89	1.02	0.39
query29	9.19	4.49	3.18
query30	0.24	0.15	0.15
query31	1.86	0.64	0.33
query32	3.25	0.59	0.49
query33	3.30	3.17	3.25
query34	11.29	5.45	5.05
query35	5.00	5.04	5.01
query36	0.52	0.49	0.43
query37	0.09	0.07	0.07
query38	0.05	0.04	0.03
query39	0.04	0.03	0.03
query40	0.17	0.16	0.14
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 77.07 s
Total hot run time: 27.53 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/33) 🎉
Increment coverage report
Complete coverage report

morningman
morningman previously approved these changes Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 Aug 5, 2026
u70b3 and others added 3 commits August 5, 2026 16:39
…dTest

Address review feedback: keep one test class per tested class (Google
Java Style) and reuse the existing ShowTableCommandMocks helper instead
of a separate ShowTableCommandExternalTest. The listsNamesOnly,
privilege-filter, SHOW FULL TABLES, SHOW VIEWS and internal-catalog
cases duplicate the call-count coverage added in cad2f74 and are
dropped.

Retained new coverage:
- LIKE pattern filter applies on the names-only fast path and
  getTables() is never called
- name-listing failures (case-insensitive name conflicts) raised by
  getTableNamesWithLock() propagate instead of being swallowed into
  an empty result

Verified: mvn -pl fe-core -am test -Dtest=ShowTableCommandTest, 8/8 pass.
[test](catalog) Add unit tests for SHOW TABLES name listing on external catalogs
@github-actions github-actions Bot removed the approved Indicates a PR has been approved by one committer. label Aug 5, 2026
@morningman

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17598	4025	4028	4025
q2	2020	326	199	199
q3	10295	1417	797	797
q4	4678	475	348	348
q5	7495	863	592	592
q6	191	175	139	139
q7	793	814	607	607
q8	9407	1702	1559	1559
q9	5331	4096	4046	4046
q10	6788	1620	1346	1346
q11	515	350	326	326
q12	725	593	473	473
q13	18085	3379	2844	2844
q14	265	262	255	255
q15	q16	735	727	654	654
q17	1019	991	973	973
q18	6584	5660	5576	5576
q19	1283	1243	1154	1154
q20	829	675	568	568
q21	6562	2936	2843	2843
q22	473	377	321	321
Total cold run time: 101671 ms
Total hot run time: 29645 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5058	4607	4760	4607
q2	300	330	212	212
q3	4944	5193	4664	4664
q4	2224	2271	1427	1427
q5	4693	4553	4487	4487
q6	240	180	131	131
q7	1867	1714	1516	1516
q8	2409	2048	2122	2048
q9	7225	7053	6750	6750
q10	4296	4225	3776	3776
q11	516	393	351	351
q12	709	714	520	520
q13	3018	3361	2852	2852
q14	268	274	254	254
q15	q16	671	696	617	617
q17	1280	1238	1241	1238
q18	12179	11023	11766	11023
q19	1136	1096	1069	1069
q20	2197	2195	1921	1921
q21	5367	4808	4700	4700
q22	522	472	417	417
Total cold run time: 61119 ms
Total hot run time: 54580 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 158418 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 52dc351a421e62fa06b805365fc3f75711c2378c, data reload: false

query5	4316	596	458	458
query6	468	229	197	197
query7	4840	609	332	332
query8	322	164	152	152
query9	8782	4093	4080	4080
query10	463	353	302	302
query11	5818	2201	1986	1986
query12	150	99	95	95
query13	1261	640	438	438
query14	6116	4310	4017	4017
query14_1	3833	3941	3857	3857
query15	201	202	180	180
query16	1000	477	438	438
query17	958	713	583	583
query18	2457	487	350	350
query19	219	194	155	155
query20	107	102	103	102
query21	229	160	139	139
query22	12979	13086	12773	12773
query23	15856	15110	14512	14512
query23_1	14563	14782	14612	14612
query24	7581	1746	1256	1256
query24_1	1259	1273	1218	1218
query25	540	431	354	354
query26	1308	366	221	221
query27	2571	564	389	389
query28	4573	2016	2016	2016
query29	1060	610	483	483
query30	347	271	229	229
query31	1199	1114	1076	1076
query32	112	59	60	59
query33	519	304	241	241
query34	1200	1146	658	658
query35	731	739	641	641
query36	772	781	683	683
query37	158	111	93	93
query38	1827	1750	1685	1685
query39	811	826	810	810
query39_1	780	789	780	780
query40	242	164	144	144
query41	66	66	62	62
query42	100	94	92	92
query43	318	323	277	277
query44	1421	770	763	763
query45	197	175	170	170
query46	1066	1151	698	698
query47	1531	1492	1448	1448
query48	426	407	304	304
query49	592	410	313	313
query50	1059	442	332	332
query51	10755	10400	10234	10234
query52	90	90	76	76
query53	255	279	198	198
query54	292	230	230	230
query55	75	73	69	69
query56	308	313	292	292
query57	994	997	908	908
query58	298	275	250	250
query59	1522	1600	1399	1399
query60	305	276	254	254
query61	156	150	154	150
query62	400	320	263	263
query63	241	204	200	200
query64	2887	1042	929	929
query65	3926	3823	3818	3818
query66	1881	500	375	375
query67	19954	20066	19900	19900
query68	3086	1603	1010	1010
query69	448	315	279	279
query70	868	827	797	797
query71	403	352	342	342
query72	3241	2858	2560	2560
query73	814	810	405	405
query74	4606	4499	4278	4278
query75	2333	2354	2010	2010
query76	2319	1151	787	787
query77	329	356	267	267
query78	11051	11175	10608	10608
query79	1402	1162	760	760
query80	1250	551	479	479
query81	525	334	289	289
query82	648	181	138	138
query83	410	349	304	304
query84	326	167	131	131
query85	995	625	511	511
query86	412	253	225	225
query87	1990	1957	1825	1825
query88	3766	2838	2800	2800
query89	389	334	292	292
query90	1964	202	194	194
query91	203	198	163	163
query92	61	63	55	55
query93	1673	1492	951	951
query94	734	362	319	319
query95	783	607	479	479
query96	1075	857	374	374
query97	2476	2477	2313	2313
query98	200	194	184	184
query99	746	724	613	613
Total cold run time: 245240 ms
Total hot run time: 158418 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 23.69 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 52dc351a421e62fa06b805365fc3f75711c2378c, data reload: false

query1	0.01	0.01	0.00
query2	0.09	0.05	0.05
query3	0.26	0.14	0.14
query4	1.60	0.15	0.14
query5	0.25	0.24	0.22
query6	1.16	0.82	0.78
query7	0.04	0.00	0.01
query8	0.06	0.04	0.03
query9	0.37	0.33	0.31
query10	0.56	0.54	0.59
query11	0.19	0.14	0.14
query12	0.18	0.14	0.14
query13	0.47	0.46	0.48
query14	1.01	0.99	1.00
query15	0.61	0.59	0.59
query16	0.33	0.33	0.32
query17	1.10	1.06	1.07
query18	0.22	0.20	0.20
query19	2.04	1.97	1.92
query20	0.02	0.01	0.01
query21	15.42	0.18	0.14
query22	5.02	0.06	0.05
query23	16.12	0.31	0.12
query24	3.04	0.44	0.31
query25	0.11	0.04	0.04
query26	0.72	0.20	0.14
query27	0.05	0.05	0.03
query28	3.55	0.77	0.34
query29	12.56	4.08	3.17
query30	0.29	0.15	0.15
query31	2.77	0.57	0.32
query32	3.22	0.59	0.49
query33	3.24	3.09	3.21
query34	15.46	3.92	3.25
query35	3.22	3.23	3.23
query36	0.55	0.43	0.42
query37	0.09	0.06	0.06
query38	0.06	0.03	0.03
query39	0.04	0.04	0.04
query40	0.16	0.14	0.14
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.43 s
Total hot run time: 23.69 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/167) 🎉
Increment coverage report
Complete coverage report

@github-actions

Copy link
Copy Markdown
Contributor

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 Aug 11, 2026
@morningman
morningman merged commit dcc2771 into apache:master Aug 11, 2026
29 of 30 checks passed
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Aug 17, 2026
…xternal catalogs (apache#66080)

### What problem does this PR solve?

Issue Number: close apache#66079

Problem Summary:

`SHOW TABLES` on an external catalog iterated `dbIf.getTables()`, which
eagerly initializes every table via the meta cache (one
`getTableNullable()`
-> remote metadata load per table). For catalogs with many tables this
turned
a cheap name listing into N remote loads.

This adds a fast path for the common case only -- a non-verbose `SHOW
TABLES`
on an external catalog -- that lists names via
`dbIf.getTableNamesOrEmptyWithLock()` without initializing any table.
The
per-table `SHOW` privilege filter is preserved (it is name-based and
needs no
table load), so no table name is leaked to a user who lacks `SHOW` on
it.

Everything else keeps the original `getTables()` loop unchanged:
- Internal-catalog `SHOW TABLES` / `SHOW FULL TABLES`.
- External-catalog `SHOW FULL TABLES` (verbose): it still needs
`getMysqlType()`
  and the storage-format columns, so it takes the original path and its
  4-column output (`Table_type`, `Storage_format`,
  `Inverted_index_storage_format`) is unchanged.
- `SHOW VIEWS` (needs `getEngine()` to filter views) and `SHOW STREAMS`.

### Release note

None (performance optimization; `SHOW TABLES` output for accessible
tables is
unchanged, `SHOW FULL TABLES` / `SHOW VIEWS` are unaffected).

### Check List (For Author)

- Test:
- Manual test on a live cluster with an HMS catalog: `SHOW TABLES` and
`SHOW TABLES LIKE` list names via the fast path; `SHOW FULL TABLES`
returns the correct 4 columns (name, `Table_type`, `Storage_format`,
      `Inverted_index_storage_format`) with no column mismatch.
- Ran existing `ShowTableCommandTest` (2 passed); FE build (`build.sh
--fe`)
      + checkstyle green.
    - No new unit test: exercising the external-catalog branch needs an
ExternalCatalog with a working `getTableNamesOrEmptyWithLock()`, which
is
not available in the FE unit-test harness; a portable regression `.out`
      needs the docker HMS test environment.
- Behavior changed: No material change (a non-loadable external table's
name is
now listed by `SHOW TABLES` where the old path silently omitted it on
load
  failure, which is arguably more correct).
- Does this need documentation: No

---------

Co-authored-by: lbs <lucian1412@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] SHOW TABLES on an external catalog initializes every table's metadata

6 participants