v.20.3Improvement

Make SHOW TABLES and SHOW DATABASES Support WHERE and FROM/IN Expressions

Make SHOW TABLES and SHOW DATABASES queries support the WHERE expressions and FROM/IN #9076 (sundyli)
Added support for WHERE expressions and FROM/IN clauses in SHOW TABLES and SHOW DATABASES queries.

Why it matters

This feature enhances the flexibility and expressiveness of SHOW TABLES and SHOW DATABASES commands by allowing users to filter results with WHERE conditions and specify target databases using FROM or IN. It solves the limitation of retrieving large and unfiltered lists, enabling more precise and efficient metadata querying.

How to use it

Users can apply WHERE clauses to filter the output of SHOW TABLES and SHOW DATABASES queries. Additionally, they can specify the database(s) by using FROM or IN followed by one or multiple database names. For example:

SHOW TABLES FROM my_database WHERE name LIKE 'prefix_%';
SHOW DATABASES WHERE name != 'default';
SHOW TABLES IN ('db1', 'db2') WHERE engine = 'MergeTree';