Hi, On 2018-04-05 10:23:43 +0300, Heikki Linnakangas wrote: > Profiling that, without any patches applied, I noticed that a lot of time > was spent in read()s on the postmaster-death pipe, i.e. in > PostmasterIsAlive(). We call that between *every* WAL record.
> That seems like an utter waste of time. I'm almost inclined to call that a > performance bug. As a straightforward fix, I'd suggest that we call > HandleStartupProcInterrupts() in the WAL redo loop, not on every record, but > only e.g. every 32 records. I agree this is a performance problem. I do however not like the fix. ISTM the better approach would be to try to reduce the cost of PostmasterIsAlive() on common platforms - it should be nearly free if done right. One way to achieve that would e.g. to stop ignoring SIGPIPE and instead check for postmaster death inside the handler, without reacting to it. Then the the actual PostmasterIsAlive() checks are just a check of a single sig_atomic_t. Greetings, Andres Freund