You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Enhancement] SHOW TABLES on an external catalog initializes every table's metadata #66079
I had searched in the issues and found no similar issues.
Description
SHOW TABLES against an external catalog iterates DatabaseIf.getTables(). For external databases this eagerly initializes every table through the meta cache — one getTableNullable() call, and therefore one remote metadata load, per table. For a catalog/database with many tables this turns a cheap name listing into N remote loads, making SHOW TABLES slow.
The verbose form SHOW FULL TABLES genuinely needs per-table information (Table_type, storage-format columns), but a plain SHOW TABLES only needs table names, which the catalog can already provide via getTableNamesOrEmptyWithLock() without loading any table object.
Solution
For the common case — a non-verbose SHOW TABLES on an external catalog — list the names directly via getTableNamesOrEmptyWithLock() instead of getTables(), so no table is initialized. The per-table SHOW privilege filter is preserved (it is name-based and needs no table load), so no table name is exposed to a user who lacks SHOW privilege on it.
SHOW FULL TABLES (verbose), SHOW VIEWS, SHOW STREAMS, and internal-catalog SHOW TABLES keep the existing getTables() path and are unaffected.
Use case
Faster SHOW TABLES on external (e.g. Hive/Iceberg) catalogs with many tables.
Hi @Baymine, this issue has been quiet for about two weeks, so I've gone ahead and implemented the fix you proposed: a non-verbose SHOW TABLES on an external catalog now lists table names via getTableNamesOrEmptyWithLock() instead of getTables(), while keeping the name-based SHOW privilege filter. SHOW FULL TABLES, SHOW VIEWS, SHOW STREAMS, and the internal catalog keep the existing path.
I'll open a PR shortly with unit tests covering the new path. Happy to close it if you already have one in progress — just let me know.
Hi @Baymine, this issue has been quiet for about two weeks, so I've gone ahead and implemented the fix you proposed: a non-verbose SHOW TABLES on an external catalog now lists table names via getTableNamesOrEmptyWithLock() instead of getTables(), while keeping the name-based SHOW privilege filter. SHOW FULL TABLES, SHOW VIEWS, SHOW STREAMS, and the internal catalog keep the existing path.
I'll open a PR shortly with unit tests covering the new path. Happy to close it if you already have one in progress — just let me know.
Hi there, we are making progress with this pull request: #66080
Ah, my mistake — I searched for related PRs before starting but missed #66080. Great to see this already in progress, and nice call using getTableNamesWithLock() over the OrEmpty variant — swallowing name-conflict/init failures into an empty result would have been a subtle regression vs. the old path.
Since #66080 currently has manual testing only, I'd like to contribute the unit tests I wrote while implementing the same change independently (6 cases: names-only fast path never calls getTables(), LIKE filter, SHOW privilege filter, and SHOW FULL TABLES / SHOW VIEWS / internal-catalog paths unchanged). I'll open a PR against your branch with them shortly — feel free to fold them into #66080 if you like.
Activity
[improvement](catalog) avoid loading every table for SHOW TABLES on e…
u70b3 commentedon Aug 4, 2026
Hi @Baymine, this issue has been quiet for about two weeks, so I've gone ahead and implemented the fix you proposed: a non-verbose
SHOW TABLESon an external catalog now lists table names viagetTableNamesOrEmptyWithLock()instead ofgetTables(), while keeping the name-based SHOW privilege filter.SHOW FULL TABLES,SHOW VIEWS,SHOW STREAMS, and the internal catalog keep the existing path.I'll open a PR shortly with unit tests covering the new path. Happy to close it if you already have one in progress — just let me know.
Baymine commentedon Aug 4, 2026
Hi there, we are making progress with this pull request: #66080
u70b3 commentedon Aug 4, 2026
Ah, my mistake — I searched for related PRs before starting but missed #66080. Great to see this already in progress, and nice call using
getTableNamesWithLock()over the OrEmpty variant — swallowing name-conflict/init failures into an empty result would have been a subtle regression vs. the old path.Since #66080 currently has manual testing only, I'd like to contribute the unit tests I wrote while implementing the same change independently (6 cases: names-only fast path never calls
getTables(), LIKE filter, SHOW privilege filter, and SHOW FULL TABLES / SHOW VIEWS / internal-catalog paths unchanged). I'll open a PR against your branch with them shortly — feel free to fold them into #66080 if you like.[improvement](catalog) add call-count tests for SHOW TABLES external …
[improvement](catalog) avoid loading every table for SHOW TABLES on e…
[improvement](catalog) avoid loading every table for SHOW TABLES on e…