v.24.5New Feature

On Linux and MacOS, use corresponding compression method for stdout redirected to compressed files

On Linux and MacOS, if the program has stdout redirected to a file with a compression extension, use the corresponding compression method instead of nothing (making it behave similarly to INTO OUTFILE). #63662 (v01dXYZ).
On Linux and MacOS, ClickHouse now automatically applies compression when stdout is redirected to a file with a recognized compression extension, matching the behavior of INTO OUTFILE.

Why it matters

This feature ensures that when query results are redirected to compressed files via stdout, ClickHouse uses the appropriate compression method instead of outputting uncompressed data. It improves usability and consistency by automatically handling compression based on the output file extension.

How to use it

Simply redirect the output of a ClickHouse query to a file with a supported compression extension (e.g., .gz, .lz4) on Linux or MacOS. ClickHouse will detect the extension and apply the corresponding compression method automatically.