mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Basic planner and executor integration for JIT.
This adds simple cost based plan time decision about whether JIT should be performed. jit_above_cost, jit_optimize_above_cost are compared with the total cost of a plan, and if the cost is above them JIT is performed / optimization is performed respectively. For that PlannedStmt and EState have a jitFlags (es_jit_flags) field that stores information about what JIT operations should be performed. EState now also has a new es_jit field, which can store a JitContext. When there are no errors the context is released in standard_ExecutorEnd(). It is likely that the default values for jit_[optimize_]above_cost will need to be adapted further, but in my test these values seem to work reasonably. Author: Andres Freund, with feedback by Peter Eisentraut Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
This commit is contained in:
@ -29,6 +29,7 @@
|
||||
#include "executor/nodeAgg.h"
|
||||
#include "foreign/fdwapi.h"
|
||||
#include "miscadmin.h"
|
||||
#include "jit/jit.h"
|
||||
#include "lib/bipartite_match.h"
|
||||
#include "lib/knapsack.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
@ -531,6 +532,20 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
|
||||
result->stmt_location = parse->stmt_location;
|
||||
result->stmt_len = parse->stmt_len;
|
||||
|
||||
result->jitFlags = PGJIT_NONE;
|
||||
if (jit_enabled && jit_above_cost >= 0 &&
|
||||
top_plan->total_cost > jit_above_cost)
|
||||
{
|
||||
result->jitFlags |= PGJIT_PERFORM;
|
||||
|
||||
/*
|
||||
* Decide how much effort should be put into generating better code.
|
||||
*/
|
||||
if (jit_optimize_above_cost >= 0 &&
|
||||
top_plan->total_cost > jit_optimize_above_cost)
|
||||
result->jitFlags |= PGJIT_OPT3;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user