Re: On-demand running query plans using auto_explain and signals - Mailing list pgsql-hackers

From Shulgin, Oleksandr
Subject Re: On-demand running query plans using auto_explain and signals
Date
Msg-id CACACo5R6G=iUEE3zcCK43RagmwXxy7PAhHU_9nW3ZvC2_jsDfg@mail.gmail.com
Whole thread Raw
In response to Re: On-demand running query plans using auto_explain and signals  ("Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>)
List pgsql-hackers
On Fri, Sep 25, 2015 at 7:13 PM, Shulgin, Oleksandr <oleksandr.shulgin@zalando.de> wrote:

Some implementation details:

For every backend that might be running (MaxBackends) we reserve a dsm_handle slot in the addins shared memory.  When the new option is turned on, the ExecutorRun hook will produce a plan in whatever format is specified by the auto_explain.log_format, allocate a DSM segment, copy the plan into the segment and finally store the DSM handle into its own slot.  No locking is required around this because every backend writes to its slot exclusively, no other backend can be writing into it concurrently.  In the ExecutorFinish hook we invalidate the backend's slot by setting the handle to 0 and deallocate the DSM segment.

And this patch adds back the use of table of contents on the DSM.  Benefits: magic number validation; communication of the actual plan size.

--
Alex

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Doubt in pgbench TPS number
Next
From: Marti Raudsepp
Date:
Subject: Re: BRIN indexes for MAX, MIN, ORDER BY?