Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 29A0F1337B98 for ; Tue, 25 Jan 2011 11:27:37 -0400 (AST) 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 50789-06 for ; Tue, 25 Jan 2011 15:27:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 802481337B99 for ; Tue, 25 Jan 2011 11:27:29 -0400 (AST) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Phkno-00024Y-3K for pgsql-performance@postgresql.org; Tue, 25 Jan 2011 16:27:28 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Jan 2011 16:27:28 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Jan 2011 16:27:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Ivan Voras Subject: Re: Fun little performance IMPROVEMENT... Date: Tue, 25 Jan 2011 16:27:15 +0100 Lines: 44 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101102 Thunderbird/3.1.6 In-Reply-To: X-Enigmail-Version: 1.1.2 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201101/231 X-Sequence-Number: 42018 On 21/01/2011 19:12, grant@amadensor.com wrote: > I was doing a little testing to see how machine load affected the > performance of different types of queries, index range scans, hash joins, > full scans, a mix, etc. > > In order to do this, I isolated different performance hits, spinning only > CPU, loading the disk to create high I/O wait states, and using most of > the physical memory. This was on a 4 CPU Xen virtual machine running > 8.1.22 on CENTOS. > > > Here is the fun part. When running 8 threads spinning calculating square > roots (using the stress package), the full scan returned consistently 60% > faster than the machine with no load. It was returning 44,000 out of > 5,000,000 rows. Here is the explain analyze. I am hoping that this > triggers something (I can run more tests as needed) that can help us make > it always better. Looks like a virtualization artifact. Here's a list of some such noticed artifacts: http://wiki.freebsd.org/WhyNotBenchmarkUnderVMWare > > Idling: > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > Seq Scan on schedule_details (cost=0.00..219437.90 rows=81386 width=187) > (actual time=0.053..2915.966 rows=44320 loops=1) > Filter: (schedule_type = '5X'::bpchar) > Total runtime: 2986.764 ms > > Loaded: > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > Seq Scan on schedule_details (cost=0.00..219437.90 rows=81386 width=187) > (actual time=0.034..1698.068 rows=44320 loops=1) > Filter: (schedule_type = '5X'::bpchar) > Total runtime: 1733.084 ms In this case it looks like the IO generated by the VM is causing the Hypervisor to frequently "sleep" the machine while waiting for the IO, but if the machine is also generating CPU load, it is not put to sleep as often.