Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 479962E006E for ; Wed, 14 May 2008 08:04:33 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90163-01 for ; Wed, 14 May 2008 08:04:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by developer.postgresql.org (Postfix) with SMTP id 84C342E0031 for ; Wed, 14 May 2008 08:04:24 -0300 (ADT) Received: (qmail 29388 invoked by uid 503); 14 May 2008 11:04:43 -0000 Received: from unknown (HELO mail243.ha.ovh.net) (213.186.33.59) by 30.mail-out.ovh.net with SMTP; 14 May 2008 11:04:43 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 14 May 2008 11:04:18 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13.peufeu.com) (88.161.102.87) by ns0.ovh.net with SMTP; 14 May 2008 11:04:17 -0000 Date: Wed, 14 May 2008 13:10:34 +0200 To: valiouk@yahoo.co.uk, pgsql-performance@postgresql.org Subject: Re: postgres overall performance seems to degrade when large SELECT are requested From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <942836.27599.qm@web25805.mail.ukl.yahoo.com> Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: <942836.27599.qm@web25805.mail.ukl.yahoo.com> User-Agent: Opera Mail/9.24 (Linux) X-Ovh-Tracer-Id: 14353253488557033098 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.651 tagged_above=0 required=5 tests=AWL=0.651 X-Spam-Level: X-Archive-Number: 200805/181 X-Sequence-Number: 30149 > The problem seem to arise when a SELECT that returns a lot of rows is Does the SELECT return a lot of rows, or does it scan a lot of rows ? (for instance, if you use aggregates, it might scan lots of data but only return few rows). > The problem is that when the SELECTs are run the main application starts > running out of available connections which means that postgres is not > returning the query results fast enough. What I find a little bit > starnge is that the report engine's SELECTs operate on a different set > of tables than the ones the main application is using. Also the db box > is hardly breaking a sweat, CPU and memory utilization are ridiculously > low and IOwaits are typically less than 10%. Is it swapping ? (vmstat -> si/so) Is it locking ? (probably not from what you say) Is the network connection between the client and DB server saturated ? (easy with 100 Mbps connections, SELECT with a large result set will happily blast your LAN) Is the reporting tool running on the same machine as the DB client and killing it ? (swapping, etc) If it's a saturated network, solutions are : - install Gb ethernet - run the report on the database server (no bandwidth problems...) - rewrite the reporting tool to use SQL aggregates to transfer less data over the network - or use a cursor to fetch your results in chunks, and wait a little between chunks > Has anyone experienced this? Yeah on benchmarks sometimes the LAN gave up before Postgres broke a sweat... Gb ethernet solved that... > Are there any settings I can change to improve throughput? Any help > will be greatly appreciated. iptraf will tell you all about your network traffic vmstat will tell you if your server or client is io-cpu-swap bound you'd need to post output from those... > > > Thanks, > val > > > __________________________________________________________ > Sent from Yahoo! Mail. > A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html >