v.23.5Improvement

Fix PostgreSQL Data Retrieval Ignoring LIMIT Clause

Fix PostgreSQL reading all the data even though LIMIT n could be specified. #50187 (Kseniia Sumarokova).
Fixed PostgreSQL table function to respect the LIMIT n clause and avoid reading all data unnecessarily.

Why it matters

Previously, when querying PostgreSQL using the table function with a LIMIT n clause, ClickHouse read the entire remote table data instead of limiting the fetch to n rows. This fix improves query performance and reduces resource consumption by fetching only the required number of rows.

How to use it

Use the PostgreSQL table function with a LIMIT n clause in your SQL queries as usual. With this fix, ClickHouse will correctly apply the limit at the data source, optimizing data retrieval automatically.