Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ULJzE-000236-8B for pgsql-performance@arkaria.postgresql.org; Thu, 28 Mar 2013 21:03:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1ULJzD-0001mt-N2 for pgsql-performance@arkaria.postgresql.org; Thu, 28 Mar 2013 21:03:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ULJzC-0001m7-M7 for pgsql-performance@postgresql.org; Thu, 28 Mar 2013 21:03:50 +0000 Received: from nm37-vm5.bullet.mail.bf1.yahoo.com ([72.30.238.205]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ULJz6-00067X-Cy for pgsql-performance@postgresql.org; Thu, 28 Mar 2013 21:03:50 +0000 Received: from [98.139.212.150] by nm37.bullet.mail.bf1.yahoo.com with NNFMP; 28 Mar 2013 21:03:42 -0000 Received: from [98.139.212.242] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 28 Mar 2013 21:03:42 -0000 Received: from [127.0.0.1] by omp1051.mail.bf1.yahoo.com with NNFMP; 28 Mar 2013 21:03:42 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 607623.94539.bm@omp1051.mail.bf1.yahoo.com Received: (qmail 98420 invoked by uid 60001); 28 Mar 2013 21:03:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1364504622; bh=GQ21QiDCuaKtGcwABgTA9mW0nhWyPnkcMt58kHJeZ00=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=cjEjG+nqkgFMROQLoR35Yo7su3egggKA2LomkYBCllBTPlIjFV7T9S61QF9KYxN37maZHNWhbZ7Cb2jozoUQ5aiwgyMjL7wSAGiok0vqe5Y6Qo4pzgFO1Vv0Uf31B70oE9x91lFsRhFoqWcixDfuKfWNSlNx6UIDJn+2XOmDZgE= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=0AYAFH7VzaXJjTT7e/F+QPLBJ3N/4tb2TEJfTIYvuihi7QJo2wnoLBKwJdk37cN3z0rQPwPZmR3khXjxUy4PqnCEvI2nUR+EmWLcwpWIIb1TqnQvME0/Gb0KQ1t3qneX8FTgfGcL9c6lc34bWWOUqRDCi883QxXNy4uJ7q+1Z/o=; X-YMail-OSG: DhDfGOUVM1nFVTO1_B.VYoDtjCy5PFY8j12wxyqZkOfynay 2mKSggBPmfarWunfqjT79cANqQHWsxLKWWxvSd6XZPPMCnHxribOJH82IRkV _4WnTMeMlXXfLwuoDRTLhc1HWVuJyJv48tGpe0oSt7hQjlje99sw0g3fS09K vhfcJtxte3LUzpOMUyG5ZhRvmnw0xlr2gue4FJxIi74yTQpiyUhxErJAXxOb KG1RfmPWN.6ofzarvnvmFQav2f3w88luzbEg6oeBCceIospSJlIVSAj2kQtD z26E7AZyKgqT7Ady03moBXLc8QuBb5LNmGFU.Y9w7z_98YeIOCpKaCICUtM1 9tfWzwAzc1wc9.AyhHtipW7BLqtf6gtfWF0V1NYqzV82vSSliNaZ7b6Vtyex 6B3rrHWPDHXFAAIwf.24WeMIQmPDvz4bDtj4pOAGOnsRQxlHeqqukb94_F3Q 2agyc8IP3GubUeIFAZ._2IXxdjI6EKb7lB0OTo01w1awf9zawxyhL8oGibj7 lu1RgC_cFaTulqGtYthlqfsBlCdC8SQIZdbCM2X4- Received: from [76.255.18.237] by web162902.mail.bf1.yahoo.com via HTTP; Thu, 28 Mar 2013 14:03:42 PDT X-Rocket-MIMEInfo: 002.001, a2VscGhldCB4aW9uZyA8a2VscGhldEBnbWFpbC5jb20.IHdyb3RlOgoKPiBXaGVuIEkgdXNlIHBvc3RncmVzIGFuZCBpc3N1ZSBhIHNpbXBsZSBzZXF1ZW50aWFsIHNjYW4gZm9yIGEKPiB0YWJsZSBpbnZlbnRvcnkgdXNpbmcgcXVlcnkgInNlbGVjdCAqIGZyb20gaW52ZW50b3J5OyIsIEkgY2FuIHNlZQo.IGZyb20gInRvcCIgdGhhdCBwb3N0bWFzdGVyIGlzIHVzaW5nIDEwMCUgQ1BVLCB3aGljaCBsaW1pdHMgdGhlCj4gcXVlcnkgZXhlY3V0aW9uIHRpbWUuIE15IHF1ZXN0aW9uIGlzIHRoYXQsIHdoeSBDUFUBMAEBAQE- X-Mailer: YahooMailWebService/0.8.139.530 References: Message-ID: <1364504622.71422.YahooMailNeo@web162902.mail.bf1.yahoo.com> Date: Thu, 28 Mar 2013 14:03:42 -0700 (PDT) From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: Question about postmaster's CPU usage To: kelphet xiong , "pgsql-performance@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org kelphet xiong wrote: > When I use postgres and issue a simple sequential scan for a > table inventory using query "select * from inventory;", I can see > from "top" that postmaster is using 100% CPU, which limits the > query execution time. My question is that, why CPU is the > bottleneck here and what is postmaster doing? Is there any way to > improve the performance? Thanks! > explain analyze select * from inventory; >=20 > Seq Scan on inventory=A0 (cost=3D0.00..180937.00 rows=3D11745000 width=3D= 16) (actual time=3D0.005..1030.403 rows=3D11745000 loops=3D1) >=A0 Total runtime: 1750.889 ms So it is reading and returning 11.7 million rows in about 1 second, or about 88 nanoseconds (billionths of a second) per row.=A0 You can't be waiting for a hard drive for many of those reads, or it would take a lot longer, so the bottleneck is the CPU pushing the data around in RAM.=A0 I'm not sure why 100% CPU usage would surprise you.=A0 Are you wondering why the CPU works on the query straight through until it is done, rather than taking a break periodically and letting the unfinished work sit there? -- Kevin Grittner EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance