Re: postgresql and process titles - Mailing list pgsql-hackers

From Greg Stark
Subject Re: postgresql and process titles
Date
Msg-id 87ver3bn8e.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: postgresql and process titles  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: postgresql and process titles  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Greg Stark <gsstark@mit.edu> writes:
> > If backends store their current status in shared memory then a separate
> > process entirely can receive the interrupts, scan through the shared memory
> > process states and do the accounting.
> 
> This sounds good until you think about locking.  It'd be quite
> impractical to implement anything as fine-grained as EXPLAIN ANALYZE
> this way, because of the overhead involved in taking and releasing
> spinlocks.

I'm not entirely convinced. The only other process that would be looking at
the information would be the statistics accumulator which would only be waking
up every 100ms or so. There would be no contention with other backends
reporting their info.

I was also thinking of reporting only basic information like which of a small
number of states the backend was in and which node of the plan is being
executed. If those are just integers then it might be possible to get away
without locking at all, storing them as sig_atomic_t. 

I think there would still be a fair amount of cache coherency overhead like we
see with the tas instruction on Xeons but only if that backend's monitor block
is actually being touched by the statistics accumulator process which would
presumably be only when running an EXPLAIN ANALYZE or other tracing facility.

-- 
greg



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Multi-byte and client side character encoding tests
Next
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Work-in-progress referential action trigger