Alvaro Herrera <alvherre@surnet.cl> writes:
> What about arranging postmaster's main loop so that it starts the stats
> collector process if one of the options is activated (assuming they were
> all off at start)? Right now you have to restart the server, but I
> don't see why it has to be like that.
The reason for a restart is that what "stats_start_collector" is REALLY
all about is telling the postmaster whether to establish the loopback
UDP socket for stats messaging. You don't get to add that after the
fact because there'd be no way to propagate the open socket into
existing backends.
And no, I wouldn't look with favor on the idea of creating the socket
unconditionally. One of the reasons for wanting to be able to turn
off pgstats entirely is so that you aren't dead in the water if the
loopback UDP socket won't work for some reason (example: kernel packet
filtering that's not under your control).
regards, tom lane