Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C47D41337B61 for ; Thu, 24 Mar 2011 09:07:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 39417-04 for ; Thu, 24 Mar 2011 12:07:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smadev.internal.net (host3.dynacom.ondsl.gr [62.103.35.211]) by mail.postgresql.org (Postfix) with ESMTP id 8580A13364DE for ; Thu, 24 Mar 2011 09:07:30 -0300 (ADT) Received: from smadev.internal.net (localhost.internal.net [127.0.0.1]) by smadev.internal.net (8.14.2/8.14.2) with ESMTP id p2OC7Uvp041646 for ; Thu, 24 Mar 2011 14:07:30 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by smadev.internal.net (8.14.2/8.14.2/Submit) id p2OC7Tbh041645 for pgsql-performance@postgresql.org; Thu, 24 Mar 2011 14:07:29 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-performance@postgresql.org Subject: Re: pg9.0.3 explain analyze running very slow compared to a different box with much less configuration Date: Thu, 24 Mar 2011 14:07:29 +0200 User-Agent: KMail/1.9.7 References: <201103241111.03360.achill@matrix.gatewaynet.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201103241407.29581.achill@matrix.gatewaynet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201103/306 X-Sequence-Number: 42985 =CE=A3=CF=84=CE=B9=CF=82 Thursday 24 March 2011 13:39:19 =CE=BF/=CE=B7 Mart= i Raudsepp =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > On Thu, Mar 24, 2011 at 11:11, Achilleas Mantzios > wrote: > > My problem had to do with the speed of gettimeofday. You might want to = do some special setting regarding > > your box's way of reading time for the hw clock. >=20 > Just for extra info, on x86, TSC is usually the "fast" timeofday > implementation. On recent CPUs in single-socket configurations, TSC > should always be available, regardless of any power management. I > don't know about multi-socket. If you want to know whether your kernel > is using tsc, run: >=20 That's what i am experiencing as well, in two of my FreeBSD boxes (work/hom= e) i get: phenom ii X4 : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D % sysctl -a | grep -i timecounter kern.timecounter.tick: 1 kern.timecounter.choice: TSC(-100) HPET(900) ACPI-fast(1000) i8254(0) dummy= (-1000000) kern.timecounter.hardware: TSC kern.timecounter.stepwarnings: 0 kern.timecounter.tc.i8254.mask: 65535 kern.timecounter.tc.i8254.counter: 1960 kern.timecounter.tc.i8254.frequency: 1193182 kern.timecounter.tc.i8254.quality: 0 kern.timecounter.tc.ACPI-fast.mask: 4294967295 kern.timecounter.tc.ACPI-fast.counter: 3642319843 kern.timecounter.tc.ACPI-fast.frequency: 3579545 kern.timecounter.tc.ACPI-fast.quality: 1000 kern.timecounter.tc.HPET.mask: 4294967295 kern.timecounter.tc.HPET.counter: 1160619197 kern.timecounter.tc.HPET.frequency: 14318180 kern.timecounter.tc.HPET.quality: 900 kern.timecounter.tc.TSC.mask: 4294967295 kern.timecounter.tc.TSC.counter: 2788277817 kern.timecounter.tc.TSC.frequency: 3400155810 kern.timecounter.tc.TSC.quality: -100 kern.timecounter.smp_tsc: 0 kern.timecounter.invariant_tsc: 1 Pentium 4 =3D=3D=3D=3D=3D=3D % sysctl -a | grep -i timecounter kern.timecounter.tick: 1 kern.timecounter.choice: TSC(800) ACPI-fast(1000) i8254(0) dummy(-1000000) kern.timecounter.hardware: ACPI-fast kern.timecounter.stepwarnings: 0 kern.timecounter.tc.i8254.mask: 65535 kern.timecounter.tc.i8254.counter: 13682 kern.timecounter.tc.i8254.frequency: 1193182 kern.timecounter.tc.i8254.quality: 0 kern.timecounter.tc.ACPI-fast.mask: 16777215 kern.timecounter.tc.ACPI-fast.counter: 6708142 kern.timecounter.tc.ACPI-fast.frequency: 3579545 kern.timecounter.tc.ACPI-fast.quality: 1000 kern.timecounter.tc.TSC.mask: 4294967295 kern.timecounter.tc.TSC.counter: 3109326068 kern.timecounter.tc.TSC.frequency: 2663194296 kern.timecounter.tc.TSC.quality: 800 kern.timecounter.smp_tsc: 0 kern.timecounter.invariant_tsc: 0 TSC, it seems, outperform the rest of clocks in terms of frequency. > cat /sys/devices/system/clocksource/clocksource0/current_clocksource >=20 > On older CPUs, you often had to disable some sort of power management > in order to get a stable TSC -- the "ondemand" scaling governor is the > top suspect. Disabling this is distro-specific. You have to reboot to > get the kernel to re-test TSC. Unfortunately disabling power > management later at boot doesn't help you, you have to prevent it from > activating at all. >=20 > For debugging, grepping dmesg for tsc or clocksource is often helpful. > On machines with unstable TSC you'll see output like this: >=20 > [ 0.000000] Fast TSC calibration using PIT > [ 0.164068] checking TSC synchronization [CPU#0 -> CPU#1]: passed. > [ 0.196730] Switching to clocksource tsc > [ 0.261347] Marking TSC unstable due to TSC halts in idle > [ 0.261536] Switching to clocksource acpi_pm >=20 > If you just want to get repeatable timings, you can force both > machines to use the hpet clocksource: > echo hpet > /sys/devices/system/clocksource/clocksource0/current_clocksou= rce >=20 > Marti >=20 =2D-=20 Achilleas Mantzios