Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1H4hjx10630; Fri, 16 Feb 2001 23:43:45 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f1H4hT902084; Fri, 16 Feb 2001 23:43:29 -0500 (EST) To: "Schmidt, Peter" cc: pgsql-hackers@postgreSQL.org, pgsql-admin@postgreSQL.org Subject: Re: v7.1b4 bad performance In-reply-to: References: Comments: In-reply-to "Schmidt, Peter" message dated "Fri, 16 Feb 2001 19:54:45 -0800" Date: Fri, 16 Feb 2001 23:43:29 -0500 Message-ID: <2081.982385009@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200102/126 X-Sequence-Number: 728 "Schmidt, Peter" writes: > So, is it OK to use commit_delay=0? Certainly. In fact, I think that's about to become the default ;-) I have now experimented with several different platforms --- HPUX, FreeBSD, and two considerably different strains of Linux --- and I find that the minimum delay supported by select(2) is 10 or more milliseconds on all of them, as much as 20 msec on some popular platforms. Try it yourself (my test program is attached). Thus, our past arguments about whether a few microseconds of delay before commit are a good idea seem moot; we do not have any portable way of implementing that, and a ten millisecond delay for commit is clearly Not Good. regards, tom lane /* To use: gcc test.c, then time ./a.out N N=0 should return almost instantly, if your select(2) does not block as per spec. N=1 shows the minimum achievable delay, * 1000 --- for example, if time reports the elapsed time as 10 seconds, then select has rounded your 1-microsecond delay request up to 10 milliseconds. Some Unixen seem to throw in an extra ten millisec of delay just for good measure, eg, on FreeBSD 4.2 N=1 takes 20 sec, N=20000 takes 30. */ #include #include #include #include #include int main(int argc, char** argv) { struct timeval delay; int i, del; del = atoi(argv[1]); for (i = 0; i < 1000; i++) { delay.tv_sec = 0; delay.tv_usec = del; (void) select(0, NULL, NULL, NULL, &delay); } return 0; }