Skip to content

Commit 9106491

Browse files
committed
remove indexinfo building
1 parent 392b8db commit 9106491

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

sr_plan.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
157157
{
158158
Jsonb *out_jsonb,
159159
*out_jsonb2;
160-
int query_hash;
160+
Datum query_hash;
161161
Relation sr_plans_heap,
162162
sr_index_rel;
163163
HeapTuple tuple;
@@ -223,12 +223,8 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
223223
/* Make list with all _p functions and his position */
224224
sr_query_walker((Query *) parse, &qp_context);
225225
out_jsonb = node_tree_to_jsonb(parse, sr_plan_fake_func, true);
226-
query_hash = DatumGetInt32(DirectFunctionCall1(jsonb_hash,
227-
PointerGetDatum(out_jsonb)));
228-
ScanKeyInit(&key, 1,
229-
BTEqualStrategyNumber,
230-
F_INT4EQ,
231-
Int32GetDatum(query_hash));
226+
query_hash = DirectFunctionCall1(jsonb_hash, PointerGetDatum(out_jsonb));
227+
ScanKeyInit(&key, 1, BTEqualStrategyNumber, F_INT4EQ, query_hash);
232228

233229
/* Try to find already planned statement */
234230
heap_lock = AccessShareLock;
@@ -309,7 +305,7 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
309305
bool nulls[Anum_sr_attcount];
310306

311307
MemSet(nulls, 0, sizeof(nulls));
312-
values[Anum_sr_query_hash - 1] = Int32GetDatum(query_hash);
308+
values[Anum_sr_query_hash - 1] = query_hash;
313309
values[Anum_sr_plan_hash - 1] = plan_hash;
314310
values[Anum_sr_query - 1] = CStringGetTextDatum(query_text);
315311
values[Anum_sr_plan - 1] = PointerGetDatum(out_jsonb2);
@@ -318,15 +314,13 @@ sr_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
318314

319315
tuple = heap_form_tuple(sr_plans_heap->rd_att, values, nulls);
320316
simple_heap_insert(sr_plans_heap, tuple);
321-
322-
/* Make changes visible */
323-
CommandCounterIncrement();
324317
#if PG_VERSION_NUM >= 100000
325318
index_insert(sr_index_rel,
326319
values, nulls,
327320
&(tuple->t_self),
328321
sr_plans_heap,
329-
UNIQUE_CHECK_NO, BuildIndexInfo(sr_index_rel));
322+
UNIQUE_CHECK_NO,
323+
NULL);
330324
#else
331325
index_insert(sr_index_rel,
332326
values, nulls,

0 commit comments

Comments
 (0)