Backend shutdown time? - Mailing list pgsql-hackers

From Tom Lane
Subject Backend shutdown time?
Date
Msg-id 23339.1011933502@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
We know that backend startup time is something we'd like to cut down as
much as possible, but has anyone ever looked at backend *shutdown* time?

I'm sitting here watching Michael Devogelaere's benchmark with "top",
and despite the fact that there's only one client process at a time,
there's frequently two or three backends running.  Sometimes four.
The only way I can see to explain this is that it takes a fair amount
of time for the backend to exit after the client disconnects.

Sample "ps -ef" run showing four active backends and one client:

tgl      17647     1  1 21:18 ?        00:02:31 postmaster -i -F
tgl      24844 17647  0 23:29 ?        00:00:00 postgres: userconsult_test userd
tgl      24852 17647  0 23:29 ?        00:00:00 postgres: userconsult_test userd
tgl      24856 17647  0 23:29 ?        00:00:00 postgres: userconsult_test userd
tgl      24859 17113  0 23:29 pts/1    00:00:00 /home/tgl/qmail/qmail-getpw alia
tgl      24860 17647  0 23:29 ?        00:00:00 postgres: userconsult_test userd

While it clearly takes some amount of time to clean out our entries in
the PROC array, etc, this trace suggests that the cost is a lot higher
than one would've expected.  Anyone have an idea what's going on here?

(BTW, the above processes are 7.1.3, but I doubt 7.2 is better.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: PostgreSQL crashes with Qmail-SQL
Next
From: Bruce Momjian
Date:
Subject: Re: RFD: schemas and different kinds of Postgres objects