v.24.7Improvement

Optimize Trivial Insert Select Setting Disabled by Default

The setting optimize_trivial_insert_select is disabled by default. In most cases, it should be beneficial. Nevertheless, if you are seeing slower INSERT SELECT or increased memory usage, you can enable it back or SET compatibility = '24.6'. #58970 (Alexey Milovidov).
Introduces the optimize_trivial_insert_select setting, which is disabled by default to prevent potential slowdowns or increased memory usage during INSERT SELECT operations.

Why it matters

This feature aims to optimize trivial INSERT SELECT queries for better performance and resource efficiency. By default, it is disabled to avoid cases where enabling it might lead to slower inserts or higher memory consumption, giving users control to enable it when beneficial.

How to use it

Users can enable this optimization by setting optimize_trivial_insert_select = 1 in the configuration or during a session. Alternatively, they can run SET compatibility = '24.6' to turn on the optimization along with other version 24.6 compatible behaviors.