what is ‘query jumbling’?
SUMMARY: it’s a mechanism for calculating query id.
DETAIL: PostgreSQL extracts the node->type
of each Node in the raw query tree, concatenates the memory content of node->type
into a variable referred to as "jumble." Subsequently, PostgreSQL computes the query ID of the raw query tree by generating the hash value of the jumble.
CODE PATH:
parse_analyze_fixedparams {
if IsQueryIdEnabled() {
JumbleQuery(query) {
_jumbleNode(jstate, query) {
/* JUMBLE_FIELD is a macro, expanded as:
* AppendJumble(jstate, (const unsigned char *) &(expr->type), sizeof(expr->type));
*/
JUMBLE_FIELD(type);
}
query->queryId = hash_any_extended(jstate->jumble, jstate->jumble_len, 0));
}
}
}
DEBUG TRACE:
set compute_query_id = on;
select 1;