SCAN_NODE_CODEGEN_THRESHOLD Query Option (CDH 5.7 or higher only)
The SCAN_NODE_CODEGEN_THRESHOLD query option adjusts the aggressiveness of the code generation optimization process when performing I/O read operations. It can help to work around performance problems for queries where the table is small and the WHERE clause is complicated.
Default: 1800000 (1.8 million)
Added in: CDH 5.7.0 (Impala 2.5.0)
This query option is intended mainly for the case where a query with a very complicated WHERE clause, such as an IN operator with thousands of entries, is run against a small table, especially a small table using Parquet format. The code generation phase can become the dominant factor in the query response time, making the query take several seconds even though there is relatively little work to do. In this case, increase the value of this option to a much larger amount, anything up to the maximum for a 32-bit integer.
Because this option only affects the code generation phase for the portion of the query that performs I/O (the scan nodes within the query plan), it lets you continue to keep code generation enabled for other queries, and other parts of the same query, that can benefit from it. In contrast, the IMPALA_DISABLE_CODEGEN query option turns off code generation entirely.
Because of the way the work for queries is divided internally, this option might not affect code generation for all kinds of queries. If a plan fragment contains a scan node and some other kind of plan node, code generation still occurs regardless of this option setting.
To use this option effectively, you should be familiar with reading query profile output to determine the proportion of time spent in the code generation phase, and whether code generation is enabled or not for specific plan fragments.