Possibly redundant context switch in postgres_fdw

From: Ildar Musin <ildar(at)adjust(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Possibly redundant context switch in postgres_fdw
Date: 2018-10-18 14:01:04
Message-ID: CAONYFtNX4cg7-tvwBsaatMYhJOPb6jrNs_p0=apm0_tjw9jQ6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

ISTM that context switch in `create_cursor()`:

if (numParams > 0)
{
MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
process_query_params(econtext,
fsstate->param_flinfo,
fsstate->param_exprs,
values);
MemoryContextSwitchTo(oldcontext);
}

is redundant since we should already be in `ecxt_per_tuple_memory` context
according to `ForeignNext()`. Do I miss some hidden purpose? If not here is
a patch that removes it.

Regards,
Ildar Musin

Attachment Content-Type Size
remove_ctx_switch.patch text/x-patch 611 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-10-18 14:57:26 Re: PG vs macOS Mojave
Previous Message Alexander Kuzmenkov 2018-10-18 12:47:09 Re: Removing unneeded self joins