From pgsql-performance-owner@postgresql.org Mon Oct 31 22:00:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5ACBCDB5CD for ; Mon, 31 Oct 2005 22:00:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29861-05 for ; Tue, 1 Nov 2005 02:00:14 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id CF951DB5CB for ; Mon, 31 Oct 2005 22:00:16 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EWlRh-0002iE-MA; Tue, 01 Nov 2005 03:00:18 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EWlRq-0001G6-00; Tue, 01 Nov 2005 03:00:26 +0100 Date: Tue, 1 Nov 2005 03:00:26 +0100 From: "Steinar H. Gunderson" To: PostgreSQL Cc: pgsql-performance@postgresql.org Subject: Re: 8.1beta3 performance Message-ID: <20051101020026.GA4707@uio.no> Mail-Followup-To: PostgreSQL , pgsql-performance@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux 2.6.14-rc5 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200510/488 X-Sequence-Number: 15256 On Mon, Oct 31, 2005 at 05:16:46PM -0600, PostgreSQL wrote: > We're running 8.1beta3 on one server and are having ridiculous performance > issues. This is a 2 cpu Opteron box and both processors are staying at 98 > or 99% utilization processing not-that-complex queries. Prior to the > upgrade, our I/O wait time was about 60% and cpu utilization rarely got very > high, now I/O wait time is at or near zero. It sounds like some query got planned a different way that happened to be really suboptimal -- I've seen really bad queries be quick on earlier versions "by accident" and then not have the same luck on later versions. Could you find out what queries are taking so long (use log_min_duration_statement), and post table definitions and EXPLAIN ANALYZE output here? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Mon Oct 31 22:06:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 70E99DB5D5 for ; Mon, 31 Oct 2005 22:06:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31297-02 for ; Tue, 1 Nov 2005 02:06:04 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 5E63BDB5CE for ; Mon, 31 Oct 2005 22:06:06 -0400 (AST) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id CDCE42399F3; Mon, 31 Oct 2005 21:06:10 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 74935-02-10; Mon, 31 Oct 2005 21:06:09 -0500 (EST) Received: from [192.168.1.104] (d226-86-55.home.cgocable.net [24.226.86.55]) by mailbox.samurai.com (Postfix) with ESMTP id 469E8239993; Mon, 31 Oct 2005 21:06:09 -0500 (EST) Subject: Re: 8.1beta3 performance From: Neil Conway To: PostgreSQL Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Date: Mon, 31 Oct 2005 21:06:15 -0500 Message-Id: <1130810775.8561.20.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200510/489 X-Sequence-Number: 15257 On Mon, 2005-31-10 at 17:16 -0600, PostgreSQL wrote: > We're running 8.1beta3 on one server and are having ridiculous performance > issues. This is a 2 cpu Opteron box and both processors are staying at 98 > or 99% utilization processing not-that-complex queries. Prior to the > upgrade, our I/O wait time was about 60% and cpu utilization rarely got very > high, now I/O wait time is at or near zero. Have you done anything to verify that this is actually a problem with 8.1, and not some other change that was made as part of the upgrade process? For example, if ANALYZE hasn't been re-run, that could cause the plans chosen by the optimizer to be completely different. -Neil From pgsql-performance-owner@postgresql.org Tue Nov 1 04:03:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B315DB5DE for ; Tue, 1 Nov 2005 04:03:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21020-10 for ; Tue, 1 Nov 2005 08:03:10 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 581F7DB309 for ; Tue, 1 Nov 2005 04:03:10 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 01 Nov 2005 09:03:10 +0100 Subject: pgbench results interpretation? From: Joost Kraaijeveld To: Pgsql-Performance Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 01 Nov 2005 09:03:09 +0100 Message-Id: <1130832189.21036.19.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.074 required=5 tests=[AWL=0.073, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.074 X-Spam-Level: X-Archive-Number: 200511/1 X-Sequence-Number: 15258 Hi, I am trying to optimize my Debian Sarge AMD64 PostgreSQL 8.0 installation, based on the recommendations from "the Annotated POSTGRESQL.CONF Guide for PostgreSQL" (http://www.powerpostgresql.com/Downloads/annotated_conf_80.html). To see the result of the recommendations I use pgbench from postgresql-contrib. I have 3 questions about pgbench: 1. Is there a repository somewhere that shows results, using and documenting different kinds of hard- and software setups so that I can compare my results with someone elses? 2. Is there a reason for the difference in values from run-to-run of pgbench: The command I used (nothing else is done on the machine, not even mouse movement): jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 1000 test Results for 4 consecutive runs: tps = 272.932982 (including connections establishing) tps = 273.262622 (excluding connections establishing) tps = 199.501426 (including connections establishing) tps = 199.674937 (excluding connections establishing) tps = 400.462117 (including connections establishing) tps = 401.218291 (excluding connections establishing) tps = 223.695331 (including connections establishing) tps = 223.919031 (excluding connections establishing) 3. It appears that running more transactions with the same amount of clients leads to a drop in the transactions per second. I do not understand why this is (a drop from more clients I do understand). Is this because of the way pgbench works, the way PostgrSQL works or even Linux? jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 10 test tps = 379.218809 (including connections establishing) tps = 461.968448 (excluding connections establishing) jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 100 test tps = 533.878031 (including connections establishing) tps = 546.571141 (excluding connections establishing) jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 1000 test tps = 204.344440 (including connections establishing) tps = 204.533627 (excluding connections establishing) jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 10000 test tps = 121.486803 (including connections establishing) tps = 121.493681 (excluding connections establishing) TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Nov 1 05:17:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E0B18DB63C for ; Tue, 1 Nov 2005 05:17:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49039-03 for ; Tue, 1 Nov 2005 09:17:01 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id CD578DB637 for ; Tue, 1 Nov 2005 05:17:01 -0400 (AST) Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id jA19GxMX006160; Tue, 1 Nov 2005 20:16:59 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id jA19Gwr5006157; Tue, 1 Nov 2005 20:16:59 +1100 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Tue, 1 Nov 2005 20:16:58 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: Joost Kraaijeveld Cc: Pgsql-Performance Subject: Re: pgbench results interpretation? In-Reply-To: <1130832189.21036.19.camel@Panoramix> Message-ID: References: <1130832189.21036.19.camel@Panoramix> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/2 X-Sequence-Number: 15259 On Tue, 1 Nov 2005, Joost Kraaijeveld wrote: > Hi, > > I am trying to optimize my Debian Sarge AMD64 PostgreSQL 8.0 > installation, based on the recommendations from "the Annotated > POSTGRESQL.CONF Guide for > PostgreSQL" (http://www.powerpostgresql.com/Downloads/annotated_conf_80.html). To see the result of the recommendations I use pgbench from postgresql-contrib. > > I have 3 questions about pgbench: > > 1. Is there a repository somewhere that shows results, using and > documenting different kinds of hard- and software setups so that I can > compare my results with someone elses? Other than the archives of this mailing list, no. > > 2. Is there a reason for the difference in values from run-to-run of > pgbench: > > The command I used (nothing else is done on the machine, not even mouse > movement): > jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 1000 test > > Results for 4 consecutive runs: > > tps = 272.932982 (including connections establishing) > tps = 273.262622 (excluding connections establishing) > > tps = 199.501426 (including connections establishing) > tps = 199.674937 (excluding connections establishing) > > tps = 400.462117 (including connections establishing) > tps = 401.218291 (excluding connections establishing) > > tps = 223.695331 (including connections establishing) > tps = 223.919031 (excluding connections establishing) Well, firstly: pgbench is not a good benchmarking tool. It is mostly used to generate load. Secondly, the numbers are suspicious: do you have fsync turned off? Do you have write caching enabled? If so, you'd want to make sure that cache is battery backed. Thirdly, the effects of caching will be seen on subsequent runs. > > 3. It appears that running more transactions with the same amount of > clients leads to a drop in the transactions per second. I do not > understand why this is (a drop from more clients I do understand). Is > this because of the way pgbench works, the way PostgrSQL works or even > Linux? > > jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 10 test > tps = 379.218809 (including connections establishing) > tps = 461.968448 (excluding connections establishing) > > jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 100 test > tps = 533.878031 (including connections establishing) > tps = 546.571141 (excluding connections establishing) Well, at this rate pgbench is only running for 2 seconds! > > jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 1000 test > tps = 204.344440 (including connections establishing) > tps = 204.533627 (excluding connections establishing) > > jkr@Panoramix:/usr/lib/postgresql/8.0/bin$ ./pgbench -c 10 -t 10000 test > tps = 121.486803 (including connections establishing) > tps = 121.493681 (excluding connections establishing) > This degradation seems to suggest effects caused by the disk cache filling up (assuming write caching is enabled) and checkpointing. Hope this helps. Gavin From pgsql-performance-owner@postgresql.org Tue Nov 1 06:05:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4BDCDDB637 for ; Tue, 1 Nov 2005 06:05:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67527-01 for ; Tue, 1 Nov 2005 10:05:42 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id D32E5DB62B for ; Tue, 1 Nov 2005 06:05:42 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 01 Nov 2005 11:05:42 +0100 Subject: Re: pgbench results interpretation? From: Joost Kraaijeveld To: Gavin Sherry Cc: Pgsql-Performance In-Reply-To: References: <1130832189.21036.19.camel@Panoramix> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 01 Nov 2005 11:05:42 +0100 Message-Id: <1130839542.3883.19.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.073 required=5 tests=[AWL=0.072, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.073 X-Spam-Level: X-Archive-Number: 200511/3 X-Sequence-Number: 15260 Hi Gavin, Thanks for answering. On Tue, 2005-11-01 at 20:16 +1100, Gavin Sherry wrote: > On Tue, 1 Nov 2005, Joost Kraaijeveld wrote: > > 1. Is there a repository somewhere that shows results, using and > > documenting different kinds of hard- and software setups so that I can > > compare my results with someone elses? > > Other than the archives of this mailing list, no. OK. > > > > 2. Is there a reason for the difference in values from run-to-run of > > pgbench: > Well, firstly: pgbench is not a good benchmarking tool. Is there a reason why that is the case? I would like to understand why? Is it because the transaction is to small/large? Or that the queries are to small/large? Or just experience? > It is mostly used > to generate load. Secondly, the numbers are suspicious: do you have fsync > turned off? In the first trials I posted yes, in the second no. > Do you have write caching enabled? If so, you'd want to make > sure that cache is battery backed. I am aware of that, but for now, I am mostly interested in the effects of the configuration parameters. I won't do this at home ;-) > Thirdly, the effects of caching will be > seen on subsequent runs. In that case I would expect mostly rising values. I only copied and pasted 4 trials that were available in my xterm at the time of writing my email, but I could expand the list ad infinitum: the variance between the runs is very large. I also expect that if there is no shortage of memory wrt caching that the effect would be negligible, but I may be wrong. Part of using pgbench is learning about performance, not achieving it. > > 3. It appears that running more transactions with the same amount of > > clients leads to a drop in the transactions per second. I do not > > understand why this is (a drop from more clients I do understand). Is > > this because of the way pgbench works, the way PostgrSQL works or even > > Linux? > This degradation seems to suggest effects caused by the disk cache filling > up (assuming write caching is enabled) and checkpointing. Which diskcache are your referring to? The onboard harddisk or RAID5 controller caches or the OS cache? The first two I can unstand but if you refer to the OS cache I do not understand what I am seeing. I have enough memory giving the size of the database: during these duration (~) tests fsync was on, and the files could be loaded into memory easily (effective_cache_size = 32768 which is ~ 265 MB, the complete database directory 228 MB) -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Nov 1 09:33:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E234CDB68F for ; Tue, 1 Nov 2005 09:33:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37492-09 for ; Tue, 1 Nov 2005 13:33:44 +0000 (GMT) Received: from tbmail.tradebot.com (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) by svr1.postgresql.org (Postfix) with ESMTP id 55B39DB68C for ; Tue, 1 Nov 2005 09:33:45 -0400 (AST) Received: from 192.168.200.29 ([192.168.200.29]) by tbmail.tradebot.com ([192.168.1.50]) with Microsoft Exchange Server HTTP-DAV ; Tue, 1 Nov 2005 13:33:49 +0000 Received: from krb06 by TBMAIL; 01 Nov 2005 07:33:49 -0600 Subject: Re: 8.x index insert performance From: Kelly Burkhart To: Tom Lane Cc: mark@mark.mielke.cc, Merlin Moncure , pgsql-performance@postgresql.org In-Reply-To: <19065.1130793527@sss.pgh.pa.us> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 01 Nov 2005 07:33:49 -0600 Message-Id: <1130852029.7026.88.camel@krb06.tradebot.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.021 required=5 tests=[AWL=0.020, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.021 X-Spam-Level: X-Archive-Number: 200511/4 X-Sequence-Number: 15261 On Mon, 2005-10-31 at 16:18 -0500, Tom Lane wrote: > Kelly Burkhart writes: > > Ha! So I'm creating an index 98% full of nulls! Looks like this is > > easily fixed with partial indexes. > > Still, though, it's not immediately clear why you'd be seeing a severe > dropoff in insert performance after 50M rows. Even though there are > lots of nulls, I don't see why they'd behave any worse for insert speed > than real data. One would like to think that the insert speed would > follow a nice O(log N) rule. > > Are you doing the inserts all in one transaction, or several? If > several, could you get a gprof profile of inserting the same number of > rows (say a million or so) both before and after the unexpected dropoff > occurs? I'm doing the inserts via libpq copy. Commits are in batches of approx 15000 rows. I did a run last night after modifying the indexes and saw the same pattern. I'm dumping the database now and will modify my test program to copy data from the dump rather than purely generated data. Hopefully, this will allow me to reproduce the problem in a way that takes less time to set up and run. Tom, I'd be happy to profile the backend at several points in the run if you think that would be helpful. What compiler flags should I use? Current settings in Makefile.global are: CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wendif-labels -fno-strict-aliasing Should I change this to: CFLAGS = -g -pg -Wall ... Or should I leave the -O2 in? It may be weekend by the time I get this done. -K From pgsql-performance-owner@postgresql.org Tue Nov 1 09:45:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 045FDD8127 for ; Tue, 1 Nov 2005 09:45:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37976-08 for ; Tue, 1 Nov 2005 13:45:24 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3BC44DB69E for ; Tue, 1 Nov 2005 09:45:26 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA1DjUqf024846; Tue, 1 Nov 2005 08:45:30 -0500 (EST) To: Kelly Burkhart Cc: mark@mark.mielke.cc, Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: 8.x index insert performance In-reply-to: <1130852029.7026.88.camel@krb06.tradebot.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> Comments: In-reply-to Kelly Burkhart message dated "Tue, 01 Nov 2005 07:33:49 -0600" Date: Tue, 01 Nov 2005 08:45:30 -0500 Message-ID: <24845.1130852730@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/5 X-Sequence-Number: 15262 Kelly Burkhart writes: > Tom, I'd be happy to profile the backend at several points in the run if > you think that would be helpful. What compiler flags should I use? Add -g -pg and leave the rest alone. Also, if you're on Linux note that you need -DLINUX_PROFILE. > It may be weekend by the time I get this done. Well, it's probably too late to think of tweaking 8.1 anyway... regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 1 10:14:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00C83DB671 for ; Tue, 1 Nov 2005 10:14:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53522-10 for ; Tue, 1 Nov 2005 14:14:36 +0000 (GMT) Received: from rhws.3times25.net (duck.3times25.net [66.23.211.34]) by svr1.postgresql.org (Postfix) with ESMTP id 05C0DDB69F for ; Tue, 1 Nov 2005 10:14:38 -0400 (AST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by rhws.3times25.net (Postfix) with ESMTP id 08F8CDB92C; Tue, 1 Nov 2005 09:14:51 -0500 (EST) Message-ID: <4367785A.9090709@3times25.net> Date: Tue, 01 Nov 2005 09:14:50 -0500 From: Geoffrey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: solutions for new Postgresql application testing Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200511/6 X-Sequence-Number: 15263 We are going live with a application in a few months that is a complete rewrite of an existing application. We are moving from an existing proprietary database to Postgresql. We are looking for some insight/suggestions as to how folks test Postgresql in such a situation. We really want to run it throught the wringer before going live. I'm throwing together a test suite that consists of mostly perl scripts. I'm wondering what other, if any approaches folks have taken in a similar situation. I know there's nothing like a real live test with real users, and that will happen, but we want to do some semi-automated load testing prior. Anyone ever use any profiling apps (gprof) with any success? We've got a failover cluster design and would like any insights here as well. We're also trying to decide whether a single database with multiple schemas or multiple databases are the best solution. We've done some research on this through the archives, and the answer seems to depend on the database/application design. Still, we welcome any generic ideas on this issue as well. I've not provided any specifics on hardware or application as we really want high level stuff at this time. Thanks for any pointers or suggestions. -- Until later, Geoffrey From pgsql-performance-owner@postgresql.org Tue Nov 1 10:50:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83D5BDA9C4 for ; Tue, 1 Nov 2005 10:50:32 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68554-06 for ; Tue, 1 Nov 2005 14:50:28 +0000 (GMT) Received: from mail1.npci.com (mail.npcinternational.com [63.76.154.140]) by svr1.postgresql.org (Postfix) with ESMTP id 539F9DB6C3 for ; Tue, 1 Nov 2005 10:50:30 -0400 (AST) Received: from fc63r41.npci.com ([172.16.0.131]) by mail1.npci.com (MOS 3.5.9-GR) with ESMTP id BXH01235 (AUTH via LOGINBEFORESMTP); Tue, 1 Nov 2005 08:45:20 -0600 (CST) Date: Tue, 1 Nov 2005 08:50:37 -0600 From: Jon Brisbin To: pgsql-performance@postgresql.org Subject: Re: 8.1beta3 performance Message-ID: <20051101085037.1b12b077@fc63r41.npci.com> In-Reply-To: References: Organization: NPC International X-Mailer: Sylpheed-Claws 1.9.13 (GTK+ 2.6.9; i386-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.234 required=5 tests=[AWL=0.234] X-Spam-Score: 0.234 X-Spam-Level: X-Archive-Number: 200511/7 X-Sequence-Number: 15264 On Mon, 31 Oct 2005 17:16:46 -0600 "PostgreSQL" wrote: > We're running 8.1beta3 on one server and are having ridiculous > performance issues. This is a 2 cpu Opteron box and both processors > are staying at 98 or 99% utilization processing not-that-complex > queries. Prior to the upgrade, our I/O wait time was about 60% and > cpu utilization rarely got very high, now I/O wait time is at or near > zero. > > I'm planning to go back to 8.0 tonight or tomorrow night but thought > I'd check the pqsql-performance prophets before I gave it up. I have a stock FreeBSD 5.4 box that I put 8.1 on last night. I ran pgbench against it and my tps dropped from ~300tps in 8.0.3 to 20tps in 8.1. That's right. 20. No changes in any system configuration. No data in the new 8.1 database, only the pgbench init'ed stuff. 25 clients, 100 and 1000 transactions with a scaling factor of 10, which gives me 1,000,000 tuples to shoot through. I wiped out the 8.1 installation, put 8.0.4 in it's place, and pgbenched it again. ~300tps again. It's not a problem with system configuration if 8.0 works fine, but 8.1 has problems, unless there is something that 8.1 needs tweaked that 8.0 doesn't. In that case, I just need to know what that is and I can tweak it. Dual Xeon 2.6GB HTT PowerEdge, 4GB RAM, RAID 5 FreeBSD 5.4 RELEASE, custom-compiled kernel CFLAGS=-O3 -funroll-loops -pipe (also tried -O2, same difference) Jon Brisbin Webmeister NPC International, Inc. From pgsql-performance-owner@postgresql.org Tue Nov 1 11:37:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CEB0CDB654 for ; Tue, 1 Nov 2005 11:37:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94923-03 for ; Tue, 1 Nov 2005 15:37:30 +0000 (GMT) Received: from pop-cowbird.atl.sa.earthlink.net (pop-cowbird.atl.sa.earthlink.net [207.69.195.68]) by svr1.postgresql.org (Postfix) with ESMTP id 2E915DB631 for ; Tue, 1 Nov 2005 11:37:33 -0400 (AST) Received: from elwamui-norfolk.atl.sa.earthlink.net ([209.86.224.43]) by pop-cowbird.atl.sa.earthlink.net with esmtp (Exim 3.36 #10) id 1EWyCd-0004TZ-00; Tue, 01 Nov 2005 10:37:35 -0500 Message-ID: <867256.1130859455220.JavaMail.root@elwamui-norfolk.atl.sa.earthlink.net> Date: Tue, 1 Nov 2005 10:37:35 -0500 (GMT-05:00) From: Ron Peacetree Reply-To: Ron Peacetree To: Kelly Burkhart , pgsql-performance@postgresql.org Subject: Re: 8.x index insert performance Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: EarthLink Zoo Mail 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.072 required=5 tests=[AWL=0.072] X-Spam-Score: 0.072 X-Spam-Level: X-Archive-Number: 200511/8 X-Sequence-Number: 15265 I'm surprised that no one seems to have yet suggested the following simple experiment: Increase the RAM 4GB -> 8GB, tune for best performance, and repeat your 100M row insert experiment. Does overall insert performance change? Does the performance drop rows in still occur? Does it occur in ~ the same place? Etc. If the effect does seem to be sensitive to the amount of RAM in the server, it might be worth redoing the experiment(s) with 2GB and 16GB as well... ron -----Original Message----- From: Kelly Burkhart Sent: Oct 31, 2005 12:12 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] 8.x index insert performance Greetings, We are running some performance tests in which we are attempting to insert about 100,000,000 rows in a database at a sustained rate. About 50M rows in, our performance drops dramatically. This test is with data that we believe to be close to what we will encounter in production. However in tests with purely generated, sequential data, we did not notice this slowdown. I'm trying to figure out what patterns in the "real" data may be causing us problems. I have log,data and indexes on separate LUNs on an EMC SAN. Prior to slowdown, each partition is writing at a consistent rate. Index partition is reading at a much lower rate. At the time of slowdown, index partition read rate increases, all write rates decrease. CPU utilization drops. The server is doing nothing aside from running the DB. It is a dual opteron (dual core, looks like 4 cpus) with 4GB RAM. shared_buffers = 32768. fsync = off. Postgres version is 8.1.b4. OS is SuSE Enterprise server 9. My leading hypothesis is that one indexed column may be leading to our issue. The column in question is a varchar(12) column which is non-null in about 2% of the rows. The value of this column is 5 characters which are the same for every row, followed by a 7 character zero filled base 36 integer. Thus, every value of this field will be exactly 12 bytes long, and will be substantially the same down to the last bytes. Could this pattern be pessimal for a postgresql btree index? I'm running a test now to see if I can verify, but my runs take quite a long time... If this sounds like an unlikely culprit how can I go about tracking down the issue? Thanks, -K ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Nov 1 11:49:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6B237DB6B2 for ; Tue, 1 Nov 2005 11:49:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95306-07 for ; Tue, 1 Nov 2005 15:49:44 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id D401CDB684 for ; Tue, 1 Nov 2005 11:49:45 -0400 (AST) Received: from mailgate.vale-housing.co.uk ([194.217.48.34] helo=vale-housing.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) id 1EWyHs-000DuB-GW for pgsql-performance@postgresql.org; Tue, 01 Nov 2005 15:43:06 +0000 Received: from 84.13.26.127 ([84.13.26.127]) by ratbert.vale-housing.co.uk ([192.168.1.106]) with Microsoft Exchange Server HTTP-DAV ; Tue, 1 Nov 2005 15:49:15 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 01 Nov 2005 15:49:14 +0000 Subject: Re: 8.1beta3 performance From: Dave Page To: Jon Brisbin , Message-ID: Thread-Topic: [PERFORM] 8.1beta3 performance Thread-Index: AcXe+87xDZdLP0rvEdqyyQARJHpWaA== In-Reply-To: <20051101085037.1b12b077@fc63r41.npci.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.388 required=5 tests=[AWL=0.135, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.388 X-Spam-Level: * X-Archive-Number: 200511/9 X-Sequence-Number: 15266 On 1/11/05 2:50 pm, "Jon Brisbin" wrote: > On Mon, 31 Oct 2005 17:16:46 -0600 > "PostgreSQL" wrote: > >> We're running 8.1beta3 on one server and are having ridiculous >> performance issues. This is a 2 cpu Opteron box and both processors >> are staying at 98 or 99% utilization processing not-that-complex >> queries. Prior to the upgrade, our I/O wait time was about 60% and >> cpu utilization rarely got very high, now I/O wait time is at or near >> zero. >> >> I'm planning to go back to 8.0 tonight or tomorrow night but thought >> I'd check the pqsql-performance prophets before I gave it up. > > I have a stock FreeBSD 5.4 box that I put 8.1 on last night. I ran > pgbench against it and my tps dropped from ~300tps in 8.0.3 to 20tps > in 8.1. That's right. 20. No changes in any system configuration. No > data in the new 8.1 database, only the pgbench init'ed stuff. 25 > clients, 100 and 1000 transactions with a scaling factor of 10, which > gives me 1,000,000 tuples to shoot through. > > I wiped out the 8.1 installation, put 8.0.4 in it's place, and > pgbenched it again. ~300tps again. > > It's not a problem with system configuration if 8.0 works fine, but 8.1 > has problems, unless there is something that 8.1 needs tweaked that 8.0 > doesn't. In that case, I just need to know what that is and I can tweak > it. Hi Jon, Did you run the bundled version of pgbench against it's own installation? There we some changes to pgbench for 8.1, and I have to wonder (bearing in mind I haven't really looked at them) whether they could be affecting things in any way. Do you get comparable results running the 8.0 pgbench against both server versions? Regards, Dave From pgsql-performance-owner@postgresql.org Tue Nov 1 13:25:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91A36DB6CB for ; Tue, 1 Nov 2005 13:25:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80423-10 for ; Tue, 1 Nov 2005 17:24:53 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id EAECADB6A4 for ; Tue, 1 Nov 2005 13:24:52 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA1HOheB026530; Tue, 1 Nov 2005 12:24:43 -0500 (EST) To: Jon Brisbin Cc: pgsql-performance@postgresql.org Subject: Re: 8.1beta3 performance In-reply-to: <20051101085037.1b12b077@fc63r41.npci.com> References: <20051101085037.1b12b077@fc63r41.npci.com> Comments: In-reply-to Jon Brisbin message dated "Tue, 01 Nov 2005 08:50:37 -0600" Date: Tue, 01 Nov 2005 12:24:43 -0500 Message-ID: <26529.1130865883@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/10 X-Sequence-Number: 15267 Jon Brisbin writes: > I have a stock FreeBSD 5.4 box that I put 8.1 on last night. I ran > pgbench against it and my tps dropped from ~300tps in 8.0.3 to 20tps > in 8.1. That's right. 20. No changes in any system configuration. You sure about that last? These numbers are kind of consistent with the idea that fsync is off in the 8.0 database and on in the 8.1 database. Using the same test case you mention (pgbench -s 10, -c 25 -t 1000), I find that 8.1 is a bit faster than 8.0, eg 8.1 fsync off: tps = 89.831186 (including connections establishing) tps = 89.865065 (excluding connections establishing) 8.1 fsync on: tps = 74.865078 (including connections establishing) tps = 74.889066 (excluding connections establishing) 8.0 fsync off: tps = 80.271338 (including connections establishing) tps = 80.302054 (excluding connections establishing) 8.0 fsync on: tps = 67.405708 (including connections establishing) tps = 67.426546 (excluding connections establishing) (All database parameters are defaults except fsync.) These numbers are with assert-enabled builds, on a cheap PC whose drive lies about write-complete, so they're not very representative of the real world I suppose. But I'm sure not seeing any 10x degradation. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 1 15:00:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5FDCEDB70A for ; Tue, 1 Nov 2005 15:00:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50027-08 for ; Tue, 1 Nov 2005 19:00:18 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id D9390DB70E for ; Tue, 1 Nov 2005 15:00:17 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: improvise callbacks in plpgsql Date: Tue, 1 Nov 2005 14:00:00 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD754@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: improvise callbacks in plpgsql Thread-Index: AcXfFnVc2Rgg/SN8R1qNBfDbkPYJtA== From: "Merlin Moncure" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.048 required=5 tests=[AWL=0.048] X-Spam-Score: 0.048 X-Spam-Level: X-Archive-Number: 200511/11 X-Sequence-Number: 15268 hello performance minded administrators: We have recently converted a number of routines that walk a bill of materials (which is a nested structure) from the application side to the server side via recursive plpgsql functions. The performance is absolutely fantastic but I have to maintain a specialized 'walker' for each specific task that I have to do. It would be very nice and elegant if I could pass in the function for the walker to execute while it is iterating through the bill of materials. I have been beating my head against the wall for the best way to do this so here I am shopping for ideas. A simplified idealized version of what I would like to do is=20 begin select (callback_routine)(record_type) end; from within a plpgsql function. I am borrowing the C syntax for a function pointer here. The problem I am running into is the only way to do callbacks is via dynamic sql...however you can use higher level types such as row/record type in dynamic sql (at least not efficiently). I could of course make a full dynamic sql call by expanding the record type into a large parameter list but this is unwieldy and brittle. Any thoughts? Merlin From pgsql-performance-owner@postgresql.org Tue Nov 1 15:39:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 11097DB15F for ; Tue, 1 Nov 2005 15:39:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81931-09 for ; Tue, 1 Nov 2005 19:39:38 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 4097FDB0A8 for ; Tue, 1 Nov 2005 15:39:37 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: solutions for new Postgresql application testing Date: Tue, 1 Nov 2005 14:39:38 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD759@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] solutions for new Postgresql application testing Thread-Index: AcXe7wWehAxUwKokQzKAaFnhSWI4swAKE92w From: "Merlin Moncure" To: "Geoffrey" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/12 X-Sequence-Number: 15269 Geoffrey wrote: > We are going live with a application in a few months that is a complete > rewrite of an existing application. We are moving from an existing > proprietary database to Postgresql. We are looking for some > insight/suggestions as to how folks test Postgresql in such a situation. Shouldn't you run your tests *before* rewriting your application? :). You don't have to answer that. > We're also trying to decide whether a single database with multiple > schemas or multiple databases are the best solution. We've done some > research on this through the archives, and the answer seems to depend on > the database/application design. Still, we welcome any generic ideas on > this issue as well. I can help a little bit here. Yes, this decision will be heavily influenced by application design. Let's assume you have to keep multiple identical table sets (suppose you have multiple companies on the same server for example). Here are some general stipulations: Reasons to use schemas: * If you have a requirement where data must be queried from multiple data stores at the same time, or between various data stores and a shared area, this argues for schemas. While it is possible to do this without schemas via dblink, which is the postgresql inter-database rpc, performance can be an issue and there is some overhead of setting it up. * If you need to swap out data stores on the fly without reconnecting, then this argues strongly in favor of schemas. With schemas, you can manipulate which datastore you are using by simply manipulating the search_path. There is one big caveat to this: your non dynamic pl/pgsql functions will stick to the tables they use following the first time you run them like suction cups. Worse, your sql functions will stick to the tables they refer to when compiled, making non-immutable sql functions a no-no in a multi-schema environment. However, there is a clever workaround to this by force recompiling you pl/pgsql functions (search the recent archives on this list). * Finally, since multiple schemas can share a common public area, this means that if you have to deploy database features that apply to all of your datastores, you can sometimes get away with sticking them in a public area of the databse...server side utility functions are an example of this. Reasons to use databases: * Certain third party tools may have trouble with schemas. * Manipulating the search path can be error prone and relatively tedious. * Database are more fully separate. I run multi schema, and I make heavy use of the userlock contrib module. This means I have to take special care not to have inter-schema overlap of my lock identifier. There are other cases where this might bite you, for example if you wanted one data store to respond to notifications but not another. These are solvable problems, but can be a headache. In short, there are pros and cons either way. If it's any help, the servers I administrate, which have *really complex* data interdependency and isolation requirements, use schemas for the extra flexibility. Merlin From pgsql-performance-owner@postgresql.org Tue Nov 1 17:29:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B7F96DB735 for ; Tue, 1 Nov 2005 17:29:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44368-02 for ; Tue, 1 Nov 2005 21:29:20 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4F359DB733 for ; Tue, 1 Nov 2005 17:29:21 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA1LTNle028344; Tue, 1 Nov 2005 16:29:23 -0500 (EST) To: "Merlin Moncure" Cc: pgsql-performance@postgresql.org Subject: Re: improvise callbacks in plpgsql In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD754@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD754@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Tue, 01 Nov 2005 14:00:00 -0500" Date: Tue, 01 Nov 2005 16:29:22 -0500 Message-ID: <28343.1130880562@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/13 X-Sequence-Number: 15270 "Merlin Moncure" writes: > A simplified idealized version of what I would like to do is > begin > select (callback_routine)(record_type) > end; > from within a plpgsql function. I am borrowing the C syntax for a > function pointer here. Well, there's no function pointer type in SQL :-(. I don't see any way to do what you want in pure plpgsql. If you're willing to implement an auxiliary C function you could probably make it go: create function callit(oid, record) returns void ... where the OID has to be the OID of a function taking a record-type argument. The regprocedure pseudotype would allow you not to need to write any numeric OIDs in your code: select callit('myfunc(record)'::regprocedure, recordvar); The body of callit() need be little more than OidFunctionCall1() plus whatever error checking and security checking you want to include. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 1 18:13:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7B699DB1B9 for ; Tue, 1 Nov 2005 18:13:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56675-10 for ; Tue, 1 Nov 2005 22:13:47 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 00C50DB165 for ; Tue, 1 Nov 2005 18:13:48 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: improvise callbacks in plpgsql Date: Tue, 1 Nov 2005 17:13:48 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD767@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] improvise callbacks in plpgsql Thread-Index: AcXfK1UD9TahUbk7Rl+KStGUxj01mAABbwKQ From: "Merlin Moncure" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/14 X-Sequence-Number: 15271 > The body of callit() need be little more than OidFunctionCall1() > plus whatever error checking and security checking you want to > include. esp=3D# create table test(f text); CREATE TABLE esp=3D# create function test() returns void as=20 $$=20 begin=20 insert into test values ('called');=20 end;=20 $$ language plpgsql; esp=3D# create or replace function test2() returns void as esp-# $$ esp$# declare esp$# r record; esp$# begin esp$# select into r 'abc'; esp$# perform callit('test()'::regprocedure, r); esp$# end; esp$# esp$# $$ language plpgsql; CREATE FUNCTION esp=3D# select test2(); esp=3D# select * from test; f -------- called (1 row) one word... w00t Merlin From pgsql-performance-owner@postgresql.org Tue Nov 1 19:04:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8AAECDB72E for ; Tue, 1 Nov 2005 19:04:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24173-03 for ; Tue, 1 Nov 2005 23:04:36 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id 9AA11DB722 for ; Tue, 1 Nov 2005 19:04:37 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 7843915257; Tue, 1 Nov 2005 17:04:40 -0600 (CST) Date: Tue, 1 Nov 2005 17:04:40 -0600 From: "Jim C. Nasby" To: Merlin Moncure Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: improvise callbacks in plpgsql Message-ID: <20051101230440.GU20349@pervasive.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD767@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD767@Herge.rcsinc.local> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/15 X-Sequence-Number: 15272 Would you be willing to write up an example of this? We often get asked about support for WITH, so I bet there's other people who would be very interested in what you've got. On Tue, Nov 01, 2005 at 05:13:48PM -0500, Merlin Moncure wrote: > > The body of callit() need be little more than OidFunctionCall1() > > plus whatever error checking and security checking you want to > > include. > > esp=# create table test(f text); > CREATE TABLE > > esp=# create function test() returns void as > $$ > begin > insert into test values ('called'); > end; > $$ language plpgsql; > > esp=# create or replace function test2() returns void as > esp-# $$ > esp$# declare > esp$# r record; > esp$# begin > esp$# select into r 'abc'; > esp$# perform callit('test()'::regprocedure, r); > esp$# end; > esp$# > esp$# $$ language plpgsql; > CREATE FUNCTION > > esp=# select test2(); > > esp=# select * from test; > f > -------- > called > (1 row) > > one word... > w00t > > Merlin > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Nov 1 19:12:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B5CD7DB72F for ; Tue, 1 Nov 2005 19:12:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25607-04 for ; Tue, 1 Nov 2005 23:12:24 +0000 (GMT) Received: from www.3times25.net (duck.3times25.net [66.23.211.34]) by svr1.postgresql.org (Postfix) with ESMTP id 3E3C1DB729 for ; Tue, 1 Nov 2005 19:12:26 -0400 (AST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by www.3times25.net (Postfix) with ESMTP id 25C16DB92C for ; Tue, 1 Nov 2005 18:12:37 -0500 (EST) Message-ID: <4367F664.1010709@3times25.net> Date: Tue, 01 Nov 2005 18:12:36 -0500 From: Geoffrey User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: solutions for new Postgresql application testing References: <6EE64EF3AB31D5448D0007DD34EEB3417DD759@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD759@Herge.rcsinc.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200511/16 X-Sequence-Number: 15273 Merlin Moncure wrote: > Geoffrey wrote: > >>We are going live with a application in a few months that is a complete >>rewrite of an existing application. We are moving from an existing >>proprietary database to Postgresql. We are looking for some >>insight/suggestions as to how folks test Postgresql in such a situation. > > Shouldn't you run your tests *before* rewriting your application? :). > You don't have to answer that. The logic has been proven. What we want to really test is loading and the remote possibility that the compiler built code based on what we wrote, rather then what we thought. :) >>We're also trying to decide whether a single database with multiple >>schemas or multiple databases are the best solution. We've done some >>research on this through the archives, and the answer seems to depend on >>the database/application design. Still, we welcome any generic ideas >>on this issue as well. > > I can help a little bit here. Yes, this decision will be heavily > influenced by application design. Let's assume you have to keep > multiple identical table sets (suppose you have multiple companies on > the same server for example). Here are some general stipulations: Thanks muchly for your insights. Just the kind of info we're looking for. Now if I could only find that mind reading compiler. We lean towards multiple databases when thinking about the possible need to bring down a single database without affecting the others. We do require access to multiple datastores, but that is relatively easily done with either schemas or databases with perl and C, which are our tools of choice. These databases are pretty much identical in design, simply for different 'parts' of the business. Any further thoughts are, of course, still welcome. -- Until later, Geoffrey From pgsql-performance-owner@postgresql.org Tue Nov 1 19:16:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46AB5DB641 for ; Tue, 1 Nov 2005 19:16:58 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28103-07 for ; Tue, 1 Nov 2005 23:16:55 +0000 (GMT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.205]) by svr1.postgresql.org (Postfix) with ESMTP id DCFB8DB62B for ; Tue, 1 Nov 2005 19:16:56 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so1385291wxc for ; Tue, 01 Nov 2005 15:16:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=T56u6rc33hcMXRnQMaqH0YBbM0M7CrCESW3R4uKzWTYpBejvVVtrBE/ssp9RaEpCcOpnWyZ3bIoxGSbAdmhvIT4XBFqBryTACGDEwZ/v/UkswULRVrZKV5O+auFeG6/a7yaDbvRmF7LiVbOidlonxmlcjB87bsN8h19FrPslKsc= Received: by 10.70.42.15 with SMTP id p15mr2792127wxp; Tue, 01 Nov 2005 15:16:59 -0800 (PST) Received: by 10.70.132.7 with HTTP; Tue, 1 Nov 2005 15:16:59 -0800 (PST) Message-ID: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> Date: Tue, 1 Nov 2005 18:16:59 -0500 From: Mitch Pirtle To: "pgsql-performance@postgresql.org" Subject: Joining views disables indexes? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.079 required=5 tests=[AWL=0.079] X-Spam-Score: 0.079 X-Spam-Level: X-Archive-Number: 200511/17 X-Sequence-Number: 15274 I have a client that is testing an internal data platform, and they were happy with PostgreSQL until they tried to join views - at that time they discovered PostgreSQL was not using the indexes, and the queries took 24 hours to execute as a result. Is this a known issue, or is this possibly a site-specific problem? They just implemented the exact same datamodel in MySQL 5.0, with views and InnoDB tables, and performance is still subsecond. Would love to know if this is a known issue. -- Mitch From pgsql-performance-owner@postgresql.org Tue Nov 1 19:23:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BA813DB704 for ; Tue, 1 Nov 2005 19:23:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28631-08 for ; Tue, 1 Nov 2005 23:23:11 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id 7D192DB6BE for ; Tue, 1 Nov 2005 19:23:12 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id EF44115257; Tue, 1 Nov 2005 17:23:14 -0600 (CST) Date: Tue, 1 Nov 2005 17:23:14 -0600 From: "Jim C. Nasby" To: Mitch Pirtle Cc: "pgsql-performance@postgresql.org" Subject: Re: Joining views disables indexes? Message-ID: <20051101232314.GV20349@pervasive.com> References: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/18 X-Sequence-Number: 15275 On Tue, Nov 01, 2005 at 06:16:59PM -0500, Mitch Pirtle wrote: > I have a client that is testing an internal data platform, and they > were happy with PostgreSQL until they tried to join views - at that > time they discovered PostgreSQL was not using the indexes, and the > queries took 24 hours to execute as a result. > > Is this a known issue, or is this possibly a site-specific problem? > > They just implemented the exact same datamodel in MySQL 5.0, with > views and InnoDB tables, and performance is still subsecond. > > Would love to know if this is a known issue. Views simply get expanded to a full query, so the views have nothing to do with it. Make sure that they've run analyze on the entire database. Upping default_statistics_target to 100 is probably a good idea as well. If that doesn't work, get an explain analyze of the query and post it here. You can try posting just an explain, but that's much less useful. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Tue Nov 1 19:28:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ECACEDB62B for ; Tue, 1 Nov 2005 19:28:03 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34024-01 for ; Tue, 1 Nov 2005 23:28:00 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 8881EDB53D for ; Tue, 1 Nov 2005 19:28:01 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EX5Xu-00036E-27; Wed, 02 Nov 2005 00:28:03 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EX5Y8-00041j-00; Wed, 02 Nov 2005 00:28:16 +0100 Date: Wed, 2 Nov 2005 00:28:16 +0100 From: "Steinar H. Gunderson" To: Mitch Pirtle Cc: "pgsql-performance@postgresql.org" Subject: Re: Joining views disables indexes? Message-ID: <20051101232816.GA15321@uio.no> Mail-Followup-To: Mitch Pirtle , "pgsql-performance@postgresql.org" References: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> X-Operating-System: Linux 2.6.14-rc5 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/19 X-Sequence-Number: 15276 On Tue, Nov 01, 2005 at 06:16:59PM -0500, Mitch Pirtle wrote: > I have a client that is testing an internal data platform, and they > were happy with PostgreSQL until they tried to join views - at that > time they discovered PostgreSQL was not using the indexes, and the > queries took 24 hours to execute as a result. > > Is this a known issue, or is this possibly a site-specific problem? This is way too general to give a good solution. In general, PostgreSQL should have no problem using indexes on joins (in versions before 8.0, there was a problem using indexes on joins of differing data types, though). This does of course assume that its statistics are good; I assume you've doing ANALYZE on the database after loading the database? What you want to do is to post your table definitions and EXPLAIN ANALYZE output of a slow query; that could be difficult if it takes 24 hours, though, so you might try a slightly quicker query for starters. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Nov 1 19:28:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F047FDB706 for ; Tue, 1 Nov 2005 19:28:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34047-02 for ; Tue, 1 Nov 2005 23:28:42 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A46E2DB724 for ; Tue, 1 Nov 2005 19:28:43 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA1NSiWh029381; Tue, 1 Nov 2005 18:28:44 -0500 (EST) To: Mitch Pirtle Cc: "pgsql-performance@postgresql.org" Subject: Re: Joining views disables indexes? In-reply-to: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> References: <330532b60511011516u3709d826w391a4ac167c6967b@mail.gmail.com> Comments: In-reply-to Mitch Pirtle message dated "Tue, 01 Nov 2005 18:16:59 -0500" Date: Tue, 01 Nov 2005 18:28:44 -0500 Message-ID: <29380.1130887724@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/20 X-Sequence-Number: 15277 Mitch Pirtle writes: > I have a client that is testing an internal data platform, and they > were happy with PostgreSQL until they tried to join views - at that > time they discovered PostgreSQL was not using the indexes, and the > queries took 24 hours to execute as a result. You'll need to provide some actual details if you want useful comments. Let's see the table schemas, the view definitions, and the EXPLAIN plan (I'll spare you a request for EXPLAIN ANALYZE given that it'd take 24 hours to get ;-) ... although some estimate of the number of rows expected would be helpful). And I trust they remembered to ANALYZE the underlying tables first? Also, which PG version exactly? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 1 21:19:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 52EF4DA827 for ; Tue, 1 Nov 2005 21:19:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79927-10 for ; Wed, 2 Nov 2005 01:19:22 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 40740D783D for ; Tue, 1 Nov 2005 21:19:24 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 85F8A30EC7; Wed, 2 Nov 2005 02:19:27 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: performance of implicit join vs. explicit conditions on inet queries? Date: Tue, 1 Nov 2005 20:19:37 -0500 Organization: Hub.Org Networking Services Lines: 30 Message-ID: References: <20051024035809.GA18261@edmonds.ath.cx> <29864.1130768650@sss.pgh.pa.us> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.573 required=5 tests=[AWL=0.573] X-Spam-Score: 0.573 X-Spam-Level: X-Archive-Number: 200511/21 X-Sequence-Number: 15278 "Tom Lane" wrote > > No, that's completely irrelevant to his problem. The reason we can't do > this is that the transformation from "x << const" to a range check on x > is a plan-time transformation; there's no mechanism in place to do it > at runtime. This is not easy to fix, because the mechanism that's doing > it is primarily intended for LIKE/regex index optimization, and in that > case a runtime pattern might well not be optimizable at all. > Not quite understand, sorry ... (1) For this query (in an as-is PG syntax, which find out all rectangles lie in a given rectangle) : SELECT r FROM all_rectangles WHERE r << rectangle('(1,9),(9,1)'); If there is a GiST/Rtree index associated with all_rectangles.r, how do optimizer estimate the cost to decide that we should use this index or not(then by a seqscan)? (2) Does your above explaination mean that we can't use GiST for a spatial join operation? Regards, Qingqing From pgsql-performance-owner@postgresql.org Wed Nov 2 00:20:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F96DD6822 for ; Wed, 2 Nov 2005 00:20:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48324-10 for ; Wed, 2 Nov 2005 04:20:54 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 17952D680A for ; Wed, 2 Nov 2005 00:20:53 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA24Kqu8001208; Tue, 1 Nov 2005 23:20:52 -0500 (EST) To: "Qingqing Zhou" Cc: pgsql-performance@postgresql.org Subject: Re: performance of implicit join vs. explicit conditions on inet queries? In-reply-to: References: <20051024035809.GA18261@edmonds.ath.cx> <29864.1130768650@sss.pgh.pa.us> Comments: In-reply-to "Qingqing Zhou" message dated "Tue, 01 Nov 2005 20:19:37 -0500" Date: Tue, 01 Nov 2005 23:20:52 -0500 Message-ID: <1207.1130905252@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/22 X-Sequence-Number: 15279 "Qingqing Zhou" writes: > "Tom Lane" wrote >> No, that's completely irrelevant to his problem. The reason we can't do >> this is that the transformation from "x << const" to a range check on x >> is a plan-time transformation; there's no mechanism in place to do it >> at runtime. > Not quite understand, sorry ... > (1) For this query (in an as-is PG syntax, which find out all rectangles lie > in a given rectangle) : > SELECT r FROM all_rectangles > WHERE r << rectangle('(1,9),(9,1)'); No, you're thinking of the wrong << operator. The question was about the inet network inclusion operator. We have a special case in indxpath.c to transform "inetcol << inetconstant" into a range check on the inet variable, much like we can transform a left-anchored LIKE pattern into a range check on the text variable. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Nov 2 05:32:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C0D5CD6842 for ; Wed, 2 Nov 2005 05:32:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59306-06 for ; Wed, 2 Nov 2005 09:32:53 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id BFBB5D6819 for ; Wed, 2 Nov 2005 05:32:53 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 45A4E31058; Wed, 2 Nov 2005 10:32:54 +0100 (MET) From: "PostgreSQL" X-Newsgroups: pgsql.performance Subject: Re: 8.1beta3 performance Date: Wed, 2 Nov 2005 03:32:45 -0600 Organization: Hub.Org Networking Services Lines: 49 Message-ID: References: <20051101085037.1b12b077@fc63r41.npci.com> <26529.1130865883@sss.pgh.pa.us> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/23 X-Sequence-Number: 15280 I'm seeing some other little oddities in the beta as well. I'm watching an ALTER TABLE ADD COLUMN right now that has been running almost two hours. I stopped it the first time at 1 hour; I suppose I'll let it go this time and see if it ever completes. The table is about 150K rows. Top, vmstat, and iostat show almost no cpu or disk activity (1 to 3%) - it's as if it just went to sleep. "Tom Lane" wrote in message news:26529.1130865883@sss.pgh.pa.us... > Jon Brisbin writes: >> I have a stock FreeBSD 5.4 box that I put 8.1 on last night. I ran >> pgbench against it and my tps dropped from ~300tps in 8.0.3 to 20tps >> in 8.1. That's right. 20. No changes in any system configuration. > > You sure about that last? These numbers are kind of consistent with the > idea that fsync is off in the 8.0 database and on in the 8.1 database. > > Using the same test case you mention (pgbench -s 10, -c 25 -t 1000), > I find that 8.1 is a bit faster than 8.0, eg > > 8.1 fsync off: > tps = 89.831186 (including connections establishing) > tps = 89.865065 (excluding connections establishing) > > 8.1 fsync on: > tps = 74.865078 (including connections establishing) > tps = 74.889066 (excluding connections establishing) > > 8.0 fsync off: > tps = 80.271338 (including connections establishing) > tps = 80.302054 (excluding connections establishing) > > 8.0 fsync on: > tps = 67.405708 (including connections establishing) > tps = 67.426546 (excluding connections establishing) > > (All database parameters are defaults except fsync.) > > These numbers are with assert-enabled builds, on a cheap PC whose drive > lies about write-complete, so they're not very representative of the > real world I suppose. But I'm sure not seeing any 10x degradation. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Wed Nov 2 06:16:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A1F3D6878 for ; Wed, 2 Nov 2005 06:16:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69336-07 for ; Wed, 2 Nov 2005 10:16:31 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id 9B333D6874 for ; Wed, 2 Nov 2005 06:16:30 -0400 (AST) Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id jA2AGS2V014959; Wed, 2 Nov 2005 21:16:28 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id jA2AGRkH014956; Wed, 2 Nov 2005 21:16:28 +1100 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Wed, 2 Nov 2005 21:16:27 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: Joost Kraaijeveld Cc: Pgsql-Performance Subject: Re: pgbench results interpretation? In-Reply-To: <1130839542.3883.19.camel@Panoramix> Message-ID: References: <1130832189.21036.19.camel@Panoramix> <1130839542.3883.19.camel@Panoramix> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/24 X-Sequence-Number: 15281 On Tue, 1 Nov 2005, Joost Kraaijeveld wrote: > Hi Gavin, > > Thanks for answering. > > On Tue, 2005-11-01 at 20:16 +1100, Gavin Sherry wrote: > > On Tue, 1 Nov 2005, Joost Kraaijeveld wrote: > > > 1. Is there a repository somewhere that shows results, using and > > > documenting different kinds of hard- and software setups so that I can > > > compare my results with someone elses? > > > > Other than the archives of this mailing list, no. > OK. > > > > > > > 2. Is there a reason for the difference in values from run-to-run of > > > pgbench: > > Well, firstly: pgbench is not a good benchmarking tool. > Is there a reason why that is the case? I would like to understand why? > Is it because the transaction is to small/large? Or that the queries are > to small/large? Or just experience? > > > It is mostly used > > to generate load. Secondly, the numbers are suspicious: do you have fsync > > turned off? > In the first trials I posted yes, in the second no. > > > Do you have write caching enabled? If so, you'd want to make > > sure that cache is battery backed. > I am aware of that, but for now, I am mostly interested in the effects > of the configuration parameters. I won't do this at home ;-) Well, pgbench (tpc-b) suffers from inherent concurrency issues because all connections are updating the branches table heavily. As an aside, did you initialise with a scaling factor of 10 to match your level of concurrency? > > > > Thirdly, the effects of caching will be > > seen on subsequent runs. > In that case I would expect mostly rising values. I only copied and > pasted 4 trials that were available in my xterm at the time of writing > my email, but I could expand the list ad infinitum: the variance between > the runs is very large. I also expect that if there is no shortage of > memory wrt caching that the effect would be negligible, but I may be > wrong. Part of using pgbench is learning about performance, not > achieving it. Right. it is well known that performance with pgbench can vary wildly. I usually get a lot less variation than you are getting. My point is though, it's not a great indication of performance. I generally simulate the real application running in production and test configuration changes with that. The hackers list archive also contains links to the testing Mark Wong has been doing at OSDL with TPC-C and TPC-H. Taking a look at the configuration file he is using, along with the annotated postgresql.conf, would be useful, depending on the load you're antipating and your hardware. > > > > 3. It appears that running more transactions with the same amount of > > > clients leads to a drop in the transactions per second. I do not > > > understand why this is (a drop from more clients I do understand). Is > > > this because of the way pgbench works, the way PostgrSQL works or even > > > Linux? > > This degradation seems to suggest effects caused by the disk cache filling > > up (assuming write caching is enabled) and checkpointing. > Which diskcache are your referring to? The onboard harddisk or RAID5 > controller caches or the OS cache? The first two I can unstand but if > you refer to the OS cache I do not understand what I am seeing. I have > enough memory giving the size of the database: during these duration (~) > tests fsync was on, and the files could be loaded into memory easily > (effective_cache_size = 32768 which is ~ 265 MB, the complete database > directory 228 MB) Well, two things may be at play. 1) if you are using write caching on your controller/disks then at the point at which that cache fills up performance will degrade to roughly that you can expect if write through cache was being used. Secondly, we checkpoint the system periodically to ensure that recovery wont be too long a job. Running for pgbench for a few seconds, you will not see the effect of checkpointing, which usually runs once every 5 minutes. Hope this helps. Thanks, Gavin From pgsql-performance-owner@postgresql.org Wed Nov 2 09:36:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0332BD6868 for ; Wed, 2 Nov 2005 09:36:58 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52025-01 for ; Wed, 2 Nov 2005 13:36:53 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 53789D6806 for ; Wed, 2 Nov 2005 09:36:55 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Wed, 2 Nov 2005 08:36:57 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD76C@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: insert performance for win32 Thread-Index: AcXficvhooKyPjPFQyWN2fDRqzwFUwAJ7bRw From: "Merlin Moncure" To: "Marc Cousin" Cc: , "Qingqing Zhou" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.046 required=5 tests=[AWL=0.046] X-Spam-Score: 0.046 X-Spam-Level: X-Archive-Number: 200511/25 X-Sequence-Number: 15282 > I've done the tests with rc1. This is still as slow on windows ... about > 6-10 > times slower thant linux (via Ip socket). (depending on using prepared > queries, etc...) >=20 > By the way, we've tried to insert into the windows database from a linux > psql > client, via the network. In this configuration, inserting is only about 2 > times slower than inserting locally (the linux client had a slower CPU > 1700Mhz agains 3000). > Could it be related to a problem in the windows psql client ? [OK, I'm bringing this back on-list, and bringing it to QingQing's attention, who I secretly hope is the right person to be looking at this problem :)] Just to recap Marc and I have been looking at the performance disparity between windows and linux for a single transaction statement by statement insert on a very narrow table with no keys from a remote client. Marc's observations showed (and I verified) that windows is much slower in this case than it should be. I gprof'ed both the psql client and the server during the insert and didn't see anything seriously out of order...unfortunately QQ's latest win32 performance tweaks haven't helped. Marc's observation that by switching to a linux client drops time down drastically is really intersing! Merlin From pgsql-performance-owner@postgresql.org Wed Nov 2 09:45:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 41952D82EB for ; Wed, 2 Nov 2005 09:45:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53344-10 for ; Wed, 2 Nov 2005 13:45:00 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id D8893D7D49 for ; Wed, 2 Nov 2005 09:44:59 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: improvise callbacks in plpgsql Date: Wed, 2 Nov 2005 08:45:02 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD76D@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] improvise callbacks in plpgsql Thread-Index: AcXfOKRHuQpQ7RcvTMmXKhyC8N16PgAd8XWA From: "Merlin Moncure" To: "Jim C. Nasby" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.046 required=5 tests=[AWL=0.046] X-Spam-Score: 0.046 X-Spam-Level: X-Archive-Number: 200511/26 X-Sequence-Number: 15283 > Would you be willing to write up an example of this? We often get asked > about support for WITH, so I bet there's other people who would be very > interested in what you've got. Sure. In fact, I had already decided this to be the next topic on my blog. I'm assuming you are asking about tools to deal with recursive sets in postgresql. A plpgsql solution is extremely fast, tight, and easy if you do it right...Tom's latest suggestions (I have to flesh this out some more) provide the missing piece puzzle to make it really tight from a classic programming perspective. I don't miss the recursive query syntax at all...IMO it's pretty much a hack anyways (to SQL). =20 Merlin From pgsql-performance-owner@postgresql.org Wed Nov 2 09:54:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 95148D77B6 for ; Wed, 2 Nov 2005 09:54:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54680-07 for ; Wed, 2 Nov 2005 13:54:10 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 86A3CD774D for ; Wed, 2 Nov 2005 09:54:12 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id E9FBB8F28E; Wed, 2 Nov 2005 14:54:14 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: insert performance for win32 Date: Wed, 2 Nov 2005 14:54:14 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE6C7B4A@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 thread-index: AcXficvhooKyPjPFQyWN2fDRqzwFUwAJ7bRwAADR4FA= From: "Magnus Hagander" To: "Merlin Moncure" , "Marc Cousin" Cc: , "Qingqing Zhou" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200511/27 X-Sequence-Number: 15284 > > I've done the tests with rc1. This is still as slow on windows ... > about > > 6-10 > > times slower thant linux (via Ip socket). (depending on=20 > using prepared=20 > > queries, etc...) > >=20 > > By the way, we've tried to insert into the windows database from a > linux > > psql > > client, via the network. In this configuration, inserting is only > about 2 > > times slower than inserting locally (the linux client had a=20 > slower CPU=20 > > 1700Mhz agains 3000). > > Could it be related to a problem in the windows psql client ? >=20 > [OK, I'm bringing this back on-list, and bringing it to=20 > QingQing's attention, who I secretly hope is the right person=20 > to be looking at this problem :)] >=20 > Just to recap Marc and I have been looking at the performance=20 > disparity between windows and linux for a single transaction=20 > statement by statement insert on a very narrow table with no=20 > keys from a remote client. Marc's observations showed (and I=20 > verified) that windows is much slower in this case than it=20 > should be. I gprof'ed both the psql client and the server=20 > during the insert and didn't see anything seriously out of=20 > order...unfortunately QQ's latest win32 performance tweaks=20 > haven't helped. >=20 > Marc's observation that by switching to a linux client drops=20 > time down drastically is really intersing! Could this be a case of the network being slow, as we've seen a couple of times before? And if you run psql on the local box, you get it double. Do you get a speed difference between the local windows box and a remote wnidows box? //Magnus From pgsql-performance-owner@postgresql.org Wed Nov 2 10:41:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 96B98D8452 for ; Wed, 2 Nov 2005 10:41:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74583-04 for ; Wed, 2 Nov 2005 14:41:09 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E1713D830C for ; Wed, 2 Nov 2005 10:41:10 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA2EfEki005354; Wed, 2 Nov 2005 09:41:14 -0500 (EST) To: "PostgreSQL" Cc: pgsql-performance@postgresql.org Subject: Re: 8.1beta3 performance In-reply-to: References: <20051101085037.1b12b077@fc63r41.npci.com> <26529.1130865883@sss.pgh.pa.us> Comments: In-reply-to "PostgreSQL" message dated "Wed, 02 Nov 2005 03:32:45 -0600" Date: Wed, 02 Nov 2005 09:41:14 -0500 Message-ID: <5353.1130942474@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/28 X-Sequence-Number: 15285 "PostgreSQL" writes: > I'm seeing some other little oddities in the beta as well. I'm watching an > ALTER TABLE ADD COLUMN right now that has been running almost two hours. I > stopped it the first time at 1 hour; I suppose I'll let it go this time and > see if it ever completes. The table is about 150K rows. Top, vmstat, and > iostat show almost no cpu or disk activity (1 to 3%) - it's as if it just > went to sleep. You sure it's not blocked on a lock? Check pg_locks ... if that sheds no light, try attaching to the backend process with gdb and getting a stack trace. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Nov 2 10:41:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0222DD8BB0 for ; Wed, 2 Nov 2005 10:41:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71037-10 for ; Wed, 2 Nov 2005 14:41:27 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id DEDBDD8A0B for ; Wed, 2 Nov 2005 10:41:27 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 02 Nov 2005 15:41:31 +0100 Subject: Re: pgbench results interpretation? From: Joost Kraaijeveld To: Gavin Sherry Cc: Pgsql-Performance In-Reply-To: References: <1130832189.21036.19.camel@Panoramix> <1130839542.3883.19.camel@Panoramix> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Wed, 02 Nov 2005 15:41:31 +0100 Message-Id: <1130942491.29028.57.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.07 required=5 tests=[AWL=0.069, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.07 X-Spam-Level: X-Archive-Number: 200511/29 X-Sequence-Number: 15286 On Wed, 2005-11-02 at 21:16 +1100, Gavin Sherry wrote: > connections are updating the branches table heavily. As an aside, did you > initialise with a scaling factor of 10 to match your level of concurrency? Yep, I did. > that. The hackers list archive also contains links to the testing Mark > Wong has been doing at OSDL with TPC-C and TPC-H. Taking a look at the > configuration file he is using, along with the annotated postgresql.conf, > would be useful, depending on the load you're antipating and your > hardware. I will look into that project. > Well, two things may be at play. 1) if you are using write caching on your > controller/disks then at the point at which that cache fills up > performance will degrade to roughly that you can expect if write through > cache was being used. Secondly, we checkpoint the system periodically to > ensure that recovery wont be too long a job. Running for pgbench for a few > seconds, you will not see the effect of checkpointing, which usually runs > once every 5 minutes. I still think it is strange. Simple tests with tar suggest that I could easily do 600-700 tps at 50.000 KB/second ( as measured by iostat), a test with bonnie++ measured throughputs > 40.000 KB/sec during very long times, with 1723 - 2121 operations per second. These numbers suggest that PostgreSQL is not using all it could from the hardware. Processor load however is negligible during the pgbench tests. As written before, I will look into the OSDL benchmarks. Maybe they are more suited for my needs: *understanding* performance determinators. > > Hope this helps. You certainly did, thanks. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Wed Nov 2 10:47:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EDB89D8A44 for ; Wed, 2 Nov 2005 10:47:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78638-02 for ; Wed, 2 Nov 2005 14:47:23 +0000 (GMT) Received: from mercure-2.sigma.fr (mercure-2.sigma.fr [195.25.81.10]) by svr1.postgresql.org (Postfix) with ESMTP id 6DE65D8A0B for ; Wed, 2 Nov 2005 10:47:25 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mercure-2.sigma.fr (Postfix) with ESMTP id ABED917FC9; Wed, 2 Nov 2005 15:47:28 +0100 (CET) Received: from mercure-2.sigma.fr ([127.0.0.1]) by localhost (mercure-2 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15661-02; Wed, 2 Nov 2005 15:47:28 +0100 (CET) Received: from delpiv3000-124l (unknown [89.195.0.5]) by mercure-2.sigma.fr (Postfix) with ESMTP id 7594017F7E; Wed, 2 Nov 2005 15:47:28 +0100 (CET) From: Marc Cousin Organization: Sigma Informatique To: "Magnus Hagander" Subject: Re: insert performance for win32 Date: Wed, 2 Nov 2005 15:47:28 +0100 User-Agent: KMail/1.8.92 Cc: "Merlin Moncure" , pgsql-performance@postgresql.org, "Qingqing Zhou" References: <6BCB9D8A16AC4241919521715F4D8BCE6C7B4A@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE6C7B4A@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200511021547.28258.mcousin@sigma.fr> X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at sigma.fr X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.905 required=5 tests=[AWL=-0.905, RCVD_IN_WHOIS_BOGONS=1.811] X-Spam-Score: 0.905 X-Spam-Level: X-Archive-Number: 200511/30 X-Sequence-Number: 15287 Le Mercredi 02 Novembre 2005 14:54, Magnus Hagander a =E9crit=A0: > > > I've done the tests with rc1. This is still as slow on windows ... > > > > about > > > > > 6-10 > > > times slower thant linux (via Ip socket). (depending on > > > > using prepared > > > > > queries, etc...) > > > > > > By the way, we've tried to insert into the windows database from a > > > > linux > > > > > psql > > > client, via the network. In this configuration, inserting is only > > > > about 2 > > > > > times slower than inserting locally (the linux client had a > > > > slower CPU > > > > > 1700Mhz agains 3000). > > > Could it be related to a problem in the windows psql client ? > > > > [OK, I'm bringing this back on-list, and bringing it to > > QingQing's attention, who I secretly hope is the right person > > to be looking at this problem :)] > > > > Just to recap Marc and I have been looking at the performance > > disparity between windows and linux for a single transaction > > statement by statement insert on a very narrow table with no > > keys from a remote client. Marc's observations showed (and I > > verified) that windows is much slower in this case than it > > should be. I gprof'ed both the psql client and the server > > during the insert and didn't see anything seriously out of > > order...unfortunately QQ's latest win32 performance tweaks > > haven't helped. > > > > Marc's observation that by switching to a linux client drops > > time down drastically is really intersing! > > Could this be a case of the network being slow, as we've seen a couple > of times before? And if you run psql on the local box, you get it > double. > > Do you get a speed difference between the local windows box and a remote > wnidows box? > > //Magnus The Windows-Windows test is local (via loopback interface) The Linux (client) - Windows (server) is via network (100Mbits) I can't test with 2 windows box ... I haven't got that much (all machines=20 linux, except the test one...) From pgsql-performance-owner@postgresql.org Wed Nov 2 11:11:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EA9F1D6887 for ; Wed, 2 Nov 2005 11:11:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85676-03 for ; Wed, 2 Nov 2005 15:11:27 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8B512D6899 for ; Wed, 2 Nov 2005 11:11:29 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA2FBYtN005647; Wed, 2 Nov 2005 10:11:34 -0500 (EST) To: "Magnus Hagander" Cc: "Merlin Moncure" , "Marc Cousin" , pgsql-performance@postgresql.org, "Qingqing Zhou" Subject: Re: insert performance for win32 In-reply-to: <6BCB9D8A16AC4241919521715F4D8BCE6C7B4A@algol.sollentuna.se> References: <6BCB9D8A16AC4241919521715F4D8BCE6C7B4A@algol.sollentuna.se> Comments: In-reply-to "Magnus Hagander" message dated "Wed, 02 Nov 2005 14:54:14 +0100" Date: Wed, 02 Nov 2005 10:11:34 -0500 Message-ID: <5646.1130944294@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/31 X-Sequence-Number: 15288 "Magnus Hagander" writes: >> Marc's observation that by switching to a linux client drops >> time down drastically is really intersing! > Could this be a case of the network being slow, I'm wondering about nonstandard junk lurking in the TCP stack of the Windows client machine. Also, I seem to recall something about a "QOS patch" that people are supposed to apply, or not apply as the case may be, to get Windows' TCP stack to behave reasonably ... ring a bell? regards, tom lane From pgsql-performance-owner@postgresql.org Wed Nov 2 11:34:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0C665D6800 for ; Wed, 2 Nov 2005 11:34:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97352-02 for ; Wed, 2 Nov 2005 15:34:46 +0000 (GMT) Received: from mail.clickdiario.com (mail.clickdiario.com [70.85.167.114]) by svr1.postgresql.org (Postfix) with ESMTP id 92A95D680E for ; Wed, 2 Nov 2005 11:34:48 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.clickdiario.com (Postfix) with ESMTP id B515610009 for ; Wed, 2 Nov 2005 09:41:10 -0600 (CST) Received: from mail.clickdiario.com ([127.0.0.1]) by localhost (mail.clickdiario.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01342-07 for ; Wed, 2 Nov 2005 09:41:10 -0600 (CST) Received: by mail.clickdiario.com (Postfix, from userid 5001) id 9DECE1000C; Wed, 2 Nov 2005 09:41:10 -0600 (CST) Received: from cristian1 (unknown [216.230.158.50]) by mail.clickdiario.com (Postfix) with ESMTP id 01F9510009 for ; Wed, 2 Nov 2005 09:41:09 -0600 (CST) From: "Cristian Prieto" To: Subject: Performance difference between sql and pgsql function... Date: Wed, 2 Nov 2005 09:32:19 -0600 Message-ID: <007401c5dfc2$9d2c41e0$6500a8c0@gt.ClickDiario.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcXfwpw0gKVGX6nfQS+raXrBjfMWuw== X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/32 X-Sequence-Number: 15289 There any performance differences between a SQL function written in SQL language or PL/psSQL language? For example: Create or replace function sp_getfreq( Var1 integer ) returns Boolean as $$ Declare Myval Boolean; Begin Select var1 in (select var3 from table1) into myval; Return myval; End; $$ Language =91plpgsql=92 stable;=A0 And with: Create or replace function sp_getfreq( Var1 integer ) returns boolean as $$ Select $1 in (select var3 from table1); $$ Language =91sql=92 stable; I know the function is really simple, but in theory which of the three = would run faster? From pgsql-performance-owner@postgresql.org Wed Nov 2 12:47:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39B25D787B for ; Wed, 2 Nov 2005 12:47:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25047-08 for ; Wed, 2 Nov 2005 16:47:50 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id BC373D786C for ; Wed, 2 Nov 2005 12:47:49 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: improvise callbacks in plpgsql Date: Wed, 2 Nov 2005 11:47:48 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD776@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] improvise callbacks in plpgsql Thread-Index: AcXfOKRHuQpQ7RcvTMmXKhyC8N16PgAkulig From: "Merlin Moncure" To: "Jim C. Nasby" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200511/33 X-Sequence-Number: 15290 > Would you be willing to write up an example of this? We often get asked > about support for WITH, so I bet there's other people who would be very > interested in what you've got. >=20 You can see my blog on the subject here: http://www.postgresql.org/docs/8.0/interactive/plpgsql.html#PLPGSQL-ADVA NTAGES It doesn't touch the callback issue. I'm going to hit that at a later date, a review would be helpful! Merlin From pgsql-performance-owner@postgresql.org Wed Nov 2 13:04:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 71D51D8E9E for ; Wed, 2 Nov 2005 13:04:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31169-08 for ; Wed, 2 Nov 2005 17:04:37 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 35070D8DAE for ; Wed, 2 Nov 2005 13:04:36 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: improvise callbacks in plpgsql Date: Wed, 2 Nov 2005 12:04:35 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD777@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] improvise callbacks in plpgsql Thread-Index: AcXfOKRHuQpQ7RcvTMmXKhyC8N16PgAkuligAAD4joA= From: "Merlin Moncure" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200511/34 X-Sequence-Number: 15291 oops. my blog is here: :-) http://people.planetpostgresql.org/merlin/ > http://www.postgresql.org/docs/8.0/interactive/plpgsql.html#PLPGSQL-ADVA > NTAGES From pgsql-performance-owner@postgresql.org Wed Nov 2 13:26:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6B3B9D8AD1 for ; Wed, 2 Nov 2005 13:26:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41856-02 for ; Wed, 2 Nov 2005 17:26:37 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id C56F9D86AD for ; Wed, 2 Nov 2005 13:26:37 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EXMNV-0003Xi-00; Wed, 02 Nov 2005 12:26:25 -0500 To: "Merlin Moncure" Cc: "Scott Marlowe" , Subject: Re: 8.x index insert performance References: <6EE64EF3AB31D5448D0007DD34EEB3417DD732@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD732@Herge.rcsinc.local> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 02 Nov 2005 12:26:25 -0500 Message-ID: <87oe53hsfy.fsf@stark.xeocode.com> Lines: 21 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/35 X-Sequence-Number: 15292 "Merlin Moncure" writes: > > select * from sometable where somefield IS NULL won't work because IS > is > > not a nomally indexible operator. > > Ah, I didn't know that. So there is no real reason not to exclude null > values from all your indexes :). Reading Tom's recent comments > everything is clear now. There are other reasons. If you want a query like SELECT * FROM tab ORDER BY col LIMIT 10 to use an index on col then it can't exclude NULLs or else it wouldn't be useful. (Oracle actually has this problem, you frequently have to add WHERE col IS NOT NULL" in order to let it use an index.) -- greg From pgsql-performance-owner@postgresql.org Wed Nov 2 19:34:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 93CB9DA21A for ; Wed, 2 Nov 2005 19:34:16 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75312-06 for ; Wed, 2 Nov 2005 23:34:13 +0000 (GMT) Received: from nz.telogis.com (unknown [203.98.10.169]) by svr1.postgresql.org (Postfix) with ESMTP id E1A4CD9FA3 for ; Wed, 2 Nov 2005 19:34:14 -0400 (AST) Received: from [192.168.3.1] ([192.168.3.1]) by nz.telogis.com with esmtp; Thu, 03 Nov 2005 12:34:16 +1300 id 006D3D4E.43694CF8.00007D64 Message-ID: <43694CF6.4050605@telogis.com> Date: Thu, 03 Nov 2005 12:34:14 +1300 From: Ralph Mason User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Trigger Rowsets Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/36 X-Sequence-Number: 15293 I want to do statement level triggers for performance, but it seems there is no 'updated', 'inserted', or 'deleted' tables inside the trigger and nothing I can find in the documentation that offers similar functionality. Is there any way that I can access only those rows that were changed? Thanks Ralph From pgsql-www-owner@postgresql.org Wed Nov 2 19:44:31 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 54AA4DA1E2 for ; Wed, 2 Nov 2005 19:44:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71783-01 for ; Wed, 2 Nov 2005 23:44:26 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id 0B223D9DBD for ; Wed, 2 Nov 2005 19:44:28 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 8BD811529A; Wed, 2 Nov 2005 17:44:30 -0600 (CST) Date: Wed, 2 Nov 2005 17:44:30 -0600 From: "Jim C. Nasby" To: Merlin Moncure Cc: pgsql-www@postgresql.org Subject: Re: [PERFORM] improvise callbacks in plpgsql Message-ID: <20051102234430.GA55520@pervasive.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD76D@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD76D@Herge.rcsinc.local> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/12 X-Sequence-Number: 8727 Can we get a link to this posted somewhere? I guess on techdocs? On Wed, Nov 02, 2005 at 08:45:02AM -0500, Merlin Moncure wrote: > > Would you be willing to write up an example of this? We often get > asked > > about support for WITH, so I bet there's other people who would be > very > > interested in what you've got. > > Sure. In fact, I had already decided this to be the next topic on my > blog. I'm assuming you are asking about tools to deal with recursive > sets in postgresql. A plpgsql solution is extremely fast, tight, and > easy if you do it right...Tom's latest suggestions (I have to flesh this > out some more) provide the missing piece puzzle to make it really tight > from a classic programming perspective. I don't miss the recursive > query syntax at all...IMO it's pretty much a hack anyways (to SQL). > > Merlin > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-performance-owner@postgresql.org Wed Nov 2 19:50:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50DDDD9DA1 for ; Wed, 2 Nov 2005 19:50:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24017-06 for ; Wed, 2 Nov 2005 23:50:07 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id DBDA4D9DE4 for ; Wed, 2 Nov 2005 19:50:08 -0400 (AST) Received: by flake.decibel.org (Postfix, from userid 1001) id 36F721525E; Wed, 2 Nov 2005 17:50:12 -0600 (CST) Date: Wed, 2 Nov 2005 17:50:12 -0600 From: "Jim C. Nasby" To: Ralph Mason Cc: pgsql-performance@postgresql.org Subject: Re: Trigger Rowsets Message-ID: <20051102235012.GB55520@pervasive.com> References: <43694CF6.4050605@telogis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43694CF6.4050605@telogis.com> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/37 X-Sequence-Number: 15294 On Thu, Nov 03, 2005 at 12:34:14PM +1300, Ralph Mason wrote: > I want to do statement level triggers for performance, but it seems > there is no 'updated', 'inserted', or 'deleted' tables inside the > trigger and nothing I can find in the documentation that offers similar > functionality. > > Is there any way that I can access only those rows that were changed? No. The only way you can do this is with row-level triggers. There's also not currently any plans to allow statement-level triggers to interact with the data that was modified by the statement. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 From pgsql-www-owner@postgresql.org Wed Nov 2 22:52:36 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E6A48DA463 for ; Wed, 2 Nov 2005 22:52:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43889-04 for ; Thu, 3 Nov 2005 02:52:30 +0000 (GMT) Received: from fetter.org (dsl092-188-065.sfo1.dsl.speakeasy.net [66.92.188.65]) by svr1.postgresql.org (Postfix) with ESMTP id 0B556D99BC for ; Wed, 2 Nov 2005 22:52:31 -0400 (AST) Received: from fetter.org (localhost.localdomain [127.0.0.1]) by fetter.org (8.13.4/8.12.10) with ESMTP id jA32qYA4001972; Wed, 2 Nov 2005 18:52:34 -0800 Received: (from shackle@localhost) by fetter.org (8.13.4/8.13.4/Submit) id jA32qYYL001971; Wed, 2 Nov 2005 18:52:34 -0800 Date: Wed, 2 Nov 2005 18:52:33 -0800 From: David Fetter To: "Jim C. Nasby" Cc: Merlin Moncure , pgsql-www@postgresql.org Subject: Re: [PERFORM] improvise callbacks in plpgsql Message-ID: <20051103025233.GG29465@fetter.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD76D@Herge.rcsinc.local> <20051102234430.GA55520@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051102234430.GA55520@pervasive.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.05 required=5 tests=[AWL=0.050] X-Spam-Score: 0.05 X-Spam-Level: X-Archive-Number: 200511/14 X-Sequence-Number: 8729 On Wed, Nov 02, 2005 at 05:44:30PM -0600, Jim C. Nasby wrote: > Can we get a link to this posted somewhere? I guess on techdocs? > > On Wed, Nov 02, 2005 at 08:45:02AM -0500, Merlin Moncure wrote: > > > Would you be willing to write up an example of this? We often get > > asked > > > about support for WITH, so I bet there's other people who would be > > very > > > interested in what you've got. > > > > Sure. In fact, I had already decided this to be the next topic on > > my blog. I'm assuming you are asking about tools to deal with > > recursive sets in postgresql. A plpgsql solution is extremely > > fast, tight, and easy if you do it right...Tom's latest > > suggestions (I have to flesh this out some more) provide the > > missing piece puzzle to make it really tight from a classic > > programming perspective. I don't miss the recursive query syntax > > at all...IMO it's pretty much a hack anyways (to SQL). This might be worth putting in the docs somewhere. Tutorial? Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! From pgsql-performance-owner@postgresql.org Thu Nov 3 01:13:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B6985D707D for ; Thu, 3 Nov 2005 01:13:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88051-09 for ; Thu, 3 Nov 2005 05:13:28 +0000 (GMT) Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id AAC3FD7073 for ; Thu, 3 Nov 2005 01:13:28 -0400 (AST) Received: from [192.168.1.52] (adsl-69-230-8-158.dsl.pltn13.pacbell.net [69.230.8.158]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by calvin.slamb.org (Postfix) with ESMTP id B6E1A6FD36; Wed, 2 Nov 2005 23:13:27 -0600 (CST) Mime-Version: 1.0 (Apple Message framework v734) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <518C814C-9F9E-42CA-9E8E-C48FAE3B9AFE@slamb.org> Cc: Dustin Sallings Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Sorted union Date: Wed, 2 Nov 2005 21:13:11 -0800 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.734) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/38 X-Sequence-Number: 15295 Using PostgreSQL 8.0.4. I've got a table with 4.5 million rows that I expect to become huge (hundred million? who knows). Each row has a start and end time. I want to retrieve all the events during a timespan in one list; typical timespans will involve up to a couple rows. If the start and stop happen at the same time (which is possible), the start must come first in my sequence. So essentially, I want this: select when_stopped as when_happened, 1 as order_hint from transaction t where '2005-10-25 15:00:00' <= when_stopped and when_stopped <= '2005-10-26 10:00:00' union all select when_stopped as when_happened, 2 as order_hint from transaction t where '2005-10-25 15:00:00' <= when_stopped and when_stopped <= '2005-10-26 10:00:00' order by when_happened, order_hint; I'd really like the first row to be retrieved in O(1) time and the last in O(n) time (n = number of rows in the timespan, not the whole table). I previously was doing things manually with flat files. But there's a sort in PostgreSQL's plan, so I think I'm getting O(n log n) time for both. It's frustrating to start using a real database and get performance regressions. QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------------------------- Sort (cost=667469.90..676207.19 rows=3494916 width=8) (actual time=28503.612..31377.254 rows=3364006 loops=1) Sort Key: when_happened, order_hint -> Append (cost=0.00..194524.95 rows=3494916 width=8) (actual time=0.191..14659.712 rows=3364006 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..97262.48 rows=1747458 width=8) (actual time=0.190..5375.925 rows=1682003 loops=1) -> Index Scan using transaction_stopped on "transaction" t (cost=0.00..79787.90 rows=1747458 width=8) (actual time=0.186..2962.585 rows=1682003 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_stopped) AND (when_stopped <= '2005-10-26 10:00:00'::timestamp without time zone)) -> Subquery Scan "*SELECT* 2" (cost=0.00..97262.48 rows=1747458 width=8) (actual time=0.167..5449.151 rows=1682003 loops=1) -> Index Scan using transaction_stopped on "transaction" t (cost=0.00..79787.90 rows=1747458 width=8) (actual time=0.163..3026.730 rows=1682003 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_stopped) AND (when_stopped <= '2005-10-26 10:00:00'::timestamp without time zone)) Total runtime: 33312.814 ms (10 rows) Each side of the union is retrieved in sorted order, but it doesn't seem to realize that. There seem to be two things it's missing: (1) It doesn't recognize that constant expressions are irrelevant to the sort. I.e., the first half of the union: select when_started as when_happened, 1 as order_hint from transaction t where '2005-10-25 15:00:00' <= when_started and when_started <= '2005-10-26 10:00:00' order by when_happened, order_hint; does this: QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------------- Sort (cost=291770.42..296139.05 rows=1747453 width=8) (actual time=8462.026..9895.715 rows=1681994 loops=1) Sort Key: when_started, 1 -> Index Scan using transaction_started on "transaction" t (cost=0.00..79788.21 rows=1747453 width=8) (actual time=0.190..2953.393 rows=1681994 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_started) AND (when_started <= '2005-10-26 10:00:00'::timestamp without time zone)) Total runtime: 10835.114 ms (5 rows) The sort is unnecessary. If I take out the constant order_hint, it works: select when_started as when_happened from transaction t where '2005-10-25 15:00:00' <= when_started and when_started <= '2005-10-26 10:00:00' order by when_happened; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------- Index Scan using transaction_started on "transaction" t (cost=0.00..79788.21 rows=1747453 width=8) (actual time=0.189..2715.513 rows=1681994 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_started) AND (when_started <= '2005-10-26 10:00:00'::timestamp without time zone)) Total runtime: 3630.817 ms (3 rows) (2) It doesn't recognize that each half of the union is sorted and thus they only need to be merged. This is true even without the order_hint bits: select when_stopped as when_happened from transaction t where '2005-10-25 15:00:00' <= when_stopped and when_stopped <= '2005-10-26 10:00:00' union all select when_stopped as when_happened from transaction t where '2005-10-25 15:00:00' <= when_stopped and when_stopped <= '2005-10-26 10:00:00' order by when_happened; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------------------------- Sort (cost=667469.90..676207.19 rows=3494916 width=8) (actual time=28088.783..30898.854 rows=3364006 loops=1) Sort Key: when_happened -> Append (cost=0.00..194524.95 rows=3494916 width=8) (actual time=0.153..14410.485 rows=3364006 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..97262.48 rows=1747458 width=8) (actual time=0.152..5287.092 rows=1682003 loops=1) -> Index Scan using transaction_stopped on "transaction" t (cost=0.00..79787.90 rows=1747458 width=8) (actual time=0.149..2885.905 rows=1682003 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_stopped) AND (when_stopped <= '2005-10-26 10:00:00'::timestamp without time zone)) -> Subquery Scan "*SELECT* 2" (cost=0.00..97262.48 rows=1747458 width=8) (actual time=0.152..5254.425 rows=1682003 loops=1) -> Index Scan using transaction_stopped on "transaction" t (cost=0.00..79787.90 rows=1747458 width=8) (actual time=0.149..2905.861 rows=1682003 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_stopped) AND (when_stopped <= '2005-10-26 10:00:00'::timestamp without time zone)) Total runtime: 32766.566 ms (10 rows) Is there some way I can work around this? The best I can think of now is to open two connections, one for each half of the union. I can do the merge manually on the client side. It'd work, but I'd really prefer the database server take care of this for me. -- Scott Lamb From pgsql-performance-owner@postgresql.org Thu Nov 3 01:27:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B184D6E2C for ; Thu, 3 Nov 2005 01:27:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03107-03 for ; Thu, 3 Nov 2005 05:27:26 +0000 (GMT) Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id CBDE8D6D78 for ; Thu, 3 Nov 2005 01:27:26 -0400 (AST) Received: from [192.168.1.52] (adsl-69-230-8-158.dsl.pltn13.pacbell.net [69.230.8.158]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by calvin.slamb.org (Postfix) with ESMTP id 03C7E6FD36; Wed, 2 Nov 2005 23:27:26 -0600 (CST) In-Reply-To: <518C814C-9F9E-42CA-9E8E-C48FAE3B9AFE@slamb.org> References: <518C814C-9F9E-42CA-9E8E-C48FAE3B9AFE@slamb.org> Mime-Version: 1.0 (Apple Message framework v734) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org, Dustin Sallings Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: Sorted union Date: Wed, 2 Nov 2005 21:27:02 -0800 To: Scott Lamb X-Mailer: Apple Mail (2.734) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/39 X-Sequence-Number: 15296 On 2 Nov 2005, at 21:13, Scott Lamb wrote: > I want to retrieve all the events during a timespan in one list; > typical timespans will involve up to a couple rows. Err, I meant up to a couple million rows. With two rows, I wouldn't be so concerned about performance. ;) -- Scott Lamb From pgsql-performance-owner@postgresql.org Thu Nov 3 03:11:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8BCF7D7115 for ; Thu, 3 Nov 2005 03:11:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36890-07 for ; Thu, 3 Nov 2005 07:11:44 +0000 (GMT) Received: from cliff.cs.toronto.edu (cliff.cs.toronto.edu [128.100.3.120]) by svr1.postgresql.org (Postfix) with ESMTP id 237E2D7101 for ; Thu, 3 Nov 2005 03:11:44 -0400 (AST) Received: from eon.cs (eon.cs.toronto.edu [128.100.3.15]) by cliff.cs.toronto.edu (Postfix) with ESMTP id 197A85FD0C; Thu, 3 Nov 2005 02:11:43 -0500 (EST) Received: by eon.cs (Postfix, from userid 1300) id 281EF7E9; Thu, 3 Nov 2005 02:11:43 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by eon.cs (Postfix) with ESMTP id 1AE3F544; Thu, 3 Nov 2005 02:11:43 -0500 (EST) Date: Thu, 3 Nov 2005 02:11:43 -0500 (EST) From: Qingqing Zhou X-X-Sender: zhouqq@eon.cs To: Merlin Moncure Cc: Marc Cousin , pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD76C@Herge.rcsinc.local> Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD76C@Herge.rcsinc.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.363 required=5 tests=[AWL=-0.116, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.363 X-Spam-Level: X-Archive-Number: 200511/40 X-Sequence-Number: 15297 On Wed, 2 Nov 2005, Merlin Moncure wrote: > > > > By the way, we've tried to insert into the windows database from a > > linux psql client, via the network. In this configuration, inserting > > is only about 2 times slower than inserting locally (the linux client > > had a slower CPU 1700Mhz agains 3000). Could it be related to a > > problem in the windows psql client ? > > If you put client/server on the same machine, then we don't know how the CPU is splitted. Can you take a look at the approximate number by observing the task manager data while running? If communication code is the suspect, can we measure the difference if we disable the redefinition of recv()/send() etc in port/win32.h (may require change related code a little bit as well). In this way, the socket will not be able to pickup signals, but let see if there is any performance difference first. Regards, Qingqing > > [OK, I'm bringing this back on-list, and bringing it to QingQing's > attention, who I secretly hope is the right person to be looking at this > problem :)] > P.s. You scared me ;-) From pgsql-performance-owner@postgresql.org Thu Nov 3 09:53:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1BDC3D845E for ; Thu, 3 Nov 2005 09:53:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75425-07 for ; Thu, 3 Nov 2005 13:52:56 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id B48B1D841B for ; Thu, 3 Nov 2005 09:52:58 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Sorted union Date: Thu, 3 Nov 2005 08:53:00 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD78D@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sorted union Thread-Index: AcXgNckSE0inABpgStGapacgBYykRwARnoPA From: "Merlin Moncure" To: "Scott Lamb" Cc: , "Dustin Sallings" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.044 required=5 tests=[AWL=0.044] X-Spam-Score: 0.044 X-Spam-Level: X-Archive-Number: 200511/41 X-Sequence-Number: 15298 > select when_stopped as when_happened, > 1 as order_hint > from transaction t > where '2005-10-25 15:00:00' <=3D when_stopped > and when_stopped <=3D '2005-10-26 10:00:00' > union all > select when_stopped as when_happened, > 2 as order_hint > from transaction t > where '2005-10-25 15:00:00' <=3D when_stopped > and when_stopped <=3D '2005-10-26 10:00:00' > order by when_happened, order_hint; hmm, try pushing the union into a subquery...this is better style because it's kind of ambiguous if the ordering will apply before/after the union. select q.when from ( select 1 as hint, start_time as when [...] union all select 2 as hint, end_time as when [...] ) q order by q.seq, when question: why do you want to flatten the table...is it not easier to work with as records? Merlin =20 From pgsql-www-owner@postgresql.org Thu Nov 3 10:01:51 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 80AB7D82A3 for ; Thu, 3 Nov 2005 10:01:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84259-05 for ; Thu, 3 Nov 2005 14:01:46 +0000 (GMT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.206]) by svr1.postgresql.org (Postfix) with ESMTP id EEEC4D8346 for ; Thu, 3 Nov 2005 10:01:47 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i30so533870wxd for ; Thu, 03 Nov 2005 06:01:52 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=f/m7y5veOcTkNDhx9/W1pyhTgqWrbzBhPERdBmIFnPgEVI08jBiq85Yx+HXjG/4cHLAKkIsD37+otHg309C9SF2Zzz8uv9by6mZ/JFxTDG08Bsr76qt627Y0SikWnREFQpSzolPgEbx3asMSs/WnuE+OPmHHjxXdXppfFXt/Ni8= Received: by 10.70.27.8 with SMTP id a8mr673217wxa; Thu, 03 Nov 2005 06:01:52 -0800 (PST) Received: by 10.70.53.14 with HTTP; Thu, 3 Nov 2005 06:01:52 -0800 (PST) Message-ID: Date: Thu, 3 Nov 2005 09:01:52 -0500 From: Merlin Moncure To: David Fetter Subject: Re: [PERFORM] improvise callbacks in plpgsql Cc: pgsql-www@postgresql.org, jnasby@pervasive.com In-Reply-To: <20051103025233.GG29465@fetter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3417DD76D@Herge.rcsinc.local> <20051102234430.GA55520@pervasive.com> <20051103025233.GG29465@fetter.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200511/18 X-Sequence-Number: 8733 On 11/2/05, David Fetter wrote: > On Wed, Nov 02, 2005 at 05:44:30PM -0600, Jim C. Nasby wrote: > > Can we get a link to this posted somewhere? I guess on techdocs? > > > > On Wed, Nov 02, 2005 at 08:45:02AM -0500, Merlin Moncure wrote: > > > > Would you be willing to write up an example of this? We often get > > > asked > > > > about support for WITH, so I bet there's other people who would be > > > very > > > > interested in what you've got. > > > > > > Sure. In fact, I had already decided this to be the next topic on > > > my blog. I'm assuming you are asking about tools to deal with > > > recursive sets in postgresql. A plpgsql solution is extremely > > > fast, tight, and easy if you do it right...Tom's latest > > > suggestions (I have to flesh this out some more) provide the > > > missing piece puzzle to make it really tight from a classic > > > programming perspective. I don't miss the recursive query syntax > > > at all...IMO it's pretty much a hack anyways (to SQL). > > This might be worth putting in the docs somewhere. Tutorial? you guys can do anything you like with it... I'm working on part two which will build on the previous example and show how to pass in a function to use as a callback, kind of like a functor. btw, the blog examples are a reduction of my own personal code which went through a vast simplification process. I need to test it a bt before it hits doc quality, there might be some errors lurking there. Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 11:14:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 47E5AD8377 for ; Thu, 3 Nov 2005 11:14:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30060-08 for ; Thu, 3 Nov 2005 15:14:09 +0000 (GMT) Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) by svr1.postgresql.org (Postfix) with ESMTP id 9E5EED8258 for ; Thu, 3 Nov 2005 11:14:11 -0400 (AST) Received: from mail-gw-cl-a.dmv.com (mail-gw-cl-a.dmv.com [216.240.97.38]) by smtp-gw-cl-d.dmv.com (8.12.10/8.12.10) with ESMTP id jA3FEEf5090973 for ; Thu, 3 Nov 2005 10:14:14 -0500 (EST) (envelope-from sven@dmv.com) Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) by mail-gw-cl-a.dmv.com (8.12.9/8.12.9) with ESMTP id jA3FEDLR008362 for ; Thu, 3 Nov 2005 10:14:13 -0500 (EST) (envelope-from sven@dmv.com) Subject: Function with table%ROWTYPE globbing From: Sven Willenberger To: pgsql-performance@postgresql.org Content-Type: text/plain Date: Thu, 03 Nov 2005 10:14:15 -0500 Message-Id: <1131030856.9769.3.camel@lanshark.dmv.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.48 on 216.240.97.42 X-Scanned-By: MIMEDefang 2.48 on 216.240.97.38 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.527 required=5 tests=[AWL=-0.352, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 0.527 X-Spam-Level: X-Archive-Number: 200511/42 X-Sequence-Number: 15299 Postgresql 8.0.4 using plpgsql The basic function is set up as: CREATE FUNCTION add_data(t_row mytable) RETURNS VOID AS $func$ DECLARE newtable text; thesql text; BEGIN INSERT INTO newtable thename from mytable where lookup.id = t_row.id; thesql := 'INSERT INTO ' || newtable || VALUES (' || t_row.* ')'; EXECUTE thesql; RETURN; END; $func$ LANGUAGE plpgsql VOLATILE; SELECT add_data(t.*) FROM mytable t where .... ERROR: column "*" not found in data type mytable Now I have tried to drop the * but then there is no concatenation function to join text to a table%ROWTYPE. So my question is how can I make this dynamic insert statement without listing out every t_row.colname? Or, alternatively, is there a better way to parse out each row of a table into subtables based on a column value? Sven From pgsql-performance-owner@postgresql.org Thu Nov 3 11:37:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A867FD8346 for ; Thu, 3 Nov 2005 11:37:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42695-02 for ; Thu, 3 Nov 2005 15:37:23 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id B5370D8262 for ; Thu, 3 Nov 2005 11:37:25 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Function with table%ROWTYPE globbing Date: Thu, 3 Nov 2005 10:37:16 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD796@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Function with table%ROWTYPE globbing Thread-Index: AcXgicGkAisXRLFaQtWgOQWbOoTTTAAAVALQ From: "Merlin Moncure" To: "Sven Willenberger" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.387 required=5 tests=[AWL=-0.300, UNRESOLVED_TEMPLATE=0.687] X-Spam-Score: 0.387 X-Spam-Level: X-Archive-Number: 200511/43 X-Sequence-Number: 15300 > Postgresql 8.0.4 using plpgsql >=20 > The basic function is set up as: > CREATE FUNCTION add_data(t_row mytable) RETURNS VOID AS $func$ > DECLARE > newtable text; > thesql text; > BEGIN > INSERT INTO newtable thename from mytable where lookup.id =3D > t_row.id; > thesql :=3D 'INSERT INTO ' || newtable || VALUES (' || t_row.* = ')'; > EXECUTE thesql; > RETURN; > END; > $func$ LANGUAGE plpgsql VOLATILE; >=20 > SELECT add_data(t.*) FROM mytable t where .... > ERROR: column "*" not found in data type mytable >=20 > Now I have tried to drop the * but then there is no concatenation > function to join text to a table%ROWTYPE. So my question is how can I > make this dynamic insert statement without listing out every > t_row.colname? Or, alternatively, is there a better way to parse out > each row of a table into subtables based on a column value? I don't think it's possible. Rowtypes, etc are not first class yet (on to do). What I would do is pass the table name, where clause, etc into the add_data function and rewrite as insert...select and do the whole thing in one operation. Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 11:41:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38A91D7AAE for ; Thu, 3 Nov 2005 11:41:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43945-01 for ; Thu, 3 Nov 2005 15:41:16 +0000 (GMT) Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id 933E9D76A1 for ; Thu, 3 Nov 2005 11:41:18 -0400 (AST) Received: from [192.168.1.52] (adsl-69-230-8-158.dsl.pltn13.pacbell.net [69.230.8.158]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by calvin.slamb.org (Postfix) with ESMTP id 1A5B06FCFE; Thu, 3 Nov 2005 09:41:20 -0600 (CST) Message-ID: <436A2F9A.4050202@slamb.org> Date: Thu, 03 Nov 2005 07:41:14 -0800 From: Scott Lamb User-Agent: Thunderbird 1.4.1 (Macintosh/20051006) MIME-Version: 1.0 To: Merlin Moncure Cc: pgsql-performance@postgresql.org, Dustin Sallings Subject: Re: Sorted union References: <6EE64EF3AB31D5448D0007DD34EEB3417DD78D@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD78D@Herge.rcsinc.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/44 X-Sequence-Number: 15301 Merlin Moncure wrote: > hmm, try pushing the union into a subquery...this is better style > because it's kind of ambiguous if the ordering will apply before/after > the union. Seems to be a little slower. There's a new "subquery scan" step. explain analyze select q.when_happened from ( select when_stopped as when_happened, 1 as order_hint from transaction t where '2005-10-25 15:00:00' <= when_stopped and when_stopped <= '2005-10-26 10:00:00' union all select when_stopped as when_happened, 2 as order_hint from transaction t where '2005-10-25 15:00:00' <= when_stopped and when_stopped <= '2005-10-26 10:00:00' ) q order by when_happened, order_hint; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=713013.96..721751.25 rows=3494916 width=12) (actual time=34392.264..37237.148 rows=3364006 loops=1) Sort Key: when_happened, order_hint -> Subquery Scan q (cost=0.00..229474.11 rows=3494916 width=12) (actual time=0.194..20283.452 rows=3364006 loops=1) -> Append (cost=0.00..194524.95 rows=3494916 width=8) (actual time=0.191..14967.632 rows=3364006 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..97262.48 rows=1747458 width=8) (actual time=0.189..5535.139 rows=1682003 loops=1) -> Index Scan using transaction_stopped on "transaction" t (cost=0.00..79787.90 rows=1747458 width=8) (actual time=0.186..3097.268 rows=1682003 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_stopped) AND (when_stopped <= '2005-10-26 10:00:00'::timestamp without time zone)) -> Subquery Scan "*SELECT* 2" (cost=0.00..97262.48 rows=1747458 width=8) (actual time=0.173..5625.155 rows=1682003 loops=1) -> Index Scan using transaction_stopped on "transaction" t (cost=0.00..79787.90 rows=1747458 width=8) (actual time=0.169..3146.714 rows=1682003 loops=1) Index Cond: (('2005-10-25 15:00:00'::timestamp without time zone <= when_stopped) AND (when_stopped <= '2005-10-26 10:00:00'::timestamp without time zone)) Total runtime: 39775.225 ms (11 rows) > question: why do you want to flatten the table...is it not easier to > work with as records? For most things, yes. But I'm making a bunch of different graphs from these data, and a few of them are much easier with events. The best example is my concurrency graph. Whenever there's a start event, it goes up one. Whenever there's a stop event, it goes down one. It's completely trivial once you have it separated into events. Thanks, Scott From pgsql-performance-owner@postgresql.org Thu Nov 3 12:21:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 01F1AD89D3 for ; Thu, 3 Nov 2005 12:20:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57059-07 for ; Thu, 3 Nov 2005 16:20:57 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 6D503D88B0 for ; Thu, 3 Nov 2005 12:20:57 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Sorted union Date: Thu, 3 Nov 2005 11:20:55 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD798@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sorted union Thread-Index: AcXgjQt1GiGuThvDT+G6bdCWHJcKOgAAYaOw From: "Merlin Moncure" To: "Scott Lamb" Cc: , "Dustin Sallings" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/45 X-Sequence-Number: 15302 > Merlin Moncure wrote: > > hmm, try pushing the union into a subquery...this is better style > > because it's kind of ambiguous if the ordering will apply before/after > > the union. >=20 > Seems to be a little slower. There's a new "subquery scan" step. I figured. However it's more correct, I'm not sure if the original query is necessarily guaranteed to give the right answer (in terms of ordering). It might though. >=20 > > question: why do you want to flatten the table...is it not easier to > > work with as records? >=20 > For most things, yes. But I'm making a bunch of different graphs from > these data, and a few of them are much easier with events. The best > example is my concurrency graph. Whenever there's a start event, it goes > up one. Whenever there's a stop event, it goes down one. It's completely > trivial once you have it separated into events. well, if you don't mind attempting things that are not trivial, how about trying:=20 select t, (select count(*) from transaction where t between happened and when_stopped) from ( select ((generate_series(1,60) * scale)::text::interval) + '12:00 pm'::time as t ) q; for example, to check concurrency at every second for a minute (starting from 1 second) after 12:00 pm, (scale is zero in this case), select t, (select count(*) from transaction where t between happened and when_stopped) from ( select (generate_series(1,60)::text::interval) + '12:00 pm'::time as t ) q; this could be a win depending on how much data you pull into your concurrency graph. maybe not though. =20 Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 14:10:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97F60D98F6 for ; Thu, 3 Nov 2005 14:08:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14142-02 for ; Thu, 3 Nov 2005 18:07:54 +0000 (GMT) Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id 34EBCD8C93 for ; Thu, 3 Nov 2005 14:02:55 -0400 (AST) Received: by calvin.slamb.org (Postfix, from userid 103) id A62A26FCFE; Thu, 3 Nov 2005 12:02:55 -0600 (CST) Received: from [? @IPv6:::1] (localhost.slamb.org [127.0.0.1]) by calvin.slamb.org (Postfix) with ESMTP id 574CB6FCE5; Thu, 3 Nov 2005 12:02:48 -0600 (CST) In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD798@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD798@Herge.rcsinc.local> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9757F82C-51CC-4185-B364-FC23C267D976@slamb.org> Cc: , "Dustin Sallings" Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: Sorted union Date: Thu, 3 Nov 2005 10:02:47 -0800 To: "Merlin Moncure" X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/47 X-Sequence-Number: 15304 On Nov 3, 2005, at 8:20 AM, Merlin Moncure wrote: > select t, (select count(*) from transaction where t between happened > and when_stopped) from > ( > select ((generate_series(1,60) * scale)::text::interval) + '12:00 > pm'::time as t > ) q; Wow. I hadn't known about generate_series, but there are a bunch of places I've needed it. As cool as this is, though, I don't think it helps me. There's another event-driven graph that I need. For lack of a better name, I call it the slot graph. Every single transaction is graphed as a horizontal line from its start time to its end time, with a vertical line at the start and stop. Successful, timed out, and failed transactions are green, black, and red, respectively. I use it in a couple different ways: (1) on short timescales, it's nice to look at individual transactions. My tester will max out at either a rate or a concurrency. If I'm having problems, I'll get bursts of timeouts. This graph is the one that makes it clear why - it shows how things align, etc. Actually, even for longer timespans, this is still helpful - it's nice to see that most of the slots are filled with timing-out transactions when the rate falls. (2) It can show you if something affects all of the transactions at once. When we did a database failover test, we saw a bunch of failures (as expected; our application isn't responsible for retries). This graph is the one that showed us that _all_ transactions that were active at a specific time failed and that no other transactions failed. (There was a sharp vertical line of reds and blacks in the larger block of greens). I wish I could just show these to you, rather than describing them. It's all proprietary data, though. Maybe soon I'll have similar graphs of my open source SSL proxy. But the point is, I don't think I can represent this information without sending every data point to my application. I assign slots by the start time and free them by the stop time. But I think there is something I can do: I can just do a query of the transaction table sorted by start time. My graph tool can keep a priority queue of all active transactions, keyed by the stop time. Whenever it grabs a new event, it can peek at the next start time but check if there are any stop times before it. Then at the end, it can pick up the rest of the stop times. The concurrency will never exceed a few thousand, so the additional CPU time and memory complexity are not a problem. As a bonus, I will no longer need my index on the stop time. Dropping it will save a lot of disk space. Thanks for getting me off the "I need a fast query that returns these exact results" mindset. It is good to step back and look at the big picture. Mind you, I still think PostgreSQL should be able to perform that sorted union fast. Maybe sometime I'll have enough free time to take my first plunge into looking at a database query planner. Regards, Scott -- Scott Lamb From pgsql-performance-owner@postgresql.org Thu Nov 3 14:10:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 93869DB74D for ; Thu, 3 Nov 2005 14:08:25 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12679-09 for ; Thu, 3 Nov 2005 18:08:18 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id D19DDDB9B3 for ; Thu, 3 Nov 2005 14:03:23 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 13:03:19 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXgRdh+7ruBaqXcTaSB7/1u8tIkXgAWRwEw From: "Merlin Moncure" To: "Qingqing Zhou" Cc: , "Marc Cousin" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.046 required=5 tests=[AWL=0.046] X-Spam-Score: 0.046 X-Spam-Level: X-Archive-Number: 200511/46 X-Sequence-Number: 15303 > On Wed, 2 Nov 2005, Merlin Moncure wrote: > If you put client/server on the same machine, then we don't know how the > CPU is splitted. Can you take a look at the approximate number by > observing the task manager data while running? ok, I generated a test case which was 250k inserts to simple two column table all in single transaction. Every 50k inserts, time is recorded via timeofday(). =20 Running from remote, Time progression is: First 50k: 20 sec Second : 29 sec [...] final: : 66 sec so, clear upward progression of time/rec. Initial time is 2.5k inserts/sec which is decent but not great for such a narrow table. CPU time on server starts around 50% and drops in exact proportion to insert performance. My earlier gprof test also suggest there is no smoking gun sucking down all the cpu time. cpu time on the client is very volatile but with a clear increase over time starting around 20 and ending perhaps 60. My client box is pretty quick, 3ghz p4. Running the script locally, from the server, cpu time is pegged at 100% and stays...first 50k is 23 sec with a much worse decomposition to almost three minutes for final 50k. Merlin =20 > If communication code is the suspect, can we measure the difference if we > disable the redefinition of recv()/send() etc in port/win32.h (may require > change related code a little bit as well). In this way, the socket will > not be able to pickup signals, but let see if there is any performance > difference first. >=20 > Regards, > Qingqing >=20 >=20 > > > > [OK, I'm bringing this back on-list, and bringing it to QingQing's > > attention, who I secretly hope is the right person to be looking at this > > problem :)] > > > P.s. You scared me ;-) From pgsql-performance-owner@postgresql.org Thu Nov 3 14:23:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4209ED88B0 for ; Thu, 3 Nov 2005 14:21:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20132-05 for ; Thu, 3 Nov 2005 18:21:07 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 8CBA6DB774 for ; Thu, 3 Nov 2005 14:21:07 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Sorted union Date: Thu, 3 Nov 2005 13:21:07 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD79E@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sorted union Thread-Index: AcXgoNGK2Q0NbIHfQli0xbEvVRrdpQAAQEZg From: "Merlin Moncure" To: "Scott Lamb" Cc: , "Dustin Sallings" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.046 required=5 tests=[AWL=0.046] X-Spam-Score: 0.046 X-Spam-Level: X-Archive-Number: 200511/48 X-Sequence-Number: 15305 > Wow. I hadn't known about generate_series, but there are a bunch of > places I've needed it. It's a wonder tool :). =20 > But I think there is something I can do: I can just do a query of the > transaction table sorted by start time. My graph tool can keep a Reading the previous paragraphs I was just about to suggest this. This is a much more elegant method...you are reaping the benefits of having normalized your working set. You were trying to denormalize it back to what you were used to. Yes, now you can drop your index and simplify your queries...normalized data is always more 'natural'. > Mind you, I still think PostgreSQL should be able to perform that > sorted union fast. Maybe sometime I'll have enough free time to take > my first plunge into looking at a database query planner. I'm not so sure I agree, by using union you were basically pulling two independent sets (even if they were from the same table) that needed to be ordered. There is zero chance of using the index here for ordering because you are ordering a different set than the one being indexed. Had I not been able to talk you out of de-normalizing your table I was going to suggest rigging up a materialized view and indexing that: http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 14:33:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CE42ED9126 for ; Thu, 3 Nov 2005 14:32:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25208-03 for ; Thu, 3 Nov 2005 18:32:50 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by svr1.postgresql.org (Postfix) with ESMTP id 52E92D86B3 for ; Thu, 3 Nov 2005 14:32:49 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Thu, 03 Nov 2005 12:32:46 -0600 Message-Id: <436A03660200002500000452@gwmta.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Thu, 03 Nov 2005 12:32:06 -0600 From: "Kevin Grittner" To: , Cc: , Subject: Re: Sorted union Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200511/49 X-Sequence-Number: 15306 The ANSI/ISO specs are not at all ambiguous on this. An ORDER BY is not allowed for the SELECT statements within a UNION. It must come at the end and applied to the resulting UNION. Similarly, the column names in the result come from the first query in the UNION. Column names in the query on the right side of a UNION are immaterial. Unless we have reason to believe that PostgreSQL is non-compliant on this point, I don't think it is a good idea to slow the query down with the subquery. -Kevin >>> "Merlin Moncure" >>> > Merlin Moncure wrote: > > hmm, try pushing the union into a subquery...this is better style > > because it's kind of ambiguous if the ordering will apply before/after > > the union. > > Seems to be a little slower. There's a new "subquery scan" step. I figured. However it's more correct, I'm not sure if the original query is necessarily guaranteed to give the right answer (in terms of ordering). It might though. From pgsql-performance-owner@postgresql.org Thu Nov 3 14:41:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 934D4DB9FC for ; Thu, 3 Nov 2005 14:40:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29436-06 for ; Thu, 3 Nov 2005 18:40:17 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 891A2DB3B4 for ; Thu, 3 Nov 2005 14:37:52 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Sorted union Date: Thu, 3 Nov 2005 13:37:52 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7A0@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sorted union Thread-Index: AcXgpP6w83f1o3uVTrGZ5otYMfJ8gwAAJ7Uw From: "Merlin Moncure" To: "Kevin Grittner" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045, UPPERCASE_25_50=0] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200511/50 X-Sequence-Number: 15307 > The ANSI/ISO specs are not at all ambiguous on this. An > ORDER BY is not allowed for the SELECT statements within > a UNION. It must come at the end and applied to the resulting > UNION. Interesting :/=20 Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 14:49:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EE6E1DBD3B for ; Thu, 3 Nov 2005 14:49:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34377-06 for ; Thu, 3 Nov 2005 18:48:56 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id C485FDBB07 for ; Thu, 3 Nov 2005 14:42:09 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 13:42:08 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7A1@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXgRdh+7ruBaqXcTaSB7/1u8tIkXgAWRwEwAAGzVFA= From: "Merlin Moncure" To: "Qingqing Zhou" Cc: , "Magnus Hagander" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200511/51 X-Sequence-Number: 15308 Both win32 send/recv have pgwin32_poll_signals() in them. This is glorified WaitForSingleObjectEx on global pgwin32_signal_event. This is probably part of the problem. Can we work some of the same magic you put into check interrupts macro? ISTM everything also in win32 functions is either API call, or marginal case. Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 14:55:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00DD6DA9F3 for ; Thu, 3 Nov 2005 14:52:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36638-05 for ; Thu, 3 Nov 2005 18:52:45 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 4568BDB7E8 for ; Thu, 3 Nov 2005 14:47:09 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 13:47:09 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7A3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXgRdh+7ruBaqXcTaSB7/1u8tIkXgAWRwEwAAGzVFAAAEez8A== From: "Merlin Moncure" To: "Qingqing Zhou" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.045 required=5 tests=[AWL=0.045] X-Spam-Score: 0.045 X-Spam-Level: X-Archive-Number: 200511/52 X-Sequence-Number: 15309 > Both win32 send/recv have pgwin32_poll_signals() in them. This is > glorified WaitForSingleObjectEx on global pgwin32_signal_event. This is > probably part of the problem. Can we work some of the same magic you put > into check interrupts macro? Whoop! following a cvs update I see this is already nailed :) Back to the drawing board... Merlin From pgsql-performance-owner@postgresql.org Thu Nov 3 15:11:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B7E77DB971 for ; Thu, 3 Nov 2005 15:11:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47070-01 for ; Thu, 3 Nov 2005 19:11:45 +0000 (GMT) X-Greylist: delayed 00:20:35.173706 by SQLgrey- Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id 821E2DB972 for ; Thu, 3 Nov 2005 15:10:28 -0400 (AST) Received: by calvin.slamb.org (Postfix, from userid 103) id 8B08E6FD1E; Thu, 3 Nov 2005 12:49:53 -0600 (CST) Received: from [??@IPv6:::1] (localhost.slamb.org [127.0.0.1]) by calvin.slamb.org (Postfix) with ESMTP id 7DA096FD03; Thu, 3 Nov 2005 12:49:51 -0600 (CST) In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD79E@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD79E@Herge.rcsinc.local> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: , "Dustin Sallings" Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: Sorted union Date: Thu, 3 Nov 2005 10:49:50 -0800 To: "Merlin Moncure" X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/53 X-Sequence-Number: 15310 On Nov 3, 2005, at 10:21 AM, Merlin Moncure wrote: > Reading the previous paragraphs I was just about to suggest this. > This > is a much more elegant method...you are reaping the benefits of having > normalized your working set. You were trying to denormalize it > back to > what you were used to. Yes, now you can drop your index and simplify > your queries...normalized data is always more 'natural'. I'm not sure normalized is the right word. In either case, I'm storing it in the same form. In either case, my ConcurrencyProcessor class gets the same form. The only difference is if the database splits the rows or if my application does so. But we're essentially agreed. This is the algorithm I'm going to try implementing, and I think it will work out well. It also means sending about half as much data from the database to the application. >> Mind you, I still think PostgreSQL should be able to perform that >> sorted union fast. Maybe sometime I'll have enough free time to take >> my first plunge into looking at a database query planner. > > I'm not so sure I agree, by using union you were basically pulling two > independent sets (even if they were from the same table) that > needed to > be ordered. Yes. > There is zero chance of using the index here for ordering > because you are ordering a different set than the one being indexed. I don't think that's true. It just needs to look at the idea of independently ordering each element of the union and then merging that, compared to the cost of grabbing the union and then ordering it. In this case, the former cost is about 0 - it already has independently ordered them, and the merge algorithm is trivial. Regards, Scott -- Scott Lamb From pgsql-performance-owner@postgresql.org Thu Nov 3 15:22:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6BDEED8E9B for ; Thu, 3 Nov 2005 15:22:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47108-08 for ; Thu, 3 Nov 2005 19:22:44 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id D93E9D86A1 for ; Thu, 3 Nov 2005 15:22:44 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 3080C8F297; Thu, 3 Nov 2005 20:04:01 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 20:04:01 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE92E7E6@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 thread-index: AcXgRdh+7ruBaqXcTaSB7/1u8tIkXgAWRwEwAAGzVFAAAN8NUA== From: "Magnus Hagander" To: "Merlin Moncure" , "Qingqing Zhou" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200511/54 X-Sequence-Number: 15311 > Both win32 send/recv have pgwin32_poll_signals() in them. =20 > This is glorified WaitForSingleObjectEx on global=20 > pgwin32_signal_event. This is probably part of the problem. =20 > Can we work some of the same magic you put into check=20 > interrupts macro? >=20 > ISTM everything also in win32 functions is either API call,=20 > or marginal case. Uh, we already do that, don't we? http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32/ socket.c?rev=3D1.10 has: static int pgwin32_poll_signals(void) { if (UNBLOCKED_SIGNAL_QUEUE()) { pgwin32_dispatch_queued_signals(); errno =3D EINTR; return 1; } return 0; } Are you testing this on 8.0.x? Or a pre-RC version of 8.1? //Magnus From pgsql-performance-owner@postgresql.org Thu Nov 3 15:32:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7B5F7D7B0F for ; Thu, 3 Nov 2005 15:32:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49058-09 for ; Thu, 3 Nov 2005 19:32:45 +0000 (GMT) X-Greylist: delayed 00:20:07.389174 by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by svr1.postgresql.org (Postfix) with ESMTP id 04800D70AE for ; Thu, 3 Nov 2005 15:32:45 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Thu, 03 Nov 2005 13:12:39 -0600 Message-Id: <436A0C8F0200002500000459@gwmta.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Thu, 03 Nov 2005 13:11:43 -0600 From: "Kevin Grittner" To: , Cc: , Subject: Re: Sorted union Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200511/55 X-Sequence-Number: 15312 Just as an FYI, if you want to reassure yourself that the ORDER BY is being applied as intended, you could do the following: ( select 1 as hint, start_time as when [...] union all select 2 as hint, end_time as when [...] ) order by seq, when This is ANSI/ISO standard, and works in PostgreSQL (based on a quick test). >>> "Merlin Moncure" >>> hmm, try pushing the union into a subquery...this is better style because it's kind of ambiguous if the ordering will apply before/after the union. select q.when from ( select 1 as hint, start_time as when [...] union all select 2 as hint, end_time as when [...] ) q order by q.seq, when From pgsql-performance-owner@postgresql.org Thu Nov 3 22:32:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 82A77D9532 for ; Thu, 3 Nov 2005 22:32:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95731-07 for ; Fri, 4 Nov 2005 02:31:55 +0000 (GMT) X-Greylist: delayed 03:03:17.816287 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 14CBAD909E for ; Thu, 3 Nov 2005 22:31:48 -0400 (AST) Received: from cliff.cs.toronto.edu (cliff.cs.toronto.edu [128.100.3.120]) by svr2.postgresql.org (Postfix) with ESMTP id ACD87F0CE7 for ; Thu, 3 Nov 2005 20:25:51 +0000 (GMT) Received: from josh.db (josh.db.toronto.edu [128.100.3.95]) by cliff.cs.toronto.edu (Postfix) with ESMTP id 8EA955FD0B; Thu, 3 Nov 2005 15:25:42 -0500 (EST) Received: by josh.db (Postfix, from userid 1300) id 863C93140B; Thu, 3 Nov 2005 15:25:42 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by josh.db (Postfix) with ESMTP id 83FB0313EE; Thu, 3 Nov 2005 15:25:42 -0500 (EST) Date: Thu, 3 Nov 2005 15:25:42 -0500 (EST) From: Qingqing Zhou X-X-Sender: zhouqq@josh.db To: Magnus Hagander Cc: Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE92E7E6@algol.sollentuna.se> Message-ID: References: <6BCB9D8A16AC4241919521715F4D8BCE92E7E6@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.362 required=5 tests=[AWL=-0.117, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.362 X-Spam-Level: X-Archive-Number: 200511/64 X-Sequence-Number: 15321 On Thu, 3 Nov 2005, Magnus Hagander wrote: > > Both win32 send/recv have pgwin32_poll_signals() in them. > > This is glorified WaitForSingleObjectEx on global > > pgwin32_signal_event. This is probably part of the problem. > > Can we work some of the same magic you put into check > > interrupts macro? > > > > Uh, we already do that, don't we? > http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32/ > socket.c?rev=1.10 > has: > Yeah, we did this. I am thinking of just use simple mechanism of the win32 sockets, which could not pick up signals, but I would like to see if there is any difference -- do you think there is any point to try this? Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Nov 3 16:30:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5B3B3D7ED7 for ; Thu, 3 Nov 2005 16:30:32 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68164-10 for ; Thu, 3 Nov 2005 20:30:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 8093CD7215 for ; Thu, 3 Nov 2005 16:30:29 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id A2AEB8F293; Thu, 3 Nov 2005 21:30:30 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 21:30:30 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE92E7EF@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 thread-index: AcXgtMX4n/JL8oHyQlWDhrJfF1FpVAAAJfqg From: "Magnus Hagander" To: "Qingqing Zhou" Cc: "Merlin Moncure" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200511/56 X-Sequence-Number: 15313 > > > Both win32 send/recv have pgwin32_poll_signals() in them. > > > This is glorified WaitForSingleObjectEx on global=20 > > > pgwin32_signal_event. This is probably part of the problem. > > > Can we work some of the same magic you put into check interrupts=20 > > > macro? > > > > > > > Uh, we already do that, don't we? > >=20 > http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win3 > > 2/ > > socket.c?rev=3D1.10 > > has: > > >=20 > Yeah, we did this. I am thinking of just use simple mechanism=20 > of the win32 sockets, which could not pick up signals, but I=20 > would like to see if there is any difference -- do you think=20 > there is any point to try this? Sorry, I don't follow you here - what do you mean to do? Remove the event completely so we can't wait on it? //Magnus From pgsql-performance-owner@postgresql.org Thu Nov 3 16:34:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9841FD7115 for ; Thu, 3 Nov 2005 16:34:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72483-04 for ; Thu, 3 Nov 2005 20:34:53 +0000 (GMT) X-Greylist: delayed 00:09:10.095397 by SQLgrey- Received: from cliff.cs.toronto.edu (cliff.cs.toronto.edu [128.100.3.120]) by svr1.postgresql.org (Postfix) with ESMTP id 39454D683B for ; Thu, 3 Nov 2005 16:34:53 -0400 (AST) Received: from josh.db (josh.db.toronto.edu [128.100.3.95]) by cliff.cs.toronto.edu (Postfix) with ESMTP id 693F95FD0B; Thu, 3 Nov 2005 15:34:55 -0500 (EST) Received: by josh.db (Postfix, from userid 1300) id 57B873140B; Thu, 3 Nov 2005 15:34:55 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by josh.db (Postfix) with ESMTP id 55B1B313EE; Thu, 3 Nov 2005 15:34:55 -0500 (EST) Date: Thu, 3 Nov 2005 15:34:55 -0500 (EST) From: Qingqing Zhou X-X-Sender: zhouqq@josh.db To: Magnus Hagander Cc: Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE92E7EF@algol.sollentuna.se> Message-ID: References: <6BCB9D8A16AC4241919521715F4D8BCE92E7EF@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.363 required=5 tests=[AWL=-0.116, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.363 X-Spam-Level: X-Archive-Number: 200511/57 X-Sequence-Number: 15314 On Thu, 3 Nov 2005, Magnus Hagander wrote: > > Sorry, I don't follow you here - what do you mean to do? Remove the > event completely so we can't wait on it? > I'd like to use the win32 provided recv(), send() functions instead of redirect them to pgwin32_recv()/pgwin32_send(), just like libpq does. If we do this, we will lose some functionalities, but I'd like to see the performance difference first. -- do you think that will be any difference? Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Nov 3 16:39:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5DC2FD7115 for ; Thu, 3 Nov 2005 16:39:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73245-05 for ; Thu, 3 Nov 2005 20:39:25 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 0F5E6D683B for ; Thu, 3 Nov 2005 16:39:26 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 7AEEE8F293; Thu, 3 Nov 2005 21:39:27 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 21:39:27 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE92E7F1@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 thread-index: AcXgtg3rq7rzIltjRWC3Mk46UpIA0gAAGC+A From: "Magnus Hagander" To: "Qingqing Zhou" Cc: "Merlin Moncure" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200511/58 X-Sequence-Number: 15315 > > Sorry, I don't follow you here - what do you mean to do? Remove the=20 > > event completely so we can't wait on it? > > >=20 > I'd like to use the win32 provided recv(), send() functions=20 > instead of redirect them to pgwin32_recv()/pgwin32_send(),=20 > just like libpq does. If we do this, we will lose some=20 > functionalities, but I'd like to see the performance=20 > difference first. -- do you think that will be any difference? Doesn't work, really. It will no longer be possible to send a signal to an idle backend. The idle backend will be blocking on recv(), that's how it works. So unless we can get around that somehow, it's a non-starter I think. I doubt there will be much performance difference, as you hav eto hit the kernel anyway (in the recv/send call). But that part is just a guess :-) //Magnus From pgsql-performance-owner@postgresql.org Thu Nov 3 23:02:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C9D50DA676 for ; Thu, 3 Nov 2005 23:02:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14034-05 for ; Fri, 4 Nov 2005 03:02:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 23EABD9C63 for ; Thu, 3 Nov 2005 23:01:33 -0400 (AST) Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr2.postgresql.org (Postfix) with ESMTP id 3457EF1291 for ; Thu, 3 Nov 2005 21:04:45 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 16:04:37 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7B4@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXgtg1YULAECka0R+OccrN0knwNvgAA0Hsg From: "Merlin Moncure" To: "Qingqing Zhou" Cc: , "Magnus Hagander" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.044 required=5 tests=[AWL=0.044] X-Spam-Score: 0.044 X-Spam-Level: X-Archive-Number: 200511/65 X-Sequence-Number: 15322 > > Sorry, I don't follow you here - what do you mean to do? Remove the > > event completely so we can't wait on it? > > >=20 > I'd like to use the win32 provided recv(), send() functions instead of > redirect them to pgwin32_recv()/pgwin32_send(), just like libpq does. If > we do this, we will lose some functionalities, but I'd like to see the > performance difference first. -- do you think that will be any difference? I personally strongly doubt this will make a diffenrence. Anyways I think we might be looking at the wrong place. Here was my test: 1. drop/create table two fields (id int, f text) no keys 2. begin 3. insert 500k rows. every 50k get time get geometric growth in insert time 4. commit I am doing this via=20 type dump.sql | psql -q mydb I rearrange: every 50k rows get time but also restart transaction. I would ex Guess what...no change. This was a shocker. So I wrap dump.sql with another file that is just=20 \i dump.sql \i dump.sql and get time to insert 50k recs resets after first dump... Merlin=20 From pgsql-performance-owner@postgresql.org Thu Nov 3 17:06:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 78A5DD7ED7 for ; Thu, 3 Nov 2005 17:06:32 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77306-09 for ; Thu, 3 Nov 2005 21:06:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cliff.cs.toronto.edu (cliff.cs.toronto.edu [128.100.3.120]) by svr1.postgresql.org (Postfix) with ESMTP id 149E7D7B0F for ; Thu, 3 Nov 2005 17:06:31 -0400 (AST) Received: from eon.cs (eon.cs.toronto.edu [128.100.3.15]) by cliff.cs.toronto.edu (Postfix) with ESMTP id 078CE5FD0B; Thu, 3 Nov 2005 16:06:33 -0500 (EST) Received: by eon.cs (Postfix, from userid 1300) id 089E6698; Thu, 3 Nov 2005 16:06:32 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by eon.cs (Postfix) with ESMTP id EFFC6544; Thu, 3 Nov 2005 16:06:32 -0500 (EST) Date: Thu, 3 Nov 2005 16:06:32 -0500 (EST) From: Qingqing Zhou X-X-Sender: zhouqq@eon.cs To: Magnus Hagander Cc: Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE92E7F1@algol.sollentuna.se> Message-ID: References: <6BCB9D8A16AC4241919521715F4D8BCE92E7F1@algol.sollentuna.se> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.363 required=5 tests=[AWL=-0.116, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.363 X-Spam-Level: X-Archive-Number: 200511/59 X-Sequence-Number: 15316 On Thu, 3 Nov 2005, Magnus Hagander wrote: > > > Sorry, I don't follow you here - what do you mean to do? Remove the > > > event completely so we can't wait on it? > > > > > > > I'd like to use the win32 provided recv(), send() functions > > instead of redirect them to pgwin32_recv()/pgwin32_send(), > > just like libpq does. If we do this, we will lose some > > functionalities, but I'd like to see the performance > > difference first. -- do you think that will be any difference? > > Doesn't work, really. It will no longer be possible to send a signal to > an idle backend. The idle backend will be blocking on recv(), that's how > it works. So unless we can get around that somehow, it's a non-starter I > think. Yeah, agreed. An alternative is set tiemout like 100 ms or so. When timeout happens, check the signals. But I guess you will be strongly against it. > > I doubt there will be much performance difference, as you hav eto hit > the kernel anyway (in the recv/send call). But that part is just a guess > :-) I know what you mean ... I will take a look -- if the patch (not including fix signaling problem), if doesn't change much, I will give it a try. Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Nov 3 17:15:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 41198D7226 for ; Thu, 3 Nov 2005 17:15:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88384-05 for ; Thu, 3 Nov 2005 21:15:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 0192ED7215 for ; Thu, 3 Nov 2005 17:15:29 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id E396F8F295; Thu, 3 Nov 2005 22:15:30 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 22:15:31 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE92E7F5@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 thread-index: AcXguni/4FW9/y6GRYurysYRSVvPrwAASnSQ From: "Magnus Hagander" To: "Qingqing Zhou" Cc: "Merlin Moncure" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/60 X-Sequence-Number: 15317 > > > I'd like to use the win32 provided recv(), send()=20 > functions instead=20 > > > of redirect them to pgwin32_recv()/pgwin32_send(), just=20 > like libpq=20 > > > does. If we do this, we will lose some functionalities,=20 > but I'd like=20 > > > to see the performance difference first. -- do you think=20 > that will=20 > > > be any difference? > > > > Doesn't work, really. It will no longer be possible to send=20 > a signal=20 > > to an idle backend. The idle backend will be blocking on recv(),=20 > > that's how it works. So unless we can get around that=20 > somehow, it's a=20 > > non-starter I think. >=20 > Yeah, agreed. An alternative is set tiemout like 100 ms or=20 > so. When timeout happens, check the signals. But I guess you=20 > will be strongly against it. Not on principle, but I don't think it'll give us enough gain for the cost. But if it does, I'm certainly not against it. //Magnus From pgsql-performance-owner@postgresql.org Thu Nov 3 18:13:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8168CD7226 for ; Thu, 3 Nov 2005 18:13:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05979-08 for ; Thu, 3 Nov 2005 22:13:44 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 532F5D7215 for ; Thu, 3 Nov 2005 18:13:45 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id jA3MDh7j009930 for ; Thu, 3 Nov 2005 22:13:43 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id jA3LkcMj000589 for pgsql-performance@postgresql.org; Thu, 3 Nov 2005 21:46:38 GMT (envelope-from news) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 16:46:52 -0500 Organization: Hub.Org Networking Services Lines: 29 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> X-Complaints-To: usenet@news.hub.org X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-1.414 required=5 tests=[ALL_TRUSTED=-1.44, AWL=0.026] X-Spam-Score: -1.414 X-Spam-Level: X-Archive-Number: 200511/61 X-Sequence-Number: 15318 ""Merlin Moncure"" wrote > > Running from remote, Time progression is: > First 50k: 20 sec > Second : 29 sec > [...] > final: : 66 sec > This may due to the maintainence cost of a big transaction, I am not sure ... Tom? > so, clear upward progression of time/rec. Initial time is 2.5k > inserts/sec which is decent but not great for such a narrow table. CPU > time on server starts around 50% and drops in exact proportion to insert > performance. My earlier gprof test also suggest there is no smoking gun > sucking down all the cpu time. > Not to 100%, so this means the server is always starving. It is waiting on something -- of couse not lock. That's why I think there is some problem on network communication. Another suspect will be the write - I knwo NTFS system will issue an internal log when extending a file. To remove the second suspect, I will try to hack the source to do a "fake" write ... Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Nov 3 18:41:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 877DAD7A5C for ; Thu, 3 Nov 2005 18:41:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08747-08 for ; Thu, 3 Nov 2005 22:41:29 +0000 (GMT) X-Greylist: delayed 00:06:20.281051 by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id C1283D7215 for ; Thu, 3 Nov 2005 18:41:30 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i3so155608wra for ; Thu, 03 Nov 2005 14:41:33 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=b0MG3xvC6n+m4eFkw4c44/4aLh47k6NGIy7JcII5nZBs/pGtJaA8jyV0XT+AKJNBSsEoIdPyEv7NDrectsaYU5AD6n9vvdguon5ntb9r3kbzVfa6Ox77mBgrFAmJY4T67Am2bRj6lEDoh/yag9iL+udDKvvZ0iKyQmZLrpvTrn4= Received: by 10.54.148.4 with SMTP id v4mr1014335wrd; Thu, 03 Nov 2005 14:35:13 -0800 (PST) Received: by 10.54.105.8 with HTTP; Thu, 3 Nov 2005 14:35:13 -0800 (PST) Message-ID: <6c21003b0511031435m3217574fk3013f41a4a265222@mail.gmail.com> Date: Thu, 3 Nov 2005 16:35:13 -0600 From: Don Drake To: pgsql-performance@postgresql.org Subject: Encoding on 8.0.4 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1643_24455213.1131057313075" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.056 required=5 tests=[AWL=0.055, HTML_MESSAGE=0.001] X-Spam-Score: 0.056 X-Spam-Level: X-Archive-Number: 200511/62 X-Sequence-Number: 15319 ------=_Part_1643_24455213.1131057313075 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I recently upgraded my DB from 7.4.3 to 8.0.4 and I've noticed the followin= g errors appearing in my serverlog: 2005-11-03 05:56:57 CST 127.0.0.1(38858) ERROR: Unicode characters greater than or equal to 0x10000 are not supported 2005-11-03 06:04:09 CST 127.0.0.1(38954) ERROR: invalid byte sequence for encoding "UNICODE": 0xe02d76 2005-11-03 06:04:21 CST 127.0.0.1(38964) ERROR: invalid byte sequence for encoding "UNICODE": 0xe02d76 2005-11-03 06:11:35 CST 127.0.0.1(39072) ERROR: Unicode characters greater than or equal to 0x10000 are not supported 2005-11-03 06:23:23 CST 127.0.0.1(39657) ERROR: invalid byte sequence for encoding "UNICODE": 0xd40d 2005-11-03 08:10:02 CST 127.0.0.1(44073) ERROR: invalid byte sequence for encoding "UNICODE": 0xe46973 2005-11-03 08:21:13 CST 127.0.0.1(44711) ERROR: Unicode characters greater than or equal to 0x10000 are not supported 2005-11-03 08:26:36 CST 127.0.0.1(44745) ERROR: invalid byte sequence for encoding "UNICODE": 0xc447 2005-11-03 08:40:59 CST 127.0.0.1(45087) ERROR: invalid byte sequence for encoding "UNICODE": 0xdd20 2005-11-03 09:14:52 CST 127.0.0.1(46009) ERROR: Unicode characters greater than or equal to 0x10000 are not supported I never received these errors on when running 7.4.3. I used the default encodings on 7.4.3 and I tried chaning client_encoding from sql_ascii to UNICODE and I'm still seeing this. I'm storing in a text data type email that contains other characterset characters. Any ideas on how to resolve this? -Don -- Donald Drake President Drake Consulting http://www.drakeconsult.com/ http://www.MailLaunder.com/ http://www.mobilemeridian.com/ 312-560-1574 ------=_Part_1643_24455213.1131057313075 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I recently upgraded my DB from 7.4.3 to 8.0.4 and I've noticed the followin= g errors appearing in my serverlog:


2005-11-03 05:56:57 CST 127.0.0.1(38858) ERROR:  Unicode characters gr= eater than or equal to 0x10000 are not supported
2005-11-03 06:04:09 CST 127.0.0.1(38954) ERROR:  invalid byte sequence= for encoding "UNICODE": 0xe02d76
2005-11-03 06:04:21 CST 127.0.0.1(38964) ERROR:  invalid byte sequence= for encoding "UNICODE": 0xe02d76
2005-11-03 06:11:35 CST 127.0.0.1(39072) ERROR:  Unicode characters gr= eater than or equal to 0x10000 are not supported
2005-11-03 06:23:23 CST 127.0.0.1(39657) ERROR:  invalid byte sequence= for encoding "UNICODE": 0xd40d
2005-11-03 08:10:02 CST 127.0.0.1(44073) ERROR:  invalid byte sequence= for encoding "UNICODE": 0xe46973
2005-11-03 08:21:13 CST 127.0.0.1(44711) ERROR:  Unicode characters gr= eater than or equal to 0x10000 are not supported
2005-11-03 08:26:36 CST 127.0.0.1(44745) ERROR:  invalid byte sequence= for encoding "UNICODE": 0xc447
2005-11-03 08:40:59 CST 127.0.0.1(45087) ERROR:  invalid byte sequence= for encoding "UNICODE": 0xdd20
2005-11-03 09:14:52 CST 127.0.0.1(46009) ERROR:  Unicode characters gr= eater than or equal to 0x10000 are not supported

I never received these errors on when running 7.4.3.  I used the default encodings on 7.4.3 and I tried chaning client_encoding from sql_ascii to UNICODE and I'm still seeing this. I'm storing in a text data type email that contains other characterset characters.  

Any ideas on how to resolve this?

-Don

--
Donald Drake
President
Drake Consult= ing
http://www.drakeconsult.c= om/
http://www.MailLaunder.com/
http://www.mobilemeridia= n.com/
312-560-1574
------=_Part_1643_24455213.1131057313075-- From pgsql-performance-owner@postgresql.org Thu Nov 3 19:30:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EDEADD7115 for ; Thu, 3 Nov 2005 19:30:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26912-10 for ; Thu, 3 Nov 2005 23:30:03 +0000 (GMT) X-Greylist: delayed 01:43:21.814595 by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7004FD683B for ; Thu, 3 Nov 2005 19:30:04 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 8B43931058; Fri, 4 Nov 2005 00:30:05 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 18:30:12 -0500 Organization: Hub.Org Networking Services Lines: 76 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.566 required=5 tests=[AWL=0.566] X-Spam-Score: 0.566 X-Spam-Level: X-Archive-Number: 200511/63 X-Sequence-Number: 15320 "Qingqing Zhou" wrote > > Not to 100%, so this means the server is always starving. It is waiting on > something -- of couse not lock. That's why I think there is some problem > on network communication. Another suspect will be the write - I knwo NTFS > system will issue an internal log when extending a file. To remove the > second suspect, I will try to hack the source to do a "fake" write ... > To patch: ------------------------- Here is a quite straight hack to implement "fake" write for both relation and xlog. Now the server becomes pure CPU play. 1. RelationGetBufferForTuple()/hio.c: remove line (if you do not enable cassert, then doesn't matter): - Assert(PageIsNew((PageHeader) pageHeader)); 2. ReadBuffer()/bufmgr.c: remove line - smgrextend(reln->rd_smgr, blockNum, (char *) bufBlock, - reln->rd_istemp); 3. XLogWrite()/xlog.c errno = 0; + goto fake; if (write(openLogFile, from, nbytes) != nbytes) { /* if write didn't set errno, assume no disk space */ ... } + + fake: /* Update state for write */ To use it: ------------------------- 1. have several copies of a correct data; 2. patch the server; 3. when you startup postmaster, use the following parameters: postmaster -c"checkpoint_timeout=3600" -c"bgwriter_all_percent=0" -Ddata Note now the database server is one-shoot usable -- after you shutdown, it won't startup again. Just run begin; many inserts; end; To observe: ------------------------- (1) In this case, what's the remote server CPU usage -- 100%? I don't have several machines to test it. In my single machine, I run 35000 insert commands from psql by cut and paste into it and could observe that: --- 25% kernel time 75% user time 20% postgresql (--enable-debug --enable-cassert) 65% psql (as same above) 10% csrss (system process, manage graphics commands (not sure, just googled it), etc) 5% system (system process) --- (2) In this case, Linux still keeps almost 10 times faster? After this, we may need more observations like comparison of simple "select 1;" to reduce the code space we may want to explore ... Regards, Qingqing From pgsql-performance-owner@postgresql.org Thu Nov 3 23:03:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BA1F5DACD6 for ; Thu, 3 Nov 2005 23:03:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14538-04 for ; Fri, 4 Nov 2005 03:02:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id EF770D9FF3 for ; Thu, 3 Nov 2005 23:01:56 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr2.postgresql.org (Postfix) with ESMTP id 5BCAEF1A5F for ; Thu, 3 Nov 2005 23:57:03 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA3NuxJ4007861; Thu, 3 Nov 2005 18:57:01 -0500 (EST) To: "Merlin Moncure" Cc: "Qingqing Zhou" , pgsql-performance@postgresql.org, "Marc Cousin" Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Thu, 03 Nov 2005 13:03:19 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <7853.1131062168.0@sss.pgh.pa.us> Date: Thu, 03 Nov 2005 18:56:59 -0500 Message-ID: <7860.1131062219@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/66 X-Sequence-Number: 15323 ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7853.1131062168.1@sss.pgh.pa.us> "Merlin Moncure" writes: > ok, I generated a test case which was 250k inserts to simple two column > table all in single transaction. Every 50k inserts, time is recorded > via timeofday(). You mean something like the attached? > Running from remote, Time progression is: > First 50k: 20 sec > Second : 29 sec > [...] > final: : 66 sec On Unix I get a dead flat line (within measurement noise), both local loopback and across my LAN. after 50000 30.20 sec after 100000 31.67 sec after 150000 30.98 sec after 200000 29.64 sec after 250000 29.83 sec "top" shows nearly constant CPU usage over the run, too. With a local connection it's pretty well pegged, with LAN connection the server's about 20% idle and the client about 90% (client machine is much faster than server which may affect this, but I'm too lazy to try it in the other direction). I think it's highly likely that you are looking at some strange behavior of the Windows TCP stack. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: application/octet-stream Content-ID: <7853.1131062168.2@sss.pgh.pa.us> Content-Description: timeit.c /* * testlibpq.c * * Test the C version of libpq, the PostgreSQL frontend library. */ #include #include #include #include "libpq-fe.h" static void exit_nicely(PGconn *conn) { PQfinish(conn); exit(1); } static void do_cmd(PGconn *conn, const char *cmd) { PGresult *res; res = PQexec(conn, cmd); if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, "%s failed: %s", cmd, PQerrorMessage(conn)); PQclear(res); exit_nicely(conn); } PQclear(res); } static const char * rusage_show(const struct timeval *tvold, const struct timeval *tvnew) { static char result[100]; struct timeval tv = *tvnew; if (tv.tv_usec < tvold->tv_usec) { tv.tv_sec--; tv.tv_usec += 1000000; } sprintf(result, "%d.%02d sec", (int) (tv.tv_sec - tvold->tv_sec), (int) (tv.tv_usec - tvold->tv_usec) / 10000); return result; } int main(int argc, char **argv) { const char *conninfo; PGconn *conn; char cmdbuf[1024]; struct timeval tv; struct timeval tvold; int i; /* * If the user supplies a parameter on the command line, use it as the * conninfo string; otherwise default to setting dbname=postgres and using * environment variables or defaults for all other connection parameters. */ if (argc > 1) conninfo = argv[1]; else conninfo = "dbname = postgres"; /* Make a connection to the database */ conn = PQconnectdb(conninfo); /* Check to see that the backend connection was successfully made */ if (PQstatus(conn) != CONNECTION_OK) { fprintf(stderr, "Connection to database failed: %s", PQerrorMessage(conn)); exit_nicely(conn); } /* Create working table */ do_cmd(conn, "CREATE TABLE foo (f1 int, f2 int);"); /* Start a transaction block */ do_cmd(conn, "BEGIN"); gettimeofday(&tvold, NULL); for (i = 1; i <= 250000; i++) { sprintf(cmdbuf, "INSERT INTO foo VALUES(%d,%d);", i, i); do_cmd(conn, cmdbuf); if (i % 50000 == 0) { gettimeofday(&tv, NULL); printf("after %d %s\n", i, rusage_show(&tvold, &tv)); tvold = tv; } } /* end the transaction */ do_cmd(conn, "END"); /* drop table */ do_cmd(conn, "DROP TABLE foo;"); /* close the connection to the database and cleanup */ PQfinish(conn); return 0; } ------- =_aaaaaaaaaa0-- From pgsql-performance-owner@postgresql.org Fri Nov 4 03:29:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C4D8D6824 for ; Fri, 4 Nov 2005 03:29:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24847-02 for ; Fri, 4 Nov 2005 07:29:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cliff.cs.toronto.edu (cliff.cs.toronto.edu [128.100.3.120]) by svr1.postgresql.org (Postfix) with ESMTP id F3332D687B for ; Fri, 4 Nov 2005 03:29:49 -0400 (AST) Received: from eon.cs (eon.cs.toronto.edu [128.100.3.15]) by cliff.cs.toronto.edu (Postfix) with ESMTP id 94C315FD0B; Fri, 4 Nov 2005 02:29:49 -0500 (EST) Received: by eon.cs (Postfix, from userid 1300) id CCFBE698; Fri, 4 Nov 2005 02:29:49 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by eon.cs (Postfix) with ESMTP id C24FE544; Fri, 4 Nov 2005 02:29:49 -0500 (EST) Date: Fri, 4 Nov 2005 02:29:49 -0500 (EST) From: Qingqing Zhou X-X-Sender: zhouqq@eon.cs To: Tom Lane Cc: Merlin Moncure , pgsql-performance@postgresql.org, Marc Cousin Subject: Re: insert performance for win32 In-Reply-To: <7860.1131062219@sss.pgh.pa.us> Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> <7860.1131062219@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.362 required=5 tests=[AWL=-0.117, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.362 X-Spam-Level: X-Archive-Number: 200511/67 X-Sequence-Number: 15324 On Thu, 3 Nov 2005, Tom Lane wrote: > > On Unix I get a dead flat line (within measurement noise), both local > loopback and across my LAN. > > after 50000 30.20 sec > after 100000 31.67 sec > after 150000 30.98 sec > after 200000 29.64 sec > after 250000 29.83 sec > Confirmed in Linux. And on a winxp machine(sp2) with server, client together, with (see almost no performance difference) or without my "fake" write, the observation is still hold for both cases: after 50000 25.21 sec after 100000 26.26 sec after 150000 25.23 sec after 200000 26.25 sec after 250000 26.58 sec In both cases, postgres 67% cpu, psql 15~20%, rest: system process. Kernel time is 40+% -- where from? Regards, Qingqing From pgsql-performance-owner@postgresql.org Fri Nov 4 10:45:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 398F4D97D6 for ; Fri, 4 Nov 2005 10:45:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00574-08 for ; Fri, 4 Nov 2005 14:45:10 +0000 (GMT) X-Greylist: delayed 03:06:39.978367 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 100B9D9437 for ; Fri, 4 Nov 2005 10:45:11 -0400 (AST) Received: from mx.mall.cz (mx.mall.cz [62.168.45.106]) by svr2.postgresql.org (Postfix) with ESMTP id CC5D3F0F89 for ; Fri, 4 Nov 2005 11:38:34 +0000 (GMT) Received: from localhost (asterix [127.0.0.1]) by mx.mall.cz (Postfix) with ESMTP id 0B5B113FC02 for ; Fri, 4 Nov 2005 12:38:30 +0100 (CET) Received: from mx.mall.cz ([127.0.0.1]) by localhost (asterix [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 06153-02 for ; Fri, 4 Nov 2005 12:38:29 +0100 (CET) Message-ID: <436B4836.7030300@mall.cz> Date: Fri, 04 Nov 2005 12:38:30 +0100 From: Michal Taborsky User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: cs, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Searching union views not using indices Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at mall.cz X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/70 X-Sequence-Number: 15327 Hello everyone. We are facing a performance problem with views consisting of several unioned tables. The simplified schema is as follows: CREATE TABLE foo ( foo_object_id bigint, link_id bigint, somedata text, PRIMARY KEY (foo_object_id) ); CREATE TABLE bar ( bar_object_id bigint, link_id bigint, otherdata real, PRIMARY KEY (bar_object_id) ); There are actually five of such tables, all having two common attributes *_object_id and link_id. All tables have indices on link_id, which is very selective, close to unique. The *_object_id is unique within this scope across all tables, but that's not important. Then we have a view: CREATE VIEW commonview AS SELECT foo_object_id as object_id, link_id, 'It is in foo' as loc FROM foo UNION SELECT bar_object_id as object_id, link_id, 'It is in bar' as loc FROM bar We commonly do this: SELECT object_id FROM commonview WHERE link_id=1234567 The result is sequential scan on all tables, append, sort and then filter scan on this whole thing. Which of course is slow as hell. We use version 8.0.2. And now the question: Is there a way to force the planner to push the condition lower, so it will use the index? Or do you use some tricks in this scenario? Thanks for your suggestions. Bye. -- Michal T�borsk� CTO, Internet Mall, a.s. Internet Mall - obchody, kter� si obl�b�te From pgsql-performance-owner@postgresql.org Fri Nov 4 09:49:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 26052D90CA for ; Fri, 4 Nov 2005 09:49:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66150-04 for ; Fri, 4 Nov 2005 13:49:26 +0000 (GMT) X-Greylist: delayed 16:44:44.85214 by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 730EFD9045 for ; Fri, 4 Nov 2005 09:49:28 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C5E146.900B2D40" Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 08:49:22 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7BF@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXg7UM8MlmSCnXPQCG3O58GFmcQdQAWBuDg From: "Merlin Moncure" To: "Tom Lane" Cc: "Qingqing Zhou" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.044 required=5 tests=[AWL=0.044] X-Spam-Score: 0.044 X-Spam-Level: X-Archive-Number: 200511/68 X-Sequence-Number: 15325 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5E146.900B2D40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > You mean something like the attached? not quite: attached is a file to generate test. to do it: psql yadda \i timeit.sql \t \o dump.sql select make_dump(50000, false); \q cat dump.sql | psql -q yadda and see what pops out. I had to do it that way because redirecting psql to dump file caused psql sit forever waiting on more with cpu load... Merlin ------_=_NextPart_001_01C5E146.900B2D40 Content-Type: application/octet-stream; name="timeit.sql" Content-Transfer-Encoding: base64 Content-Description: timeit.sql Content-Disposition: attachment; filename="timeit.sql" Y3JlYXRlIG9yIHJlcGxhY2UgZnVuY3Rpb24gbWFrZV9kdW1wKHNjYWxpbmcgaW50ZWdlciwgc2lu Z2xlX3RyYW5zYWN0aW9uIGJvb2xlYW4pIHJldHVybnMgdGV4dCBhcyANCiQkDQogICAgZGVjbGFy ZSANCiAgICAgICAgaWkgICAgICAgICAgICAgIGludGVnZXI7DQogICAgICAgIGpqICAgICAgICAg ICAgICBpbnRlZ2VyOw0KICAgICAgICBrayAgICAgICAgICAgICAgaW50ZWdlciBkZWZhdWx0IDA7 DQogICAgICAgIGR1bXBfc3FsICAgICAgICB0ZXh0Ow0KICAgICAgICBpbnNlcnRfbGluZXMgICAg dGV4dCBkZWZhdWx0ICcnOw0KICAgICAgICBzY2FsaW5nX2FkaiAgICAgaW50ZWdlcjsNCiAgICAg ICAgbWluX2RlbHRhICAgICAgIGludGVnZXIgZGVmYXVsdCAxMDAwOw0KICAgIGJlZ2luDQogICAg ICAgIGR1bXBfc3FsIDo9ICdkcm9wIHRhYmxlIGJ1bGtfaW5zZXJ0OyBjcmVhdGUgdGFibGUgYnVs a19pbnNlcnQoaWQgaW50LCBmIHRleHQpO1xuJzsNCiAgICAgICAgZHVtcF9zcWwgOj0gZHVtcF9z cWwgfHwgJ2JlZ2luO1xuJzsNCiAgICAgICAgZHVtcF9zcWwgOj0gZHVtcF9zcWwgfHwgJ3NlbGVj dCB0aW1lb2ZkYXkoKTsgXG4nOw0KICAgICAgICANCiAgICAgICAgc2NhbGluZ19hZGogOj0gc2Nh bGluZyAgLyBtaW5fZGVsdGE7DQogICAgICAgIA0KICAgICAgICBmb3IgaWkgaW4gMS4ubWluX2Rl bHRhIGxvb3ANCiAgICAgICAgICAgIGluc2VydF9saW5lcyA6PSBpbnNlcnRfbGluZXMgfHwgJ0lO U0VSVCBJTlRPIGJ1bGtfaW5zZXJ0IFZBTFVFUyAoJyB8fCBrayB8fCANCiAgICAgICAgICAgICAg ICAgICAnLCBcJycgfHwga2sgfHwgJ1wnKTtcbic7ICAgICAgICAgICAgICAgIA0KICAgICAgICAg ICAgICAgICAgIA0KICAgICAgICAgICBrayA6PSBrayArIDE7ICAgICAgICAgICAgICAgICAgIA0K ICAgICAgICBlbmQgbG9vcDsNCiAgICAgICAgDQogICAgICAgIGtrIDo9IDA7DQogICAgICAgIA0K ICAgICAgICBmb3IgaWkgaW4gMS4uNSBsb29wDQogICAgICAgICAgICBpZiBpaSA+IDEgYW5kIHNp bmdsZV90cmFuc2FjdGlvbiA9IGZhbHNlIHRoZW4NCiAgICAgICAgICAgICAgICBkdW1wX3NxbCA6 PSBkdW1wX3NxbCB8fCAnY29tbWl0OyBiZWdpbjtcbic7ICAgDQogICAgICAgICAgICBlbmQgaWY7 DQogICAgICAgICAgICANCiAgICAgICAgICAgIGZvciBqaiBpbiAxLi5zY2FsaW5nX2FkaiBsb29w DQogICAgICAgICAgICAgICAgZHVtcF9zcWwgOj0gZHVtcF9zcWwgfHwgaW5zZXJ0X2xpbmVzOw0K ICAgICAgICAgICAgICAgIGtrIDo9IGtrICsgbWluX2RlbHRhOyAgICAgICAgICAgICAgICAgICAg DQogICAgICAgICAgICBlbmQgbG9vcDsNCiAgICAgICAgICAgIA0KICAgICAgICAgICAgcmFpc2Ug bm90aWNlICclIHJvd3MgYWRkZWQnLCBrazsNCiAgICAgICAgICAgIA0KICAgICAgICAgICAgZHVt cF9zcWwgOj0gZHVtcF9zcWwgfHwgJ3NlbGVjdCB0aW1lb2ZkYXkoKTsgXG4nOw0KICAgICAgICBl bmQgbG9vcDsNCiAgICAgICAgDQogICAgICAgIGR1bXBfc3FsIDo9IGR1bXBfc3FsIHx8ICdjb21t aXQ7IFxuJzsNCiAgICAgICAgDQogICAgICAgIHJldHVybiBkdW1wX3NxbDsgICAgICAgDQogICAg ZW5kOyAgICANCg0KJCQgbGFuZ3VhZ2UgcGxwZ3NxbDs= ------_=_NextPart_001_01C5E146.900B2D40-- From pgsql-performance-owner@postgresql.org Fri Nov 4 10:07:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92DCAD680C for ; Fri, 4 Nov 2005 10:07:58 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70572-08 for ; Fri, 4 Nov 2005 14:07:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 1786ED680B for ; Fri, 4 Nov 2005 10:07:56 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 09:08:00 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7C2@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXg7UM8MlmSCnXPQCG3O58GFmcQdQAWBuDgAADmBzA= From: "Merlin Moncure" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.043 required=5 tests=[AWL=0.043] X-Spam-Score: 0.043 X-Spam-Level: X-Archive-Number: 200511/69 X-Sequence-Number: 15326 > > You mean something like the attached? oh, btw I ran timeit.c and performance is flat and fairly fast. I'm pretty sure psql is the culprit here. Merlin From pgsql-performance-owner@postgresql.org Fri Nov 4 10:59:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD41CD95D5 for ; Fri, 4 Nov 2005 10:59:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21296-03 for ; Fri, 4 Nov 2005 14:59:21 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 42EEDD95D0 for ; Fri, 4 Nov 2005 10:59:22 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4ExLAK013483; Fri, 4 Nov 2005 09:59:21 -0500 (EST) To: "Merlin Moncure" Cc: "Qingqing Zhou" , pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD7BF@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7BF@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 04 Nov 2005 08:49:22 -0500" Date: Fri, 04 Nov 2005 09:59:20 -0500 Message-ID: <13482.1131116360@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/71 X-Sequence-Number: 15328 "Merlin Moncure" writes: >> You mean something like the attached? > not quite: attached is a file to generate test. > cat dump.sql | psql -q yadda Ah. Does your psql have readline support? if so, does adding -n to that command change anything? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 11:05:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2B779D979F for ; Fri, 4 Nov 2005 11:05:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21967-09 for ; Fri, 4 Nov 2005 15:05:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id C267AD982E for ; Fri, 4 Nov 2005 11:05:43 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id E6D4740C066; Fri, 4 Nov 2005 15:05:20 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 407A815EDA; Fri, 4 Nov 2005 15:01:08 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04715-07; Fri, 4 Nov 2005 15:01:05 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id A7C8A15ED9; Fri, 4 Nov 2005 15:01:05 +0000 (GMT) Message-ID: <436B77B1.7090602@archonet.com> Date: Fri, 04 Nov 2005 15:01:05 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michal Taborsky Cc: pgsql-performance@postgresql.org Subject: Re: Searching union views not using indices References: <436B4836.7030300@mall.cz> In-Reply-To: <436B4836.7030300@mall.cz> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/72 X-Sequence-Number: 15329 Michal Taborsky wrote: ... > UNION ... > The result is sequential scan on all tables, append, sort and then > filter scan on this whole thing. Which of course is slow as hell. We use > version 8.0.2. > > And now the question: Is there a way to force the planner to push the > condition lower, so it will use the index? Or do you use some tricks in > this scenario? Thanks for your suggestions. Try "UNION ALL", since UNION is defined as removing duplicates, which probably accounts for the sort. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Nov 4 11:08:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E02D5D9079 for ; Fri, 4 Nov 2005 11:08:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21622-10 for ; Fri, 4 Nov 2005 15:07:58 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 3C886D8ED6 for ; Fri, 4 Nov 2005 11:07:59 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Searching union views not using indices Date: Fri, 4 Nov 2005 10:07:53 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7C6@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Searching union views not using indices Thread-Index: AcXhTubtTeu2pLbtRnqEZkJUmCROXgAAGq6g From: "Merlin Moncure" To: "Michal Taborsky" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.043 required=5 tests=[AWL=0.043] X-Spam-Score: 0.043 X-Spam-Level: X-Archive-Number: 200511/73 X-Sequence-Number: 15330 > Hello everyone. >=20 > We are facing a performance problem with views consisting of several > unioned tables. The simplified schema is as follows: >=20 > CREATE TABLE foo ( > foo_object_id bigint, > link_id bigint, > somedata text, > PRIMARY KEY (foo_object_id) ); point 1: well, you may want to consider: create table foobar (=20 prefix text, -- foo/bar/etc object_id bigint, link_id bigint, primary key(prefix, object_id) ); -- add indexes as appropriate and push foo/bar specific information to satellite table which refer back via pkey-key link. Now you get very quick and easy link id query and no view is necessary. You also may want to look at table inheritance but make sure you read all the disclaimers first. point 2:=20 watch out for union, it is implied sort and duplicate filter. union all is faster although you may get duplicates. Merlin From pgsql-performance-owner@postgresql.org Fri Nov 4 11:12:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 23778D93EB for ; Fri, 4 Nov 2005 11:12:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17609-10 for ; Fri, 4 Nov 2005 15:12:17 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id AF45FD93CF for ; Fri, 4 Nov 2005 11:12:19 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 10:12:23 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7C7@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXhUFvTQWVQNdjmQbWKM9wSYgUMjAAAMETQ From: "Merlin Moncure" To: "Tom Lane" Cc: , "Qingqing Zhou" , "Marc Cousin" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.042 required=5 tests=[AWL=0.042] X-Spam-Score: 0.042 X-Spam-Level: X-Archive-Number: 200511/74 X-Sequence-Number: 15331 > > not quite: attached is a file to generate test. >=20 > > cat dump.sql | psql -q yadda >=20 > Ah. Does your psql have readline support? if so, does adding -n to > that command change anything? >=20 It doesn't, and it doesn't. :/ Ok, here's where it gets interesting. I removed all the newlines from the test output (dump.sql) and got flat times ;). =20 Merlin From pgsql-performance-owner@postgresql.org Fri Nov 4 11:14:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E1CCD9079 for ; Fri, 4 Nov 2005 11:13:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18686-10 for ; Fri, 4 Nov 2005 15:13:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id CB3BCD8286 for ; Fri, 4 Nov 2005 11:13:05 -0400 (AST) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr2.postgresql.org (Postfix) with ESMTP id 5C1A7F13CB for ; Fri, 4 Nov 2005 15:13:10 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jA4FCwvG016968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Nov 2005 08:13:01 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jA4FCwMN089807; Fri, 4 Nov 2005 08:12:58 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jA4FCwgG089806; Fri, 4 Nov 2005 08:12:58 -0700 (MST) (envelope-from mfuhr) Date: Fri, 4 Nov 2005 08:12:57 -0700 From: Michael Fuhr To: Michal Taborsky Cc: pgsql-performance@postgresql.org Subject: Re: Searching union views not using indices Message-ID: <20051104151257.GA89760@winnie.fuhr.org> References: <436B4836.7030300@mall.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <436B4836.7030300@mall.cz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/75 X-Sequence-Number: 15332 On Fri, Nov 04, 2005 at 12:38:30PM +0100, Michal Taborsky wrote: > SELECT object_id FROM commonview WHERE link_id=1234567 > > The result is sequential scan on all tables, append, sort and then > filter scan on this whole thing. Which of course is slow as hell. We use > version 8.0.2. I couldn't duplicate this in 8.0.4; I don't know if anything's changed since 8.0.2 that would affect the query plan. Could you post the EXPLAIN ANALYZE output? It might also be useful to see the output with enable_seqscan disabled. Have the tables been vacuumed and analyzed recently? -- Michael Fuhr From pgsql-performance-owner@postgresql.org Fri Nov 4 11:21:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46E51D8C87 for ; Fri, 4 Nov 2005 11:21:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32906-07 for ; Fri, 4 Nov 2005 15:21:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BCF09D8286 for ; Fri, 4 Nov 2005 11:21:44 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4FLnBg013734; Fri, 4 Nov 2005 10:21:49 -0500 (EST) To: "Merlin Moncure" Cc: pgsql-performance@postgresql.org, "Qingqing Zhou" , "Marc Cousin" Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD7C7@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7C7@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 04 Nov 2005 10:12:23 -0500" Date: Fri, 04 Nov 2005 10:21:49 -0500 Message-ID: <13733.1131117709@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/76 X-Sequence-Number: 15333 "Merlin Moncure" writes: > It doesn't, and it doesn't. :/ Ok, here's where it gets interesting. I > removed all the newlines from the test output (dump.sql) and got flat > times ;). That's bizarre ... I'd have thought a very long line would be more likely to trigger internal performance problems than the original. What happens if you read the file with "psql -f dump.sql" instead of cat/stdin? BTW, I get flat times for your psql test case on Unix, again both with local and remote client. So whatever is going on here, it's Windows-specific. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 11:31:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 76202D8286 for ; Fri, 4 Nov 2005 11:31:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44913-01 for ; Fri, 4 Nov 2005 15:31:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id B71ECD6824 for ; Fri, 4 Nov 2005 11:31:06 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 10:31:11 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CB@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXhU3wOS8GWkDaqRfSLJHAcWq7e9QAAOzHQ From: "Merlin Moncure" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.042 required=5 tests=[AWL=0.042] X-Spam-Score: 0.042 X-Spam-Level: X-Archive-Number: 200511/77 X-Sequence-Number: 15334 > That's bizarre ... I'd have thought a very long line would be more > likely to trigger internal performance problems than the original. >=20 > What happens if you read the file with "psql -f dump.sql" instead > of cat/stdin? non-flat. Also ran via \i and got non flat times. > BTW, I get flat times for your psql test case on Unix, again both with > local and remote client. So whatever is going on here, it's > Windows-specific. yeah. I'm guessing problem is in the mingw flex/bison (which I really, really hope is not the case) or some other win32 specific block of code. I'm snooping around there... Merlin=20 From pgsql-performance-owner@postgresql.org Fri Nov 4 11:31:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6AE85D91AD for ; Fri, 4 Nov 2005 11:31:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40480-05 for ; Fri, 4 Nov 2005 15:31:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9EB43D9135 for ; Fri, 4 Nov 2005 11:31:33 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4FVYjS013816; Fri, 4 Nov 2005 10:31:34 -0500 (EST) To: Michal Taborsky Cc: pgsql-performance@postgresql.org Subject: Re: Searching union views not using indices In-reply-to: <436B4836.7030300@mall.cz> References: <436B4836.7030300@mall.cz> Comments: In-reply-to Michal Taborsky message dated "Fri, 04 Nov 2005 12:38:30 +0100" Date: Fri, 04 Nov 2005 10:31:34 -0500 Message-ID: <13815.1131118294@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/78 X-Sequence-Number: 15335 Michal Taborsky writes: > We are facing a performance problem with views consisting of several > unioned tables. The simplified schema is as follows: Perhaps you should show us the real schema, because I cannot duplicate your complaint on the toy case you show. regression=# explain SELECT object_id FROM commonview WHERE link_id=1234567; QUERY PLAN ------------------------------------------------------------------------------------------------ Subquery Scan commonview (cost=41.40..41.66 rows=13 width=8) -> Unique (cost=41.40..41.53 rows=13 width=16) -> Sort (cost=41.40..41.43 rows=13 width=16) Sort Key: object_id, link_id, loc -> Append (cost=0.00..41.16 rows=13 width=16) -> Subquery Scan "*SELECT* 1" (cost=0.00..17.12 rows=5 width=16) -> Index Scan using fooi on foo (cost=0.00..17.07 rows=5 width=16) Index Cond: (link_id = 1234567) -> Subquery Scan "*SELECT* 2" (cost=0.00..24.04 rows=8 width=16) -> Index Scan using bari on bar (cost=0.00..23.96 rows=8 width=16) Index Cond: (link_id = 1234567) (11 rows) (I had to add indexes on link_id to the example, of course.) As noted by others, you probably want to be using UNION ALL not UNION, but that's not the crux of the issue. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 11:36:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E7C1AD907C for ; Fri, 4 Nov 2005 11:36:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42883-09 for ; Fri, 4 Nov 2005 15:36:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 49BBAD8F1D for ; Fri, 4 Nov 2005 11:36:29 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4FaYNM013862; Fri, 4 Nov 2005 10:36:34 -0500 (EST) To: "Merlin Moncure" Cc: pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CB@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CB@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 04 Nov 2005 10:31:11 -0500" Date: Fri, 04 Nov 2005 10:36:34 -0500 Message-ID: <13861.1131118594@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/79 X-Sequence-Number: 15336 "Merlin Moncure" writes: > yeah. I'm guessing problem is in the mingw flex/bison (which I really, > really hope is not the case) or some other win32 specific block of code. > I'm snooping around there... Maybe I'm confused here, but I thought we had established that the local and remote cases behave differently for you? If so I'd suppose that it must be a networking issue, and there's little point in looking inside psql. If the problem is internal to psql, gprof or similar tool would be helpful ... got anything like that on Windows? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 11:41:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A59EFD919D for ; Fri, 4 Nov 2005 11:41:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39861-06 for ; Fri, 4 Nov 2005 15:41:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 19CB3D90CA for ; Fri, 4 Nov 2005 11:41:18 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 10:41:23 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CD@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXhVYttMQihlaMCQRKTMrOizW6mCAAADVLg From: "Merlin Moncure" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.041 required=5 tests=[AWL=0.041] X-Spam-Score: 0.041 X-Spam-Level: X-Archive-Number: 200511/80 X-Sequence-Number: 15337 >=20 > "Merlin Moncure" writes: > > yeah. I'm guessing problem is in the mingw flex/bison (which I really, > > really hope is not the case) or some other win32 specific block of code. > > I'm snooping around there... >=20 > Maybe I'm confused here, but I thought we had established that the local > and remote cases behave differently for you? If so I'd suppose that it > must be a networking issue, and there's little point in looking inside > psql. >=20 The local case is *worse*...presumably because psql is competing with the server for cpu time...cpu load is pegged at 100%. On the remote case, I'm getting 50-60% cpu load which is way to high. The problem is definitely in psql. Merlin From pgsql-performance-owner@postgresql.org Fri Nov 4 11:56:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 11BA9D86FB for ; Fri, 4 Nov 2005 11:55:58 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45971-10 for ; Fri, 4 Nov 2005 15:55:53 +0000 (GMT) X-Greylist: delayed 04:17:25.078739 by SQLgrey- Received: from mx.mall.cz (mx.mall.cz [62.168.45.106]) by svr1.postgresql.org (Postfix) with ESMTP id 3B513D7115 for ; Fri, 4 Nov 2005 11:55:55 -0400 (AST) Received: from localhost (asterix [127.0.0.1]) by mx.mall.cz (Postfix) with ESMTP id 7C2D913FC03; Fri, 4 Nov 2005 16:55:58 +0100 (CET) Received: from mx.mall.cz ([127.0.0.1]) by localhost (asterix [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 18148-02; Fri, 4 Nov 2005 16:55:57 +0100 (CET) Message-ID: <436B848F.5030402@mall.cz> Date: Fri, 04 Nov 2005 16:55:59 +0100 From: Michal Taborsky User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: cs, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Searching union views not using indices References: <436B4836.7030300@mall.cz> <13815.1131118294@sss.pgh.pa.us> In-Reply-To: <13815.1131118294@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at mall.cz X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/81 X-Sequence-Number: 15338 Tom Lane napsal(a): > Michal Taborsky writes: > >>We are facing a performance problem with views consisting of several >>unioned tables. The simplified schema is as follows: > > > Perhaps you should show us the real schema, because I cannot duplicate > your complaint on the toy case you show. > As noted by others, you probably want to be using UNION ALL not UNION, > but that's not the crux of the issue. OK. Mystery (sort of) solved. After you told me it works for you I had to assume the problem was somewhere else. And, indeed, it was, though it's not too obvious. The two attributes are actually not of tybe bigint, but of type "crm_object_id", which is created as follows: CREATE DOMAIN "public"."crm_object_id" AS bigint NULL; Everything started working perfectly after I modified the view like this: CREATE VIEW commonview AS SELECT foo_object_id::bigint as object_id, link_id::bigint, 'It is in foo' as loc FROM foo UNION SELECT bar_object_id::bigint as object_id, link_id::bigint, 'It is in bar' as loc FROM bar Not even modifying the select as this did not help: explain SELECT object_id FROM commonview WHERE link_id=1234567::crm_object_id; Is this a bug or feature? -- Michal T�borsk� CTO, Internet Mall, a.s. Internet Mall - obchody, kter� si obl�b�te From pgsql-performance-owner@postgresql.org Fri Nov 4 12:16:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CFBA9D6E2A for ; Fri, 4 Nov 2005 12:16:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53466-08 for ; Fri, 4 Nov 2005 16:16:50 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 31143D680C for ; Fri, 4 Nov 2005 12:16:49 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 11:16:45 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CE@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXhVYttMQihlaMCQRKTMrOizW6mCAAADVLgAACBfWA= From: "Merlin Moncure" To: "Tom Lane" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.041 required=5 tests=[AWL=0.041] X-Spam-Score: 0.041 X-Spam-Level: X-Archive-Number: 200511/82 X-Sequence-Number: 15339 ok, here is gprof output from newlines/no newlines=20 [newlines] % cumulative self self total =20 time seconds seconds calls s/call s/call name =20 19.03 0.67 0.67 1 0.67 3.20 MainLoop 17.61 1.29 0.62 500031 0.00 0.00 yylex 15.63 1.84 0.55 1500094 0.00 0.00 GetVariable 11.08 2.23 0.39 250018 0.00 0.00 SendQuery 4.26 2.38 0.15 750051 0.00 0.00 GetVariableBool 3.41 2.50 0.12 250024 0.00 0.00 SetVariable 2.56 2.59 0.09 250015 0.00 0.00 gets_fromFile 2.27 2.67 0.08 750044 0.00 0.00 yy_switch_to_buffer 2.27 2.75 0.08 500031 0.00 0.00 psql_scan 2.27 2.83 0.08 pg_strcasecmp 1.70 2.89 0.06 4250078 0.00 0.00 emit 1.70 2.95 0.06 500031 0.00 0.00 VariableEquals 1.70 3.01 0.06 250018 0.00 0.00 AcceptResult 1.42 3.06 0.05 250018 0.00 0.00 ResetCancelConn [no newlines] % cumulative self self total =20 time seconds seconds calls s/call s/call name =20 23.01 0.26 0.26 250019 0.00 0.00 yylex 19.47 0.48 0.22 250018 0.00 0.00 SendQuery 11.50 0.61 0.13 1000070 0.00 0.00 GetVariable 9.73 0.72 0.11 250042 0.00 0.00 pg_strdup 9.73 0.83 0.11 250024 0.00 0.00 SetVariable 6.19 0.90 0.07 500039 0.00 0.00 GetVariableBool 5.31 0.96 0.06 pg_strcasecmp 4.42 1.01 0.05 4250078 0.00 0.00 emit 2.65 1.04 0.03 1 0.03 1.01 MainLoop ok, mingw gprof is claiming MainLoop is a culprit here, along with general efficiency penalty otherwise in several things (twice many calls to yylex, 33%more to getvariable, etc). Just for fun I double checked string len of query input to SendQuery and everything is the right length. Same # calls to SendQuery, but 2.5 times call time in newlines case...anything jump out? =20 Merlin From pgsql-performance-owner@postgresql.org Fri Nov 4 12:33:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0EF24D95BA for ; Fri, 4 Nov 2005 12:33:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63831-06 for ; Fri, 4 Nov 2005 16:33:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 699C3D956C for ; Fri, 4 Nov 2005 12:33:52 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4GXqLg014317; Fri, 4 Nov 2005 11:33:52 -0500 (EST) To: "Merlin Moncure" Cc: pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CE@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CE@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 04 Nov 2005 11:16:45 -0500" Date: Fri, 04 Nov 2005 11:33:52 -0500 Message-ID: <14316.1131122032@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/83 X-Sequence-Number: 15340 "Merlin Moncure" writes: > ok, mingw gprof is claiming MainLoop is a culprit here, The only thing I can see that would be different for Windows is the SetConsoleCtrlHandler kernel call ... could that be expensive? Why do we have either sigsetjmp or setup_cancel_handler inside the per-line loop, rather than just before it? There is a lot of stuff in MainLoop that doesn't seem like it really needs to be done on every single line, particularly not the repeated fetching of psql variables that couldn't possibly change except inside HandleSlashCmds. But that all ought to be the same on Unix or Windows. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 13:53:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A2594D95D5 for ; Fri, 4 Nov 2005 13:53:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97114-03 for ; Fri, 4 Nov 2005 17:53:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 82042D95BA for ; Fri, 4 Nov 2005 13:53:08 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4Hr7lV015834; Fri, 4 Nov 2005 12:53:07 -0500 (EST) To: Michal Taborsky Cc: pgsql-performance@postgresql.org Subject: Re: Searching union views not using indices In-reply-to: <436B848F.5030402@mall.cz> References: <436B4836.7030300@mall.cz> <13815.1131118294@sss.pgh.pa.us> <436B848F.5030402@mall.cz> Comments: In-reply-to Michal Taborsky message dated "Fri, 04 Nov 2005 16:55:59 +0100" Date: Fri, 04 Nov 2005 12:53:07 -0500 Message-ID: <15833.1131126787@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/84 X-Sequence-Number: 15341 Michal Taborsky writes: > OK. Mystery (sort of) solved. After you told me it works for you I had > to assume the problem was somewhere else. And, indeed, it was, though > it's not too obvious. > The two attributes are actually not of tybe bigint, but of type > "crm_object_id", which is created as follows: > CREATE DOMAIN "public"."crm_object_id" AS > bigint NULL; Ah. The problem is that the UNION's output column is bigint, and the type discrepancy (bigint above, domain below) discourages the planner from pushing down the WHERE condition. There's a related complaint here: http://archives.postgresql.org/pgsql-bugs/2005-10/msg00227.php If we were to change things so that the result of the UNION were still the domain, not plain bigint, then your example would be optimized the way you want. I'm unsure about what other side-effects that would have though. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 13:56:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F214DD680B for ; Fri, 4 Nov 2005 13:56:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95567-06 for ; Fri, 4 Nov 2005 17:56:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 2292ED9135 for ; Fri, 4 Nov 2005 13:56:08 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 12:56:02 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXhVYttMQihlaMCQRKTMrOizW6mCAAADVLgAACBfWAAA+/0MA== From: "Merlin Moncure" To: "Tom Lane" Cc: , "Marc Cousin" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200511/85 X-Sequence-Number: 15342 Nailed it. problem is in mainloop.c -> setup_cancel_handler. Apparently you can have multiple handlers and windows keeps track of them all, even if they do the same thing. Keeping track of so many system handles would naturally slow the whole process down. Commenting that line times are flat as a pancake. I am thinking keeping track of a global flag would be appropriate. =20 Merlin From pgsql-performance-owner@postgresql.org Fri Nov 4 14:01:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1E84CD93EB; Fri, 4 Nov 2005 14:01:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02236-03; Fri, 4 Nov 2005 18:01:20 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 928E5D9385; Fri, 4 Nov 2005 14:01:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4I1KVM015927; Fri, 4 Nov 2005 13:01:20 -0500 (EST) To: "Merlin Moncure" Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D3@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D3@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 04 Nov 2005 12:56:02 -0500" Date: Fri, 04 Nov 2005 13:01:20 -0500 Message-ID: <15926.1131127280@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/86 X-Sequence-Number: 15343 "Merlin Moncure" writes: > Nailed it. > problem is in mainloop.c -> setup_cancel_handler. Apparently you can > have multiple handlers and windows keeps track of them all, even if they > do the same thing. Keeping track of so many system handles would > naturally slow the whole process down. Yipes. So we really want to do that only once. AFAICS it is appropriate to move the sigsetjmp and setup_cancel_handler calls in front of the per-line loop inside MainLoop --- can anyone see a reason not to? I'm inclined to treat this as an outright bug, not just a minor performance issue, because it implies that a sufficiently long psql script would probably crash a Windows machine. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 14:07:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A8350D680C; Fri, 4 Nov 2005 14:07:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06722-03; Fri, 4 Nov 2005 18:07:25 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 2727CD680B; Fri, 4 Nov 2005 14:07:24 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 13:07:24 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D5@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 Thread-Index: AcXhacQhRlD0sR6fT/6Q3scJ1LkFkwAAEtKg From: "Merlin Moncure" To: "Tom Lane" Cc: , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.04 required=5 tests=[AWL=0.040] X-Spam-Score: 0.04 X-Spam-Level: X-Archive-Number: 200511/87 X-Sequence-Number: 15344 > "Merlin Moncure" writes: > > Nailed it. >=20 > > problem is in mainloop.c -> setup_cancel_handler. Apparently you can > > have multiple handlers and windows keeps track of them all, even if they > > do the same thing. Keeping track of so many system handles would > > naturally slow the whole process down. >=20 > Yipes. So we really want to do that only once. >=20 > AFAICS it is appropriate to move the sigsetjmp and setup_cancel_handler > calls in front of the per-line loop inside MainLoop --- can anyone see > a reason not to? hm. mainloop is re-entrant, right? That means each \i would reset the handler...what is downside to keeping global flag? > I'm inclined to treat this as an outright bug, not just a minor certainly... > performance issue, because it implies that a sufficiently long psql > script would probably crash a Windows machine. actually, it's worse than that, it's more of a dos on the whole system, as windows will eventually stop granting handles, but there is a good chance of side effects on other applications. Merlin From pgsql-hackers-owner@postgresql.org Fri Nov 4 14:14:42 2005 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2DB1ED8ED6; Fri, 4 Nov 2005 14:14:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06797-03; Fri, 4 Nov 2005 18:14:37 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 7945CD680C; Fri, 4 Nov 2005 14:14:37 -0400 (AST) Received: from fetter.org (dsl092-188-065.sfo1.dsl.speakeasy.net [66.92.188.65]) by svr2.postgresql.org (Postfix) with ESMTP id D9E2DF131B; Fri, 4 Nov 2005 18:14:35 +0000 (GMT) Received: from fetter.org (localhost.localdomain [127.0.0.1]) by fetter.org (8.13.4/8.12.10) with ESMTP id jA4IEVIl005015; Fri, 4 Nov 2005 10:14:32 -0800 Received: (from shackle@localhost) by fetter.org (8.13.4/8.13.4/Submit) id jA4IEVt7005014; Fri, 4 Nov 2005 10:14:31 -0800 Date: Fri, 4 Nov 2005 10:14:31 -0800 From: David Fetter To: Tom Lane Cc: Merlin Moncure , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [PERFORM] insert performance for win32 Message-ID: <20051104181431.GA4017@fetter.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D3@Herge.rcsinc.local> <15926.1131127280@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15926.1131127280@sss.pgh.pa.us> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.05 required=5 tests=[AWL=0.050] X-Spam-Score: 0.05 X-Spam-Level: X-Archive-Number: 200511/162 X-Sequence-Number: 75444 On Fri, Nov 04, 2005 at 01:01:20PM -0500, Tom Lane wrote: > "Merlin Moncure" writes: > > Nailed it. > > > problem is in mainloop.c -> setup_cancel_handler. Apparently you > > can have multiple handlers and windows keeps track of them all, > > even if they do the same thing. Keeping track of so many system > > handles would naturally slow the whole process down. > > Yipes. So we really want to do that only once. > > AFAICS it is appropriate to move the sigsetjmp and > setup_cancel_handler calls in front of the per-line loop inside > MainLoop --- can anyone see a reason not to? > > I'm inclined to treat this as an outright bug, not just a minor > performance issue, because it implies that a sufficiently long psql > script would probably crash a Windows machine. Ouch. In light of this, are we *sure* what we've got a is a candidate for release? Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! From pgsql-performance-owner@postgresql.org Fri Nov 4 14:14:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D241D6E2A; Fri, 4 Nov 2005 14:14:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06398-07; Fri, 4 Nov 2005 18:14:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9F017D680B; Fri, 4 Nov 2005 14:14:36 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4IEa0U016057; Fri, 4 Nov 2005 13:14:36 -0500 (EST) To: "Merlin Moncure" Cc: pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org Subject: Re: insert performance for win32 In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D5@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D5@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Fri, 04 Nov 2005 13:07:24 -0500" Date: Fri, 04 Nov 2005 13:14:36 -0500 Message-ID: <16056.1131128076@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/88 X-Sequence-Number: 15345 "Merlin Moncure" writes: >> AFAICS it is appropriate to move the sigsetjmp and >> setup_cancel_handler >> calls in front of the per-line loop inside MainLoop --- can anyone see >> a reason not to? > hm. mainloop is re-entrant, right? That means each \i would reset the > handler...what is downside to keeping global flag? Ah, right, and in fact I'd missed the comment at line 325 pointing out that we're relying on the sigsetjmp to be re-executed every time through. That could be improved on, likely, but not right before a release. Does the flag need to be global? I'm thinking void setup_cancel_handler(void) { + static bool done = false; + + if (!done) SetConsoleCtrlHandler(consoleHandler, TRUE); + done = true; } regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 14:15:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 108AED91AD; Fri, 4 Nov 2005 14:15:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06251-07; Fri, 4 Nov 2005 18:15:44 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 1D290D9079; Fri, 4 Nov 2005 14:15:43 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jA4IFhX16474; Fri, 4 Nov 2005 13:15:43 -0500 (EST) From: Bruce Momjian Message-Id: <200511041815.jA4IFhX16474@candle.pha.pa.us> Subject: Re: insert performance for win32 In-Reply-To: <15926.1131127280@sss.pgh.pa.us> To: Tom Lane Date: Fri, 4 Nov 2005 13:15:43 -0500 (EST) Cc: Merlin Moncure , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200511/89 X-Sequence-Number: 15346 Tom Lane wrote: > "Merlin Moncure" writes: > > Nailed it. > > > problem is in mainloop.c -> setup_cancel_handler. Apparently you can > > have multiple handlers and windows keeps track of them all, even if they > > do the same thing. Keeping track of so many system handles would > > naturally slow the whole process down. > > Yipes. So we really want to do that only once. > > AFAICS it is appropriate to move the sigsetjmp and setup_cancel_handler > calls in front of the per-line loop inside MainLoop --- can anyone see > a reason not to? Nope. > I'm inclined to treat this as an outright bug, not just a minor > performance issue, because it implies that a sufficiently long psql > script would probably crash a Windows machine. Agreed. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Fri Nov 4 14:19:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 966C6D9079 for ; Fri, 4 Nov 2005 14:19:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07008-06 for ; Fri, 4 Nov 2005 18:19:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0B7DDD8ED6 for ; Fri, 4 Nov 2005 14:19:01 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA4IJ2R8016128; Fri, 4 Nov 2005 13:19:02 -0500 (EST) To: David Fetter Cc: Merlin Moncure , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [HACKERS] insert performance for win32 In-reply-to: <20051104181431.GA4017@fetter.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7D3@Herge.rcsinc.local> <15926.1131127280@sss.pgh.pa.us> <20051104181431.GA4017@fetter.org> Comments: In-reply-to David Fetter message dated "Fri, 04 Nov 2005 10:14:31 -0800" Date: Fri, 04 Nov 2005 13:19:02 -0500 Message-ID: <16127.1131128342@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/90 X-Sequence-Number: 15347 David Fetter writes: > On Fri, Nov 04, 2005 at 01:01:20PM -0500, Tom Lane wrote: >> I'm inclined to treat this as an outright bug, not just a minor >> performance issue, because it implies that a sufficiently long psql >> script would probably crash a Windows machine. > Ouch. In light of this, are we *sure* what we've got a is a candidate > for release? Sure. This problem exists in 8.0.* too. Pre-existing bugs don't disqualify an RC in my mind --- we fix them and move on, same as we would do at any other time. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 4 14:21:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6395BD9357; Fri, 4 Nov 2005 14:21:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12378-01; Fri, 4 Nov 2005 18:21:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id A0669D92B7; Fri, 4 Nov 2005 14:21:02 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id C0A058F299; Fri, 4 Nov 2005 19:21:01 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 19:21:02 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE92E7F6@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] insert performance for win32 thread-index: AcXhacQhRlD0sR6fT/6Q3scJ1LkFkwAAEtKgAACIR8A= From: "Magnus Hagander" To: "Merlin Moncure" , "Tom Lane" Cc: , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/91 X-Sequence-Number: 15348 > > I'm inclined to treat this as an outright bug, not just a minor > certainly... >=20 > > performance issue, because it implies that a sufficiently long psql=20 > > script would probably crash a Windows machine. >=20 > actually, it's worse than that, it's more of a dos on the=20 > whole system, as windows will eventually stop granting=20 > handles, but there is a good chance of side effects on other=20 > applications. Does it actually use up *handles* there? I don't see anything in the docs that says it should do that - and they usually do document when handles are used. You should be seeing a *huge* increase in system handles very fast if it does, right?=20 That said, I definitly agree with calling it a bug :-) //Magnus From pgsql-performance-owner@postgresql.org Fri Nov 4 14:21:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F6BAD9079; Fri, 4 Nov 2005 14:21:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06365-10; Fri, 4 Nov 2005 18:21:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id D6452D680C; Fri, 4 Nov 2005 14:21:08 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jA4IL7117478; Fri, 4 Nov 2005 13:21:07 -0500 (EST) From: Bruce Momjian Message-Id: <200511041821.jA4IL7117478@candle.pha.pa.us> Subject: Re: [HACKERS] insert performance for win32 In-Reply-To: <20051104181431.GA4017@fetter.org> To: David Fetter Date: Fri, 4 Nov 2005 13:21:07 -0500 (EST) Cc: Tom Lane , Merlin Moncure , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200511/92 X-Sequence-Number: 15349 David Fetter wrote: > On Fri, Nov 04, 2005 at 01:01:20PM -0500, Tom Lane wrote: > > "Merlin Moncure" writes: > > > Nailed it. > > > > > problem is in mainloop.c -> setup_cancel_handler. Apparently you > > > can have multiple handlers and windows keeps track of them all, > > > even if they do the same thing. Keeping track of so many system > > > handles would naturally slow the whole process down. > > > > Yipes. So we really want to do that only once. > > > > AFAICS it is appropriate to move the sigsetjmp and > > setup_cancel_handler calls in front of the per-line loop inside > > MainLoop --- can anyone see a reason not to? > > > > I'm inclined to treat this as an outright bug, not just a minor > > performance issue, because it implies that a sufficiently long psql > > script would probably crash a Windows machine. > > Ouch. In light of this, are we *sure* what we've got a is a candidate > for release? Good point. It is something we would fix in a minor release, so it doesn't seem worth doing another RC just for that. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Fri Nov 4 14:30:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F231D9749; Fri, 4 Nov 2005 14:30:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14425-05; Fri, 4 Nov 2005 18:30:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 9575AD95FE; Fri, 4 Nov 2005 14:30:33 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id E7E088F299; Fri, 4 Nov 2005 19:30:33 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: [HACKERS] insert performance for win32 Date: Fri, 4 Nov 2005 19:30:32 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE92E7F7@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [HACKERS] [PERFORM] insert performance for win32 thread-index: AcXhbIxUbQmkSlqFTk6zKlH2C3XLbQAARx6Q From: "Magnus Hagander" To: "Tom Lane" , "Merlin Moncure" Cc: , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/94 X-Sequence-Number: 15351 > >> AFAICS it is appropriate to move the sigsetjmp and=20 > >> setup_cancel_handler calls in front of the per-line loop inside=20 > >> MainLoop --- can anyone see a reason not to? >=20 > > hm. mainloop is re-entrant, right? That means each \i=20 > would reset the=20 > > handler...what is downside to keeping global flag? >=20 > Ah, right, and in fact I'd missed the comment at line 325=20 > pointing out that we're relying on the sigsetjmp to be=20 > re-executed every time through. That could be improved on,=20 > likely, but not right before a release. >=20 > Does the flag need to be global? I'm thinking >=20 > void > setup_cancel_handler(void) > { > + static bool done =3D false; > + > + if (!done) > SetConsoleCtrlHandler(consoleHandler, TRUE); > + done =3D true; > } >=20 Seems like a simple enough solution, don't see why it shouldn't work. As long as psql is single-threaded, which it is... (Actually, that code seems to re-set done=3Dtrue on every call which = seems unnecessary - but that might be optimised away, I guess) //Magnus From pgsql-performance-owner@postgresql.org Fri Nov 4 14:30:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2868AD8ED6 for ; Fri, 4 Nov 2005 14:30:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14425-04 for ; Fri, 4 Nov 2005 18:30:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 73186D8032 for ; Fri, 4 Nov 2005 14:30:24 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id C08E831059; Fri, 4 Nov 2005 19:30:24 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 13:30:34 -0500 Organization: Hub.Org Networking Services Lines: 31 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD7CE@Herge.rcsinc.local> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.558 required=5 tests=[AWL=0.558] X-Spam-Score: 0.558 X-Spam-Level: X-Archive-Number: 200511/93 X-Sequence-Number: 15350 ""Merlin Moncure"" wrote > ok, here is gprof output from newlines/no newlines > [newlines] > % cumulative self self total > time seconds seconds calls s/call s/call name > 19.03 0.67 0.67 1 0.67 3.20 MainLoop > 17.61 1.29 0.62 500031 0.00 0.00 yylex > 15.63 1.84 0.55 1500094 0.00 0.00 GetVariable > 11.08 2.23 0.39 250018 0.00 0.00 SendQuery > 4.26 2.38 0.15 750051 0.00 0.00 GetVariableBool > 3.41 2.50 0.12 250024 0.00 0.00 SetVariable > 2.56 2.59 0.09 250015 0.00 0.00 gets_fromFile > 2.27 2.67 0.08 750044 0.00 0.00 > yy_switch_to_buffer > 2.27 2.75 0.08 500031 0.00 0.00 psql_scan > 2.27 2.83 0.08 pg_strcasecmp > 1.70 2.89 0.06 4250078 0.00 0.00 emit > 1.70 2.95 0.06 500031 0.00 0.00 VariableEquals > 1.70 3.01 0.06 250018 0.00 0.00 AcceptResult > 1.42 3.06 0.05 250018 0.00 0.00 ResetCancelConn > Maybe I missed some threads .... do you think it is interesting to test the *absoulte* time difference of the same machine on Windows/Linux by using timeit.c? I wonder if windows is slower than Linux ... Regards, Qingqing From pgsql-performance-owner@postgresql.org Fri Nov 4 18:17:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AC61AD976D for ; Fri, 4 Nov 2005 18:17:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09154-08 for ; Fri, 4 Nov 2005 22:17:08 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 99E49D999D for ; Fri, 4 Nov 2005 18:17:09 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 12D4B31059; Fri, 4 Nov 2005 23:17:11 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: insert performance for win32 Date: Fri, 4 Nov 2005 17:17:21 -0500 Organization: Hub.Org Networking Services Lines: 21 Message-ID: References: <6BCB9D8A16AC4241919521715F4D8BCE92E7F1@algol.sollentuna.se> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.555 required=5 tests=[AWL=0.555] X-Spam-Score: 0.555 X-Spam-Level: X-Archive-Number: 200511/95 X-Sequence-Number: 15352 ""Magnus Hagander"" wrote >> >> I'd like to use the win32 provided recv(), send() functions >> instead of redirect them to pgwin32_recv()/pgwin32_send(), >> just like libpq does. If we do this, we will lose some >> functionalities, but I'd like to see the performance >> difference first. -- do you think that will be any difference? > > I doubt there will be much performance difference, as you hav eto hit > the kernel anyway (in the recv/send call). But that part is just a guess > :-) > On a separate line -- I verified Magnus's doubt -- revert pgwin32_recv() to recv() does not improve performance visiblly. Regards, Qingqing From pgsql-performance-owner@postgresql.org Sun Nov 6 05:02:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C9334DA6F4; Sun, 6 Nov 2005 05:02:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94330-02; Sun, 6 Nov 2005 09:02:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by svr1.postgresql.org (Postfix) with ESMTP id 47ACED79D9; Sun, 6 Nov 2005 05:02:34 -0400 (AST) Received: from 192.168.0.3 (unknown [84.12.200.148]) by smtp.nildram.co.uk (Postfix) with ESMTP id 03022252C69; Sun, 6 Nov 2005 09:02:34 +0000 (GMT) Subject: Re: [HACKERS] insert performance for win32 From: Simon Riggs To: Bruce Momjian Cc: David Fetter , Tom Lane , Merlin Moncure , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org In-Reply-To: <200511041821.jA4IL7117478@candle.pha.pa.us> References: <200511041821.jA4IL7117478@candle.pha.pa.us> Content-Type: text/plain Organization: 2nd Quadrant Date: Sun, 06 Nov 2005 09:00:05 +0000 Message-Id: <1131267605.8300.2055.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/96 X-Sequence-Number: 15353 On Fri, 2005-11-04 at 13:21 -0500, Bruce Momjian wrote: > David Fetter wrote: > > On Fri, Nov 04, 2005 at 01:01:20PM -0500, Tom Lane wrote: > > > I'm inclined to treat this as an outright bug, not just a minor > > > performance issue, because it implies that a sufficiently long psql > > > script would probably crash a Windows machine. > > > > Ouch. In light of this, are we *sure* what we've got a is a candidate > > for release? > > Good point. It is something we would fix in a minor release, so it > doesn't seem worth doing another RC just for that. Will this be documented in the release notes? If we put unimplemented features in TODO, where do we list things we regard as bugs? Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Nov 6 07:06:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 800BEDA7CE for ; Sun, 6 Nov 2005 07:06:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55107-05 for ; Sun, 6 Nov 2005 11:06:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id ADA25DA54A for ; Sun, 6 Nov 2005 07:06:55 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id C254131059; Sun, 6 Nov 2005 12:06:55 +0100 (MET) From: "PostgreSQL" X-Newsgroups: pgsql.performance Subject: 8.1 iss Date: Sun, 6 Nov 2005 03:55:18 -0600 Organization: Hub.Org Networking Services Lines: 43 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/97 X-Sequence-Number: 15354 SELECT v_barcode, count(v_barcode) FROM lead GROUP BY v_barcode HAVING count(*) > 1; This is a pretty good example of the place where 8.1 seems to be quite broken. I understand that this query will want to do a full table scan (even through v_barcode is indexed). And the table is largish, at 34 million rows. In the 8.0 world, this took around 4 minutes. With 8.1beta3, this has run for 30 minutes (as I began to write this) and is still going strong. And it behaves differently than I'd expect. Top shows the postmaster process running the query as using up 99.9 percent of one CPU, while the i/o wait time never gets above 3%. vmstat shows the "block out" (bo) number quite high, 15 to 20 thousand, which also surprises me. "block in" is from 0 to about 2500. iostat shows 15,000 to 20,000 blocks written every 5 seconds, while it shows 0 blocks read. There is no other significant process running on the box. (Apache is running but is not being used here a 3:00a.m. on Sunday). This is a dual Opteron box with 16 Gb memory and a 3ware SATA raid runing 64bit SUSE. Something seems badly wrong. As I post this, the query is approaching an hour of run time. I've listed an explain of the query and my non-default conf parameters below. Please advise on anything I should change or try, or on any information I can provide that could help diagnose this. GroupAggregate (cost=9899282.83..10285434.26 rows=223858 width=15) Filter: (count(*) > 1) -> Sort (cost=9899282.83..9994841.31 rows=38223392 width=15) Sort Key: v_barcode -> Seq Scan on lead (cost=0.00..1950947.92 rows=38223392 width=15) shared_buffers = 50000 work_mem = 16384 maintenance_work_mem = 16384 max_fsm_pages = 100000 max_fsm_relations = 5000 wal_buffers = 32 checkpoint_segments = 32 effective_cache_size = 50000 default_statistics_target = 50 From pgsql-performance-owner@postgresql.org Sun Nov 6 09:31:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 782CAD6876 for ; Sun, 6 Nov 2005 09:31:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05349-05 for ; Sun, 6 Nov 2005 13:30:59 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id E9B34D6862 for ; Sun, 6 Nov 2005 09:30:59 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Nov 2005 14:31:02 +0100 Subject: Performance PG 8.0 on dual opteron / 4GB / 3ware Raid5 / Debian?? From: Joost Kraaijeveld To: Pgsql-Performance Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sun, 06 Nov 2005 14:30:54 +0100 Message-Id: <1131283854.15471.4.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.06 required=5 tests=[AWL=0.059, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.06 X-Spam-Level: X-Archive-Number: 200511/98 X-Sequence-Number: 15355 Hi, I am experiencing very long update queries and I want to know if it reasonable to expect them to perform better. The query below is running for more than 1.5 hours (5500 seconds) now, while the rest of the system does nothing (I don't even type or move a mouse...). - Is that to be expected? - Is 180-200 tps with ~ 9000 KB (see output iostat below) not low, given the fact that fsync is off? (Note: with bonnie++ I get write performance > 50 MB/sec and read performace > 70 MB/sec with > 2000 read/write ops /sec? - Does anyone else have any experience with the 3Ware RAID controller (which is my suspect)? - Any good idea how to determine the real botleneck if this is not the performance I can expect? My hard- and software: - PostgreSQL 8.0.3 - Debian 3.1 (Sarge) AMD64 - Dual Opteron - 4GB RAM - 3ware Raid5 with 5 disks Pieces of my postgresql.conf (All other is default): shared_buffers = 7500 work_mem = 260096 fsync=false effective_cache_size = 32768 The query with explain (amount and orderbedrag_valuta are float8, ordernummer and ordernumber int4): explain update prototype.orders set amount = odbc.orders.orderbedrag_valuta from odbc.orders where ordernumber = odbc.orders.ordernummer; QUERY PLAN ----------------------------------------------------------------------------- Hash Join (cost=50994.74..230038.17 rows=1104379 width=466) Hash Cond: ("outer".ordernumber = "inner".ordernummer) -> Seq Scan on orders (cost=0.00..105360.68 rows=3991868 width=455) -> Hash (cost=48233.79..48233.79 rows=1104379 width=15) -> Seq Scan on orders (cost=0.00..48233.79 rows=1104379 width=15) Sample output from iostat during query (about avarage): Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn hdc 0.00 0.00 0.00 0 0 sda 0.00 0.00 0.00 0 0 sdb 187.13 23.76 8764.36 24 8852 -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Sun Nov 6 12:31:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EAFF4D8ED6 for ; Sun, 6 Nov 2005 12:31:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65729-10 for ; Sun, 6 Nov 2005 16:31:20 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 454B6D79D9 for ; Sun, 6 Nov 2005 12:31:19 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA6GVI2Q025137; Sun, 6 Nov 2005 11:31:18 -0500 (EST) To: "PostgreSQL" Cc: pgsql-performance@postgresql.org Subject: Re: 8.1 iss In-reply-to: References: Comments: In-reply-to "PostgreSQL" message dated "Sun, 06 Nov 2005 03:55:18 -0600" Date: Sun, 06 Nov 2005 11:31:18 -0500 Message-ID: <25136.1131294678@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/99 X-Sequence-Number: 15356 "PostgreSQL" writes: > This is a pretty good example of the place where 8.1 seems to be quite > broken. That's a bit of a large claim on the basis of one data point. Did you remember to re-ANALYZE after loading the table into the new database? regards, tom lane From pgsql-hackers-owner@postgresql.org Sun Nov 6 13:10:32 2005 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3CB4DDACFE; Sun, 6 Nov 2005 13:10:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86733-05; Sun, 6 Nov 2005 17:10:25 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id 0BECADACE5; Sun, 6 Nov 2005 13:10:24 -0400 (AST) Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com [24.211.165.134]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id jA6GQHE02487; Sun, 6 Nov 2005 10:26:18 -0600 Message-ID: <436E38EE.2000708@dunslane.net> Date: Sun, 06 Nov 2005 12:10:06 -0500 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Simon Riggs Cc: Bruce Momjian , David Fetter , Tom Lane , Merlin Moncure , pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [PERFORM] insert performance for win32 References: <200511041821.jA4IL7117478@candle.pha.pa.us> <1131267605.8300.2055.camel@localhost.localdomain> In-Reply-To: <1131267605.8300.2055.camel@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.034 required=5 tests=[AWL=0.034] X-Spam-Score: 0.034 X-Spam-Level: X-Archive-Number: 200511/236 X-Sequence-Number: 75518 Simon Riggs wrote: >On Fri, 2005-11-04 at 13:21 -0500, Bruce Momjian wrote: > > >>David Fetter wrote: >> >> >>>On Fri, Nov 04, 2005 at 01:01:20PM -0500, Tom Lane wrote: >>> >>> >>>>I'm inclined to treat this as an outright bug, not just a minor >>>>performance issue, because it implies that a sufficiently long psql >>>>script would probably crash a Windows machine. >>>> >>>> >>>Ouch. In light of this, are we *sure* what we've got a is a candidate >>>for release? >>> >>> >>Good point. It is something we would fix in a minor release, so it >>doesn't seem worth doing another RC just for that. >> >> > >Will this be documented in the release notes? If we put unimplemented >features in TODO, where do we list things we regard as bugs? > > > > No need, I think. It was patched 2 days ago. cheers andrew From pgsql-performance-owner@postgresql.org Sun Nov 6 13:17:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 07467DAB28 for ; Sun, 6 Nov 2005 13:17:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87808-07 for ; Sun, 6 Nov 2005 17:17:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 80F9BDAB21 for ; Sun, 6 Nov 2005 13:17:24 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA6HHK9L025426; Sun, 6 Nov 2005 12:17:22 -0500 (EST) To: Joost Kraaijeveld Cc: Pgsql-Performance Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware Raid5 / Debian?? In-reply-to: <1131283854.15471.4.camel@Panoramix> References: <1131283854.15471.4.camel@Panoramix> Comments: In-reply-to Joost Kraaijeveld message dated "Sun, 06 Nov 2005 14:30:54 +0100" Date: Sun, 06 Nov 2005 12:17:20 -0500 Message-ID: <25425.1131297440@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/100 X-Sequence-Number: 15357 Joost Kraaijeveld writes: > I am experiencing very long update queries and I want to know if it > reasonable to expect them to perform better. Does that table have any triggers that would fire on the update? regards, tom lane From pgsql-performance-owner@postgresql.org Sun Nov 6 14:09:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BA613DAA7B for ; Sun, 6 Nov 2005 14:09:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10794-06 for ; Sun, 6 Nov 2005 18:09:07 +0000 (GMT) X-Greylist: delayed 00:06:40.116157 by SQLgrey- Received: from pop7-1.us4.outblaze.com (pop7-1.us4.outblaze.com [208.36.123.44]) by svr1.postgresql.org (Postfix) with SMTP id D8F3ED6862 for ; Sun, 6 Nov 2005 14:09:06 -0400 (AST) Received: (qmail 7209 invoked from network); 6 Nov 2005 18:02:26 -0000 Received: from unknown (HELO ?217.122.95.222?) (iddekingej@lycos.com@217.122.95.222) by pop7-1.us4.outblaze.com with SMTP; 6 Nov 2005 18:02:25 -0000 Message-ID: <436E453F.3060606@lycos.com> Date: Sun, 06 Nov 2005 19:02:39 +0100 From: Jeroen van Iddekinge User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Performance problem with pg8.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.319 required=5 tests=[DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 2.319 X-Spam-Level: ** X-Archive-Number: 200511/101 X-Sequence-Number: 15358 Hello, I have some strange performance problems with quering a table.It has 5282864, rows and contains the following columns : id ,no,id_words,position,senpos and sentence all are integer non null. Index on : * no * no,id_words * id_words * senpos, sentence, "no") * d=primary key "select count(1) from words_in_text" takes 9 seconds to compleet. The query 'select * from words_in_text' takes a verry long time to return the first record (more that 2 minutes) why? Also the following query behaves strange. select * from words_in_text where no <100 order by no; explain shows that pg is using sequence scan. When i turn of sequence scan, index scan is used and is faster. I have a 'Explain verbose analyze' of this query is at the end of the mail. The number of estimated rows is wrong, so I did 'set statistics 1000' on column no. After this the estimated number of rows was ok, but pg still was using seq scan. Can anyone explain why pg is using sequence and not index scan? The computer is a dell desktop with 768Mb ram. Database on the same machine. I have analyze and vacuum all tables. Database is 8.0. Thanks Jeroen With enable_seqscan=true {SORT :startup_cost 138632.19 :total_cost 139441.07 :plan_rows 323552 :plan_width 24 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 :resname id :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 1 :resjunk false } :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 23 :restypmod -1 :resname no :ressortgroupref 1 :resorigtbl 1677903 :resorigcol 2 :resjunk false } :expr {VAR :varno 1 :varattno 2 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } } {TARGETENTRY :resdom {RESDOM :resno 3 :restype 23 :restypmod -1 :resname id_words :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 3 :resjunk false } :expr {VAR :varno 1 :varattno 3 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 3 } } {TARGETENTRY :resdom {RESDOM :resno 4 :restype 23 :restypmod -1 :resname position :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 4 :resjunk false } :expr {VAR :varno 1 :varattno 4 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 4 } } {TARGETENTRY :resdom {RESDOM :resno 5 :restype 23 :restypmod -1 :resname senpos :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 5 :resjunk false } :expr {VAR :varno 1 :varattno 5 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 5 } } {TARGETENTRY :resdom {RESDOM :resno 6 :restype 23 :restypmod -1 :resname sentence :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 6 :resjunk false } :expr {VAR :varno 1 :varattno 6 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 6 } } ) :qual <> :lefttree {SEQSCAN :startup_cost 0.00 :total_cost 104880.80 :plan_rows 323552 :plan_width 24 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 :resname id :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 1 :resjunk false } :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 23 :restypmod -1 :resname no :ressortgroupref 1 :resorigtbl 1677903 :resorigcol 2 :resjunk false } :expr {VAR :varno 1 :varattno 2 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } } {TARGETENTRY :resdom {RESDOM :resno 3 :restype 23 :restypmod -1 :resname id_words :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 3 :resjunk false } :expr {VAR :varno 1 :varattno 3 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 3 } } {TARGETENTRY :resdom {RESDOM :resno 4 :restype 23 :restypmod -1 :resname position :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 4 :resjunk false } :expr {VAR :varno 1 :varattno 4 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 4 } } {TARGETENTRY :resdom {RESDOM :resno 5 :restype 23 :restypmod -1 :resname senpos :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 5 :resjunk false } :expr {VAR :varno 1 :varattno 5 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 5 } } {TARGETENTRY :resdom {RESDOM :resno 6 :restype 23 :restypmod -1 :resname sentence :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 6 :resjunk false } :expr {VAR :varno 1 :varattno 6 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 6 } } ) :qual ( {OPEXPR :opno 97 :opfuncid 66 :opresulttype 16 :opretset false :args ( {VAR :varno 1 :varattno 2 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ 100 0 0 0 ] } ) } ) :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :scanrelid 1 } :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :numCols 1 :sortColIdx 2 :sortOperators 97 } Sort (cost=138632.19..139441.07 rows=323552 width=24) (actual time=7677.614..8479.980 rows=194141 loops=1) Sort Key: "no" -> Seq Scan on words_in_text (cost=0.00..104880.80 rows=323552 width=24) (actual time=187.118..5761.991 rows=194141 lo ops=1) Filter: ("no" < 100) Total runtime: 9225.382 ms With enable_seqscan=false {INDEXSCAN :startup_cost 0.00 :total_cost 606313.33 :plan_rows 323552 :plan_width 24 :targetlist ( {TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 :resname id :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 1 :resjunk false } :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1 } } {TARGETENTRY :resdom {RESDOM :resno 2 :restype 23 :restypmod -1 :resname no :ressortgroupref 1 :resorigtbl 1677903 :resorigcol 2 :resjunk false } :expr {VAR :varno 1 :varattno 2 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } } {TARGETENTRY :resdom {RESDOM :resno 3 :restype 23 :restypmod -1 :resname id_words :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 3 :resjunk false } :expr {VAR :varno 1 :varattno 3 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 3 } } {TARGETENTRY :resdom {RESDOM :resno 4 :restype 23 :restypmod -1 :resname position :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 4 :resjunk false } :expr {VAR :varno 1 :varattno 4 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 4 } } {TARGETENTRY :resdom {RESDOM :resno 5 :restype 23 :restypmod -1 :resname senpos :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 5 :resjunk false } :expr {VAR :varno 1 :varattno 5 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 5 } } {TARGETENTRY :resdom {RESDOM :resno 6 :restype 23 :restypmod -1 :resname sentence :ressortgroupref 0 :resorigtbl 1677903 :resorigcol 6 :resjunk false } :expr {VAR :varno 1 :varattno 6 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 6 } } ) :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :nParamExec 0 :scanrelid 1 :indxid (o 1677911) :indxqual (( {OPEXPR :opno 97 :opfuncid 66 :opresulttype 16 :opretset false :args ( {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ 100 0 0 0 ] } ) } )) :indxqualorig (( {OPEXPR :opno 97 :opfuncid 66 :opresulttype 16 :opretset false :args ( {VAR :varno 1 :varattno 2 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2 } {CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ 100 0 0 0 ] } ) } )) :indxstrategy ((i 1)) :indxsubtype ((o 0)) :indxlossy ((i 0)) :indxorderdir 1 } Index Scan using ind_words_in_text_1 on words_in_text (cost=0.00..606313.33 rows=323552 width=24) (actual time=0.208..100 0.085 rows=194141 loops=1) Index Cond: ("no" < 100) Total runtime: 1733.601 ms From pgsql-performance-owner@postgresql.org Sun Nov 6 15:24:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD624D79D9 for ; Sun, 6 Nov 2005 15:24:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30240-08 for ; Sun, 6 Nov 2005 19:24:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 8B573D6862 for ; Sun, 6 Nov 2005 15:24:05 -0400 (AST) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr2.postgresql.org (Postfix) with ESMTP id E0997F0B7D for ; Sun, 6 Nov 2005 19:24:05 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EYq7U-0003HY-00; Sun, 06 Nov 2005 14:24:00 -0500 To: "PostgreSQL" Cc: pgsql-performance@postgresql.org Subject: Re: 8.1 iss References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 06 Nov 2005 14:24:00 -0500 Message-ID: <87pspdfulr.fsf@stark.xeocode.com> Lines: 36 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/102 X-Sequence-Number: 15359 "PostgreSQL" writes: ... > As I post this, the query is approaching an hour of run time. I've listed > an explain of the query and my non-default conf parameters below. Please > advise on anything I should change or try, or on any information I can > provide that could help diagnose this. > > > GroupAggregate (cost=9899282.83..10285434.26 rows=223858 width=15) > Filter: (count(*) > 1) > -> Sort (cost=9899282.83..9994841.31 rows=38223392 width=15) > Sort Key: v_barcode > -> Seq Scan on lead (cost=0.00..1950947.92 rows=38223392 width=15) > > shared_buffers = 50000 > work_mem = 16384 ... It sounds to me like it's doing a large on-disk sort. Increasing work_mem should improve the efficiency. If you increase it enough it might even be able to do it in memory, but probably not. The shared_buffers is excessive but if you're using the default 8kB block sizes then it 400MB of shared pages on a 16GB machine ought not cause problems. It might still be worth trying lowering this to 10,000 or so. Is this a custom build from postgresql.org sources? RPM build? Or is it a BSD ports or Gentoo build with unusual options? Perhaps posting actual vmstat and iostat output might help if someone catches something you didn't see? -- greg From pgsql-performance-owner@postgresql.org Sun Nov 6 15:33:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EE00DDAE3B for ; Sun, 6 Nov 2005 15:33:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32601-08 for ; Sun, 6 Nov 2005 19:33:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id E5DBEDADB1 for ; Sun, 6 Nov 2005 15:33:53 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Nov 2005 20:33:53 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Tom Lane Cc: Pgsql-Performance In-Reply-To: <25425.1131297440@sss.pgh.pa.us> References: <1131283854.15471.4.camel@Panoramix> <25425.1131297440@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sun, 06 Nov 2005 20:33:53 +0100 Message-Id: <1131305633.5882.17.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.058 required=5 tests=[AWL=0.057, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.058 X-Spam-Level: X-Archive-Number: 200511/103 X-Sequence-Number: 15360 On Sun, 2005-11-06 at 12:17 -0500, Tom Lane wrote: > Does that table have any triggers that would fire on the update? Alas, no trigger, constrainst, foreign keys, indixes (have I forgotten something?) All queries are slow. E.g (after vacuum): select objectid from prototype.orders Explain analyse (with PgAdmin): Seq Scan on orders (cost=0.00..58211.79 rows=1104379 width=40) (actual time=441.971..3252.698 rows=1104379 loops=1) Total runtime: 5049.467 ms Actual execution time: 82163 MS (without getting the data) Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Sun Nov 6 19:25:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AB6F6D941B for ; Sun, 6 Nov 2005 19:25:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48631-03 for ; Sun, 6 Nov 2005 23:25:02 +0000 (GMT) X-Greylist: delayed 03:03:45.429703 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 2D130D91EB for ; Sun, 6 Nov 2005 19:25:03 -0400 (AST) Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr2.postgresql.org (Postfix) with ESMTP id 0B935F0B38 for ; Sun, 6 Nov 2005 20:21:17 +0000 (GMT) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Sun, 06 Nov 2005 15:19:04 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 6 Nov 2005 15:19:03 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: 8.1 iss Date: Sun, 6 Nov 2005 15:19:02 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE11D27@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] 8.1 iss Thread-Index: AcXjCFbdANN2flAsRBmN15Nr+kOPJAABvzyG From: "Luke Lonergan" To: gsstark@mit.edu, martin@portant.com Cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 06 Nov 2005 20:19:03.0379 (UTC) FILETIME=[54A12A30:01C5E30F] X-WSS-ID: 6F70BAB821G4192815-07-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/105 X-Sequence-Number: 15362 R3JlZywNCg0KSW5jcmVhc2luZyBtZW1vcnkgYWN0dWFsbHkgc2xvd3MgZG93biB0aGUgY3VycmVu dCBzb3J0IHBlcmZvcm1hbmNlLg0KDQpXZSdyZSB3b3JraW5nIG9uIGEgZml4IGZvciB0aGlzIG5v dyBpbiBiaXpncmVzLg0KDQpMdWtlDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KU2VudCBm cm9tIG15IEJsYWNrQmVycnkgV2lyZWxlc3MgRGV2aWNlDQoNCg0KLS0tLS1PcmlnaW5hbCBNZXNz YWdlLS0tLS0NCkZyb206IHBnc3FsLXBlcmZvcm1hbmNlLW93bmVyQHBvc3RncmVzcWwub3JnIDxw Z3NxbC1wZXJmb3JtYW5jZS1vd25lckBwb3N0Z3Jlc3FsLm9yZz4NClRvOiBQb3N0Z3JlU1FMIDxt YXJ0aW5AcG9ydGFudC5jb20+DQpDQzogcGdzcWwtcGVyZm9ybWFuY2VAcG9zdGdyZXNxbC5vcmcg PHBnc3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnPg0KU2VudDogU3VuIE5vdiAwNiAxNDoy NDowMCAyMDA1DQpTdWJqZWN0OiBSZTogW1BFUkZPUk1dIDguMSBpc3MNCg0KDQoiUG9zdGdyZVNR TCIgPG1hcnRpbkBwb3J0YW50LmNvbT4gd3JpdGVzOg0KDQouLi4NCj4gQXMgSSBwb3N0IHRoaXMs IHRoZSBxdWVyeSBpcyBhcHByb2FjaGluZyBhbiBob3VyIG9mIHJ1biB0aW1lLiAgSSd2ZSBsaXN0 ZWQgDQo+IGFuIGV4cGxhaW4gb2YgdGhlIHF1ZXJ5IGFuZCBteSBub24tZGVmYXVsdCBjb25mIHBh cmFtZXRlcnMgYmVsb3cuICBQbGVhc2UgDQo+IGFkdmlzZSBvbiBhbnl0aGluZyBJIHNob3VsZCBj aGFuZ2Ugb3IgdHJ5LCBvciBvbiBhbnkgaW5mb3JtYXRpb24gSSBjYW4gDQo+IHByb3ZpZGUgdGhh dCBjb3VsZCBoZWxwIGRpYWdub3NlIHRoaXMuDQo+IA0KPiANCj4gR3JvdXBBZ2dyZWdhdGUgIChj b3N0PTk4OTkyODIuODMuLjEwMjg1NDM0LjI2IHJvd3M9MjIzODU4IHdpZHRoPTE1KQ0KPiAgIEZp bHRlcjogKGNvdW50KCopID4gMSkNCj4gICAtPiAgU29ydCAgKGNvc3Q9OTg5OTI4Mi44My4uOTk5 NDg0MS4zMSByb3dzPTM4MjIzMzkyIHdpZHRoPTE1KQ0KPiAgICAgICAgIFNvcnQgS2V5OiB2X2Jh cmNvZGUNCj4gICAgICAgICAtPiAgU2VxIFNjYW4gb24gbGVhZCAgKGNvc3Q9MC4wMC4uMTk1MDk0 Ny45MiByb3dzPTM4MjIzMzkyIHdpZHRoPTE1KQ0KPiANCj4gc2hhcmVkX2J1ZmZlcnMgPSA1MDAw MA0KPiB3b3JrX21lbSA9IDE2Mzg0DQouLi4NCg0KSXQgc291bmRzIHRvIG1lIGxpa2UgaXQncyBk b2luZyBhIGxhcmdlIG9uLWRpc2sgc29ydC4gSW5jcmVhc2luZyB3b3JrX21lbQ0Kc2hvdWxkIGlt cHJvdmUgdGhlIGVmZmljaWVuY3kuIElmIHlvdSBpbmNyZWFzZSBpdCBlbm91Z2ggaXQgbWlnaHQg ZXZlbiBiZSBhYmxlDQp0byBkbyBpdCBpbiBtZW1vcnksIGJ1dCBwcm9iYWJseSBub3QuDQoNClRo ZSBzaGFyZWRfYnVmZmVycyBpcyBleGNlc3NpdmUgYnV0IGlmIHlvdSdyZSB1c2luZyB0aGUgZGVm YXVsdCA4a0IgYmxvY2sNCnNpemVzIHRoZW4gaXQgNDAwTUIgb2Ygc2hhcmVkIHBhZ2VzIG9uIGEg MTZHQiBtYWNoaW5lIG91Z2h0IG5vdCBjYXVzZQ0KcHJvYmxlbXMuIEl0IG1pZ2h0IHN0aWxsIGJl IHdvcnRoIHRyeWluZyBsb3dlcmluZyB0aGlzIHRvIDEwLDAwMCBvciBzby4NCg0KSXMgdGhpcyBh IGN1c3RvbSBidWlsZCBmcm9tIHBvc3RncmVzcWwub3JnIHNvdXJjZXM/IFJQTSBidWlsZD8gT3Ig aXMgaXQgYSBCU0QNCnBvcnRzIG9yIEdlbnRvbyBidWlsZCB3aXRoIHVudXN1YWwgb3B0aW9ucz8N Cg0KUGVyaGFwcyBwb3N0aW5nIGFjdHVhbCB2bXN0YXQgYW5kIGlvc3RhdCBvdXRwdXQgbWlnaHQg aGVscCBpZiBzb21lb25lIGNhdGNoZXMNCnNvbWV0aGluZyB5b3UgZGlkbid0IHNlZT8NCg0KLS0g DQpncmVnDQoNCg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZiBicm9hZGNhc3Qp LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpUSVAgMjogRG9uJ3QgJ2tpbGwgLTknIHRoZSBw b3N0bWFzdGVyDQoNCg== From pgsql-performance-owner@postgresql.org Sun Nov 6 16:26:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A736EDAE1D for ; Sun, 6 Nov 2005 16:26:16 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64127-06 for ; Sun, 6 Nov 2005 20:26:13 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7ECC7DAD6D for ; Sun, 6 Nov 2005 16:26:13 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA6KQDt2002504; Sun, 6 Nov 2005 15:26:13 -0500 (EST) To: Joost Kraaijeveld Cc: Pgsql-Performance Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware In-reply-to: <1131305633.5882.17.camel@Panoramix> References: <1131283854.15471.4.camel@Panoramix> <25425.1131297440@sss.pgh.pa.us> <1131305633.5882.17.camel@Panoramix> Comments: In-reply-to Joost Kraaijeveld message dated "Sun, 06 Nov 2005 20:33:53 +0100" Date: Sun, 06 Nov 2005 15:26:13 -0500 Message-ID: <2503.1131308773@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/104 X-Sequence-Number: 15361 Joost Kraaijeveld writes: > Explain analyse (with PgAdmin): > ... > Total runtime: 5049.467 ms > Actual execution time: 82163 MS (without getting the data) I'm confused --- where's the 82sec figure coming from, exactly? We've heard reports of performance issues in PgAdmin with large result sets ... if you do the same query in psql, what happens? regards, tom lane From pgsql-performance-owner@postgresql.org Mon Nov 7 00:26:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC8D3D926C for ; Mon, 7 Nov 2005 00:26:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67763-04 for ; Mon, 7 Nov 2005 04:26:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id ACF71D79D9 for ; Mon, 7 Nov 2005 00:26:10 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 07 Nov 2005 05:26:07 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Tom Lane Cc: Pgsql-Performance In-Reply-To: <2503.1131308773@sss.pgh.pa.us> References: <1131283854.15471.4.camel@Panoramix> <25425.1131297440@sss.pgh.pa.us> <1131305633.5882.17.camel@Panoramix> <2503.1131308773@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 07 Nov 2005 05:25:59 +0100 Message-Id: <1131337559.5877.7.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.058 required=5 tests=[AWL=0.057, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.058 X-Spam-Level: X-Archive-Number: 200511/106 X-Sequence-Number: 15363 Hi Tom, On Sun, 2005-11-06 at 15:26 -0500, Tom Lane wrote: > I'm confused --- where's the 82sec figure coming from, exactly? >From actually executing the query. >From PgAdmin: -- Executing query: select objectid from prototype.orders Total query runtime: 78918 ms. Data retrieval runtime: 188822 ms. 1104379 rows retrieved. > We've heard reports of performance issues in PgAdmin with large > result sets ... if you do the same query in psql, what happens? jkr@Panoramix:~/postgresql$ time psql muntdev -c "select objectid from prototype.orders" > output.txt real 0m5.554s user 0m1.121s sys 0m0.470s Now *I* am confused. What does PgAdmin do more than giving the query to the database? (BTW: I have repeated both measurements and the numbers above were all from the last measurement I did and are about average) -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Mon Nov 7 00:37:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C4F38D9DC1 for ; Mon, 7 Nov 2005 00:37:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72149-07 for ; Mon, 7 Nov 2005 04:37:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id A79DAD9D6D for ; Mon, 7 Nov 2005 00:37:39 -0400 (AST) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr2.postgresql.org (Postfix) with ESMTP id B6E43F0D32 for ; Mon, 7 Nov 2005 04:37:38 +0000 (GMT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id A78B425087; Mon, 7 Nov 2005 12:37:32 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 0A4E924FFA; Mon, 7 Nov 2005 12:37:26 +0800 (WST) Message-ID: <436EDA0B.8030604@familyhealth.com.au> Date: Mon, 07 Nov 2005 12:37:31 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: Tom Lane , Pgsql-Performance Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware References: <1131283854.15471.4.camel@Panoramix> <25425.1131297440@sss.pgh.pa.us> <1131305633.5882.17.camel@Panoramix> <2503.1131308773@sss.pgh.pa.us> <1131337559.5877.7.camel@Panoramix> In-Reply-To: <1131337559.5877.7.camel@Panoramix> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.035 required=5 tests=[AWL=0.035] X-Spam-Score: 0.035 X-Spam-Level: X-Archive-Number: 200511/107 X-Sequence-Number: 15364 > Now *I* am confused. What does PgAdmin do more than giving the query to > the database? It builds it into the data grid GUI object. Chris From pgsql-performance-owner@postgresql.org Mon Nov 7 01:05:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8A12AD9BE9 for ; Mon, 7 Nov 2005 01:05:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84906-01 for ; Mon, 7 Nov 2005 05:05:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 6EA9BD8A87 for ; Mon, 7 Nov 2005 01:05:03 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 07 Nov 2005 06:05:02 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Christopher Kings-Lynne Cc: Tom Lane , Pgsql-Performance In-Reply-To: <436EDA0B.8030604@familyhealth.com.au> References: <1131283854.15471.4.camel@Panoramix> <25425.1131297440@sss.pgh.pa.us> <1131305633.5882.17.camel@Panoramix> <2503.1131308773@sss.pgh.pa.us> <1131337559.5877.7.camel@Panoramix> <436EDA0B.8030604@familyhealth.com.au> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 07 Nov 2005 06:04:57 +0100 Message-Id: <1131339897.5877.12.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.057 required=5 tests=[AWL=0.056, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.057 X-Spam-Level: X-Archive-Number: 200511/108 X-Sequence-Number: 15365 On Mon, 2005-11-07 at 12:37 +0800, Christopher Kings-Lynne wrote: > > Now *I* am confused. What does PgAdmin do more than giving the query to > > the database? > > It builds it into the data grid GUI object. Is that not the difference between the total query runtime and the data retrieval runtime (see below)? -- Executing query: select objectid from prototype.orders Total query runtime: 78918 ms. Data retrieval runtime: 188822 ms. 1104379 rows retrieved. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Mon Nov 7 02:05:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5DE91D9D35 for ; Mon, 7 Nov 2005 02:05:25 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00654-08 for ; Mon, 7 Nov 2005 06:05:23 +0000 (GMT) X-Greylist: delayed 00:20:55.775201 by SQLgrey- Received: from zigo.dhs.org (ua-83-227-204-174.cust.bredbandsbolaget.se [83.227.204.174]) by svr1.postgresql.org (Postfix) with ESMTP id 5DC4AD9C94 for ; Mon, 7 Nov 2005 02:05:22 -0400 (AST) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id 34D588467; Mon, 7 Nov 2005 06:44:23 +0100 (CET) Date: Mon, 7 Nov 2005 06:44:23 +0100 (CET) From: Dennis Bjorklund To: PostgreSQL Cc: pgsql-performance@postgresql.org Subject: Re: 8.1 iss In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.352 required=5 tests=[AWL=-0.127, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.352 X-Spam-Level: X-Archive-Number: 200511/111 X-Sequence-Number: 15368 On Sun, 6 Nov 2005, PostgreSQL wrote: > SELECT v_barcode, count(v_barcode) FROM lead GROUP BY v_barcode HAVING > count(*) > 1; > > This is a dual Opteron box with 16 Gb memory and a 3ware SATA raid > runing 64bit SUSE. Something seems badly wrong. > > GroupAggregate (cost=9899282.83..10285434.26 rows=223858 width=15) > Filter: (count(*) > 1) > -> Sort (cost=9899282.83..9994841.31 rows=38223392 width=15) > Sort Key: v_barcode > -> Seq Scan on lead (cost=0.00..1950947.92 rows=38223392 width=15) What do the plan look like in 8.0? Since it's so much faster I assume you get a different plan. > shared_buffers = 50000 > work_mem = 16384 > maintenance_work_mem = 16384 > max_fsm_pages = 100000 > max_fsm_relations = 5000 > wal_buffers = 32 > checkpoint_segments = 32 > effective_cache_size = 50000 > default_statistics_target = 50 The effective_cache_size is way too low, only 390M and you have a machine with 16G. Try bumping it to 1000000 (which means almost 8G, how nice it would be to be able to write 8G instead...). It could be set even higher but it's hard for me to know what else your memory is used for. I don't know if this setting will affect this very query, but it should have a positive effect on a lot of queries. work_mem also seems low, but it's hard to suggest a good value on it without knowing more about how your database is used. -- /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Mon Nov 7 01:47:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BC1CFD7028 for ; Mon, 7 Nov 2005 01:47:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95138-07 for ; Mon, 7 Nov 2005 05:47:02 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 6C86CD682C for ; Mon, 7 Nov 2005 01:47:01 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 07 Nov 2005 06:47:00 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Christopher Kings-Lynne Cc: Tom Lane , Pgsql-Performance In-Reply-To: <436EDA0B.8030604@familyhealth.com.au> References: <1131283854.15471.4.camel@Panoramix> <25425.1131297440@sss.pgh.pa.us> <1131305633.5882.17.camel@Panoramix> <2503.1131308773@sss.pgh.pa.us> <1131337559.5877.7.camel@Panoramix> <436EDA0B.8030604@familyhealth.com.au> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 07 Nov 2005 06:46:41 +0100 Message-Id: <1131342401.5877.27.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.056 required=5 tests=[AWL=0.055, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.056 X-Spam-Level: X-Archive-Number: 200511/109 X-Sequence-Number: 15366 Hi Christopher, On Mon, 2005-11-07 at 12:37 +0800, Christopher Kings-Lynne wrote: > > Now *I* am confused. What does PgAdmin do more than giving the query to > > the database? > > It builds it into the data grid GUI object. But my initial question was about a query that does not produce data at all (well, a response from the server saying it is finished). I broke that query off after several hours. I am now running the query from my initial question with psql (now for >1 hour, in a transaction, fsyn off). Some statistics : uptime: 06:35:55 up 9:47, 6 users, load average: 7.08, 7.21, 6.08 iostat -x -k 1 (this output appears to be representative): avg-cpu: %user %nice %sys %iowait %idle 1.00 0.00 0.50 98.51 0.00 Device: sda sdb rrqm/s 0.00 0.00 wrqm/s 14.00 611.00 r/s 0.00 1.00 w/s 3.00 201.00 rsec/s 0.00 32.00 wsec/s 136.00 6680.00 rkB/s 0.00 16.00 wkB/s 68.00 3340.00 avgrq-sz 45.33 33.23 avgqu-sz 0.00 145.67 await 0.67 767.19 svctm 0.67 4.97 %util 0.20 100.30 -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Mon Nov 7 04:51:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 67D43D8ED6 for ; Mon, 7 Nov 2005 04:51:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54321-08 for ; Mon, 7 Nov 2005 08:51:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id D6F6AD7C7F for ; Mon, 7 Nov 2005 04:51:10 -0400 (AST) Received: from mailgate.vale-housing.co.uk ([194.217.48.34] helo=vale-housing.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) id 1EZ2cU-000IrS-HE for pgsql-performance@postgresql.org; Mon, 07 Nov 2005 08:44:50 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware Date: Mon, 7 Nov 2005 08:51:10 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance PG 8.0 on dual opteron / 4GB / 3ware Thread-Index: AcXjU63KSoWzPk+/T8C0seRcqq5kuAAJDwKw From: "Dave Page" To: "Joost Kraaijeveld" , "Tom Lane" Cc: "Pgsql-Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.074 required=5 tests=[AWL=0.074] X-Spam-Score: 0.074 X-Spam-Level: X-Archive-Number: 200511/114 X-Sequence-Number: 15371 =20 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Joost Kraaijeveld > Sent: 07 November 2005 04:26 > To: Tom Lane > Cc: Pgsql-Performance > Subject: Re: [PERFORM] Performance PG 8.0 on dual opteron /=20 > 4GB / 3ware >=20 > Hi Tom, >=20 > On Sun, 2005-11-06 at 15:26 -0500, Tom Lane wrote: > > I'm confused --- where's the 82sec figure coming from, exactly? > >From actually executing the query. >=20 > >From PgAdmin: >=20 > -- Executing query: > select objectid from prototype.orders >=20 > Total query runtime: 78918 ms. > Data retrieval runtime: 188822 ms. > 1104379 rows retrieved. >=20 >=20 > > We've heard reports of performance issues in PgAdmin with large > > result sets ... if you do the same query in psql, what happens? > jkr@Panoramix:~/postgresql$ time psql muntdev -c "select objectid from > prototype.orders" > output.txt >=20 > real 0m5.554s > user 0m1.121s > sys 0m0.470s >=20 >=20 > Now *I* am confused. What does PgAdmin do more than giving=20 > the query to > the database? Nothing - it just uses libpq's pqexec function. The speed issue in pgAdmin is rendering the results in the grid which can be slow on some OS's due to inefficiencies in some grid controls with large data sets. That's why we give 2 times - the first is the query runtime on the server, the second is data retrieval and rendering (iirc, it's been a while). Regards, Dave From pgsql-performance-owner@postgresql.org Mon Nov 7 05:03:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BFFDCD7C81 for ; Mon, 7 Nov 2005 05:03:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55849-08 for ; Mon, 7 Nov 2005 09:03:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 054ECDA4B0 for ; Mon, 7 Nov 2005 05:03:18 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 07 Nov 2005 10:03:18 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Dave Page Cc: Tom Lane , Pgsql-Performance In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 07 Nov 2005 10:02:59 +0100 Message-Id: <1131354179.5877.59.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.056 required=5 tests=[AWL=0.055, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.056 X-Spam-Level: X-Archive-Number: 200511/115 X-Sequence-Number: 15372 Hi Dave, On Mon, 2005-11-07 at 08:51 +0000, Dave Page wrote: > > On Sun, 2005-11-06 at 15:26 -0500, Tom Lane wrote: > > > I'm confused --- where's the 82sec figure coming from, exactly? > > >From actually executing the query. > > > > >From PgAdmin: > > > > -- Executing query: > > select objectid from prototype.orders > > > > Total query runtime: 78918 ms. > > Data retrieval runtime: 188822 ms. > > 1104379 rows retrieved. > > > > > > > We've heard reports of performance issues in PgAdmin with large > > > result sets ... if you do the same query in psql, what happens? > > jkr@Panoramix:~/postgresql$ time psql muntdev -c "select objectid from > > prototype.orders" > output.txt > > > > real 0m5.554s > > user 0m1.121s > > sys 0m0.470s > > > > > > Now *I* am confused. What does PgAdmin do more than giving > > the query to > > the database? > > Nothing - it just uses libpq's pqexec function. The speed issue in > pgAdmin is rendering the results in the grid which can be slow on some > OS's due to inefficiencies in some grid controls with large data sets. > That's why we give 2 times - the first is the query runtime on the > server, the second is data retrieval and rendering (iirc, it's been a > while). That is what I thought, but what could explain the difference in query runtime (78 seconds versus 5 seconds) ? -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Mon Nov 7 05:17:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B410DD9B27 for ; Mon, 7 Nov 2005 05:17:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66095-05 for ; Mon, 7 Nov 2005 09:17:13 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id 37795D9A01 for ; Mon, 7 Nov 2005 05:17:14 -0400 (AST) Received: from mailgate.vale-housing.co.uk ([194.217.48.34] helo=vale-housing.co.uk) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1EZ37r-0008Ve-LP for pgsql-performance@postgresql.org; Mon, 07 Nov 2005 09:17:15 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware Date: Mon, 7 Nov 2005 09:17:12 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance PG 8.0 on dual opteron / 4GB / 3ware Thread-Index: AcXjehnAFphKqwXeTvu+v+9HlnLCIwAAF7jA From: "Dave Page" To: "Joost Kraaijeveld" Cc: "Tom Lane" , "Pgsql-Performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.074 required=5 tests=[AWL=0.074] X-Spam-Score: 0.074 X-Spam-Level: X-Archive-Number: 200511/116 X-Sequence-Number: 15373 =20 > -----Original Message----- > From: Joost Kraaijeveld [mailto:J.Kraaijeveld@Askesis.nl]=20 > Sent: 07 November 2005 09:03 > To: Dave Page > Cc: Tom Lane; Pgsql-Performance > Subject: RE: [PERFORM] Performance PG 8.0 on dual opteron /=20 > 4GB / 3ware >=20 > > Nothing - it just uses libpq's pqexec function. The speed issue in > > pgAdmin is rendering the results in the grid which can be=20 > slow on some > > OS's due to inefficiencies in some grid controls with large=20 > data sets. > > That's why we give 2 times - the first is the query runtime on the > > server, the second is data retrieval and rendering (iirc,=20 > it's been a > > while). > That is what I thought, but what could explain the difference in query > runtime (78 seconds versus 5 seconds) ? Not in terms of our code - we obviously do a little more than just run the query, but I can't spot anything in there that should be non-constant time. Don't suppose it's anything as simple as you vacuuming in between is it? Regards, Dave From pgsql-performance-owner@postgresql.org Mon Nov 7 05:51:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6772AD7811 for ; Mon, 7 Nov 2005 05:51:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72554-08 for ; Mon, 7 Nov 2005 09:51:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 5AE7AD680C for ; Mon, 7 Nov 2005 05:51:31 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id E55A7418423; Mon, 7 Nov 2005 09:51:24 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 69D5515EDA; Mon, 7 Nov 2005 09:46:44 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22981-03; Mon, 7 Nov 2005 09:46:39 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 0545415ED9; Mon, 7 Nov 2005 09:46:39 +0000 (GMT) Message-ID: <436F227E.3060805@archonet.com> Date: Mon, 07 Nov 2005 09:46:38 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jeroen van Iddekinge Cc: pgsql-performance@postgresql.org Subject: Re: Performance problem with pg8.0 References: <436E453F.3060606@lycos.com> In-Reply-To: <436E453F.3060606@lycos.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/117 X-Sequence-Number: 15374 Jeroen van Iddekinge wrote: > Hello, > > I have some strange performance problems with quering a table.It has > 5282864, rows and contains the following columns : id > ,no,id_words,position,senpos and sentence all are integer non null. > > Index on : > * no > * no,id_words > * id_words > * senpos, sentence, "no") > * d=primary key > > "select count(1) from words_in_text" takes 9 seconds to compleet. Because it's reading through the whole table. See mailing list archives for discussion of why it doesn't just use an index. > The query 'select * from words_in_text' takes a verry long time to > return the first record (more that 2 minutes) why? A long time for the first row, hardly any time for the others. That's because it assembles all the rows and returns them at the same time. If you don't want all the rows at once use a cursor. > Also the following query behaves strange. > select * from words_in_text where no <100 order by no; > explain shows that pg is using sequence scan. When i turn of sequence > scan, index scan is used and is faster. I have a 'Explain verbose > analyze' of this query is at the end of the mail. It's just the "explain analyze" that's needed - the "verbose" gives far more detail than you'll want at this stage. > The number of estimated rows is wrong, so I did 'set statistics 1000' on > column no. After this the estimated number of rows was ok, but pg still > was using seq scan. I don't see the correct row estimate - it looks like it's getting it wrong again to me. > Can anyone explain why pg is using sequence and not index scan? There's one of two reasons: 1. It thinks it's going to fetch more rows than it does. 2. It has the relative costs of a seq-scan vs index accesses wrong. Can you try an "EXPLAIN ANALYZE" of select * from words_in_text where no < 100 AND no >= 0 order by no; Substitute whatever lower bound is sensible for "no". Let's see if that gives the system a clue. Then, we'll need to look at your other tuning settings. Have you made any changes to your postgresql.conf settings, in particular those mentioned here: http://www.powerpostgresql.com/PerfList -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Mon Nov 7 07:07:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3EAED6807 for ; Mon, 7 Nov 2005 07:07:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02662-08 for ; Mon, 7 Nov 2005 11:07:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by svr1.postgresql.org (Postfix) with ESMTP id 6F176D7C81 for ; Mon, 7 Nov 2005 07:07:19 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 07 Nov 2005 08:06:30 -0300 X-IronPort-AV: i="3.97,299,1125892800"; d="scan'208"; a="23875065:sNHT57897578" Received: from alvh.no-ip.org (216.155.78.23) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43501597002D8D7D; Mon, 7 Nov 2005 08:07:17 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 174F5C2D450; Mon, 7 Nov 2005 08:07:20 -0300 (CLST) Date: Mon, 7 Nov 2005 08:07:20 -0300 From: Alvaro Herrera To: "Christian Paul B. Cosinas" Cc: pgsql-performance@postgresql.org Subject: Re: Temporary Table Message-ID: <20051107110719.GA7012@surnet.cl> Mail-Followup-To: "Christian Paul B. Cosinas" , pgsql-performance@postgresql.org References: <004101c5e3b0$ee534130$1e21100a@ghwk02002147> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <004101c5e3b0$ee534130$1e21100a@ghwk02002147> User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.006 required=5 tests=[AWL=-0.240, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 2.006 X-Spam-Level: ** X-Archive-Number: 200511/118 X-Sequence-Number: 15375 Christian Paul B. Cosinas wrote: > Does Creating Temporary table in a function and NOT dropping them affects > the performance of the database? The system will drop it automatically, so it shouldn't affect. What _could_ be affecting you if you execute that function a lot, is accumulated bloat in pg_class, pg_attribute, or other system catalogs. You may want to make sure these are vacuumed often. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From pgsql-performance-owner@postgresql.org Mon Nov 7 10:47:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A49AADA65B for ; Mon, 7 Nov 2005 10:47:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08742-08 for ; Mon, 7 Nov 2005 14:47:46 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id 4A306DA54F for ; Mon, 7 Nov 2005 10:47:48 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so316225wri for ; Mon, 07 Nov 2005 06:47:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RHSjVWE6Hhmfs5ZNrAL+7gBAbThugSbQXnGiQ+sdLOugeLSz50n13l9JKF++PYco41bPfVTJcocjgnqjqbwpQgRq//2TwHc+BxwY5Jt1B+ckTIYyyb21QmG1bhJljeGPS09NcCNOB1AnIlsleQ80Zye1U0tHrDd7wZe/R6A6Y3g= Received: by 10.54.117.1 with SMTP id p1mr2002458wrc; Mon, 07 Nov 2005 06:47:53 -0800 (PST) Received: by 10.54.83.19 with HTTP; Mon, 7 Nov 2005 06:47:53 -0800 (PST) Message-ID: <33c6269f0511070647tc648d09p32f9368e8e775e6c@mail.gmail.com> Date: Mon, 7 Nov 2005 09:47:53 -0500 From: Alex Turner To: Joost Kraaijeveld Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware Raid5 / Debian?? Cc: Pgsql-Performance In-Reply-To: <1131283854.15471.4.camel@Panoramix> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1131283854.15471.4.camel@Panoramix> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.092 required=5 tests=[AWL=0.092] X-Spam-Score: 0.092 X-Spam-Level: X-Archive-Number: 200511/119 X-Sequence-Number: 15376 Where are the pg_xlog and data directories with respect to each other? From this IOStat it looks like they might be on the same partition, which is not ideal, and actualy surprising that throughput is this good. You need to seperate pg_xlog and data directories to get any kind of reasonable performance. Also don't use RAID 5 - RAID 5 bites, no really - it bites. Use multiple RAID 1s, or RAID 10s, you will get better performance. 50MB/70MB is about the same as you get from a single disk or a RAID 1. We use 2x9506S8MI controlers, and have maintained excellent performance with 2xRAID 10 and 2xRAID 1. Make sure you get the firmware update if you have these controllers though. Alex Turner NetEconomist On 11/6/05, Joost Kraaijeveld wrote: > Hi, > > I am experiencing very long update queries and I want to know if it > reasonable to expect them to perform better. > > The query below is running for more than 1.5 hours (5500 seconds) now, > while the rest of the system does nothing (I don't even type or move a > mouse...). > > - Is that to be expected? > - Is 180-200 tps with ~ 9000 KB (see output iostat below) not low, given > the fact that fsync is off? (Note: with bonnie++ I get write > performance > 50 MB/sec and read performace > 70 MB/sec with > 2000 > read/write ops /sec? > - Does anyone else have any experience with the 3Ware RAID controller > (which is my suspect)? > - Any good idea how to determine the real botleneck if this is not the > performance I can expect? > > My hard- and software: > > - PostgreSQL 8.0.3 > - Debian 3.1 (Sarge) AMD64 > - Dual Opteron > - 4GB RAM > - 3ware Raid5 with 5 disks > > Pieces of my postgresql.conf (All other is default): > shared_buffers =3D 7500 > work_mem =3D 260096 > fsync=3Dfalse > effective_cache_size =3D 32768 > > > > The query with explain (amount and orderbedrag_valuta are float8, > ordernummer and ordernumber int4): > > explain update prototype.orders set amount =3D > odbc.orders.orderbedrag_valuta from odbc.orders where ordernumber =3D > odbc.orders.ordernummer; > QUERY PLAN > -------------------------------------------------------------------------= ---- > Hash Join (cost=3D50994.74..230038.17 rows=3D1104379 width=3D466) > Hash Cond: ("outer".ordernumber =3D "inner".ordernummer) > -> Seq Scan on orders (cost=3D0.00..105360.68 rows=3D3991868 width= =3D455) > -> Hash (cost=3D48233.79..48233.79 rows=3D1104379 width=3D15) > -> Seq Scan on orders (cost=3D0.00..48233.79 rows=3D1104379 > width=3D15) > > > Sample output from iostat during query (about avarage): > Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn > hdc 0.00 0.00 0.00 0 0 > sda 0.00 0.00 0.00 0 0 > sdb 187.13 23.76 8764.36 24 8852 > > > -- > Groeten, > > Joost Kraaijeveld > Askesis B.V. > Molukkenstraat 14 > 6524NB Nijmegen > tel: 024-3888063 / 06-51855277 > fax: 024-3608416 > e-mail: J.Kraaijeveld@Askesis.nl > web: www.askesis.nl > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Mon Nov 7 03:31:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DED92D682F for ; Mon, 7 Nov 2005 03:31:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32618-01 for ; Mon, 7 Nov 2005 07:31:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (mail.heliustech.net [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id 2FDE0D680C for ; Mon, 7 Nov 2005 03:31:06 -0400 (AST) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id jA77UN304246 for ; Mon, 7 Nov 2005 15:30:23 +0800 From: "Christian Paul B. Cosinas" To: Subject: FW: Used Memory Date: Mon, 7 Nov 2005 15:34:41 -0000 Message-ID: <004001c5e3b0$c5f368a0$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXYSRQEEzZVhwc+RZSn0P4xxglPcQAA3w8wAtkKxYA= X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.717 required=5 tests=[AWL=-0.875, DATE_IN_FUTURE_06_12=1.498, URIBL_SBL=1.094] X-Spam-Score: 1.717 X-Spam-Level: * X-Archive-Number: 200511/112 X-Sequence-Number: 15369 Here are the configuration of our database server: port = 5432 max_connections = 300 superuser_reserved_connections = 10 authentication_timeout = 60 shared_buffers = 48000 sort_mem = 32168 sync = false Do you think this is enough? Or can you recommend a better configuration for my server? The server is also running PHP and Apache but wer'e not using it extensively. For development purpose only. The database slow down is occurring most of the time (when the memory free is low) I don't think it has something to do with vacuum. We only have a full server vacuum once a day. -----Original Message----- From: Mark Kirkwood [mailto:markir@paradise.net.nz] Sent: Monday, October 24, 2005 3:14 AM To: Christian Paul B. Cosinas Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Used Memory > > > I just noticed that as long as the free memory in the first row (which > is 55036 as of now) became low, the slower is the response of the > database server. > Also, how about posting your postgresql.conf (or just the non-default parameters) to this list? Some other stuff that could be relevant: - Is the machine just a database server, or does it run (say) Apache + Php? - When the slowdown is noticed, does this coincide with certain activities - e.g, backup , daily maintenance, data load(!) etc. regards Mark > > I choose Polesoft Lockspam to fight spam, and you? > http://www.polesoft.com/refer.html Nope, not me either. I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html From pgsql-performance-owner@postgresql.org Mon Nov 7 03:31:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C7995D7AF6 for ; Mon, 7 Nov 2005 03:31:32 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22918-08 for ; Mon, 7 Nov 2005 07:31:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (mail.heliustech.net [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id B9E61D7028 for ; Mon, 7 Nov 2005 03:31:30 -0400 (AST) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id jA77VUm20602 for ; Mon, 7 Nov 2005 15:31:30 +0800 From: "Christian Paul B. Cosinas" To: Subject: Temporary Table Date: Mon, 7 Nov 2005 15:35:49 -0000 Message-ID: <004101c5e3b0$ee534130$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0042_01C5E3B0.EE534130" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXWVwx9TKFORE3pS6yM9N43/8G7SwB5T9QAAAEl7OAC3AFREA== X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.748 required=5 tests=[AWL=-0.845, DATE_IN_FUTURE_06_12=1.498, HTML_MESSAGE=0.001, URIBL_SBL=1.094] X-Spam-Score: 1.748 X-Spam-Level: * X-Archive-Number: 200511/113 X-Sequence-Number: 15370 This is a multi-part message in MIME format. ------=_NextPart_000_0042_01C5E3B0.EE534130 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Does Creating Temporary table in a function and NOT dropping them affects the performance of the database? I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html ------=_NextPart_000_0042_01C5E3B0.EE534130 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Does Creating = Temporary table in a function and NOT dropping them affects the performance of the database?

 



I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html



I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html ------=_NextPart_000_0042_01C5E3B0.EE534130-- From pgsql-performance-owner@postgresql.org Mon Nov 7 13:22:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 11C72D6805 for ; Mon, 7 Nov 2005 13:22:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71792-09 for ; Mon, 7 Nov 2005 17:22:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id F2C76DA481 for ; Mon, 7 Nov 2005 13:22:26 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id DC32731059; Mon, 7 Nov 2005 18:22:24 +0100 (MET) From: "PostgreSQL" X-Newsgroups: pgsql.performance Subject: Re: 8.1 iss Date: Mon, 7 Nov 2005 11:22:16 -0600 Organization: Hub.Org Networking Services Lines: 36 Message-ID: References: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/120 X-Sequence-Number: 15377 My most humble apologies to the pg development team (pg_lets?). I took Greg Stark's advice and set: shared_buffers = 10000 # was 50000 work_mem = 1048576 # 1Gb - was 16384 Also, I noticed that the EXPLAIN ANALYZE consistently thought reads would take longer than they actually did, so I decreased random_page_cost down to 1 (the server has a SATA Raid at level 10). Queries that previously seemed to stall out are still a little slow but nothing like before. And I'm seeing a more normal balance of CPU and disk i/o while a query is running instead of the high-cpu-low-disk-read situation I was seeing before. Concurrency is way up. I tried a couple of interim sizes for work_mem and so far, the larger the better (the server has 16Gb). I'll test a little larger size this evening and see what it does. Yes, I've read the warning that this is per process. Kudos to you Greg, thanks Luke for your comment (though it seems to disagree with my experience). Also to Dennis, there were not drastic changes in the plan between 8.0 and 8.1, it was just the actual execution times. Martin "PostgreSQL" wrote in message news:dkko49$1v06$1@news.hub.org... > SELECT v_barcode, count(v_barcode) FROM lead GROUP BY v_barcode HAVING > count(*) > 1; > > This is a pretty good example of the place where 8.1 seems to be quite > broken. ... From pgsql-performance-owner@postgresql.org Mon Nov 7 13:48:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A39CD78C4 for ; Mon, 7 Nov 2005 13:45:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83267-10 for ; Mon, 7 Nov 2005 17:45:38 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by svr1.postgresql.org (Postfix) with ESMTP id 9BCA6D72B6 for ; Mon, 7 Nov 2005 13:45:37 -0400 (AST) Received: from p548F3CD6.dip0.t-ipconnect.de [84.143.60.214] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1EZB3l2Ckn-0007fY; Mon, 07 Nov 2005 18:45:33 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1EZB3j-0002Uf-MT; Mon, 07 Nov 2005 18:45:31 +0100 Message-ID: <436F92BB.7040807@pse-consulting.de> Date: Mon, 07 Nov 2005 17:45:31 +0000 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Page Cc: Joost Kraaijeveld , Tom Lane , Pgsql-Performance Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware References: In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.125 required=5 tests=[AWL=0.125] X-Spam-Score: 0.125 X-Spam-Level: X-Archive-Number: 200511/121 X-Sequence-Number: 15378 Dave Page wrote: >> >> >>Now *I* am confused. What does PgAdmin do more than giving >>the query to >>the database? > > > Nothing - it just uses libpq's pqexec function. The speed issue in > pgAdmin is rendering the results in the grid which can be slow on some > OS's due to inefficiencies in some grid controls with large data sets. > That's why we give 2 times - the first is the query runtime on the > server, the second is data retrieval and rendering (iirc, it's been a > while). yrnc. Query runtime includes data transfer to the client, i.e. until libpq returns the set, second time is retrieving data from libpq and rendering. Regards, From pgsql-performance-owner@postgresql.org Mon Nov 7 14:11:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5FF85D8E25 for ; Mon, 7 Nov 2005 14:07:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94515-01 for ; Mon, 7 Nov 2005 18:07:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from metux.de (seven.metux.de [193.16.1.1]) by svr1.postgresql.org (Postfix) with ESMTP id 66A8DD8316 for ; Mon, 7 Nov 2005 14:07:40 -0400 (AST) Received: (from weigelt@localhost) by metux.de (8.12.10/8.12.10) id jA7I7ck7026690 for pgsql-performance@postgresql.org; Mon, 7 Nov 2005 19:07:38 +0100 Date: Mon, 7 Nov 2005 19:07:38 +0100 From: Enrico Weigelt To: pgsql-performance@postgresql.org Subject: Index + mismatching datatypes [WAS: index on custom function; explain] Message-ID: <20051107180738.GC15990@nibiru.local> Reply-To: weigelt@metux.de Mail-Followup-To: pgsql-performance@postgresql.org References: <1128352451.312090.37640@g44g2000cwa.googlegroups.com> <20051006081919.GA17081@zoom.spline.inf.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051006081919.GA17081@zoom.spline.inf.fu-berlin.de> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/122 X-Sequence-Number: 15379 * Yann Michel wrote: > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match I've got a similar problem: I have to match different datatypes, ie. bigint vs. integer vs. oid. Of course I tried to use casted index (aka ON (foo::oid)), but it didn't work. What am I doing wrong ? cu -- --------------------------------------------------------------------- Enrico Weigelt == metux IT service phone: +49 36207 519931 www: http://www.metux.de/ fax: +49 36207 519932 email: contact@metux.de --------------------------------------------------------------------- Realtime Forex/Stock Exchange trading powered by postgreSQL :)) http://www.fxignal.net/ --------------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Mon Nov 7 16:42:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7B824D8316 for ; Mon, 7 Nov 2005 16:42:02 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51481-02 for ; Mon, 7 Nov 2005 20:42:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 0168BD6805 for ; Mon, 7 Nov 2005 16:42:00 -0400 (AST) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 81154239607; Mon, 7 Nov 2005 15:42:02 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 42225-01-9; Mon, 7 Nov 2005 15:42:01 -0500 (EST) Received: from [192.168.1.104] (d226-86-55.home.cgocable.net [24.226.86.55]) by mailbox.samurai.com (Postfix) with ESMTP id 12ED2239461; Mon, 7 Nov 2005 15:42:01 -0500 (EST) Subject: Re: Index + mismatching datatypes [WAS: index on custom From: Neil Conway To: weigelt@metux.de Cc: pgsql-performance@postgresql.org In-Reply-To: <20051107180738.GC15990@nibiru.local> References: <1128352451.312090.37640@g44g2000cwa.googlegroups.com> <20051006081919.GA17081@zoom.spline.inf.fu-berlin.de> <20051107180738.GC15990@nibiru.local> Content-Type: text/plain Date: Mon, 07 Nov 2005 15:45:57 -0500 Message-Id: <1131396357.6884.110.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/123 X-Sequence-Number: 15380 On Mon, 2005-07-11 at 19:07 +0100, Enrico Weigelt wrote: > I've got a similar problem: I have to match different datatypes, > ie. bigint vs. integer vs. oid. > > Of course I tried to use casted index (aka ON (foo::oid)), but > it didn't work. Don't include the cast in the index definition, include it in the query itself: SELECT ... FROM foo WHERE int8col = 5::int8 for example. Alternatively, upgrade to 8.0 or better, which doesn't require this workaround. -Neil From pgsql-performance-owner@postgresql.org Mon Nov 7 17:35:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EE71FDAF2C for ; Mon, 7 Nov 2005 17:35:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66450-06 for ; Mon, 7 Nov 2005 21:35:19 +0000 (GMT) X-Greylist: delayed 00:05:02.594679 by SQLgrey- Received: from nz.telogis.com (unknown [203.98.10.169]) by svr1.postgresql.org (Postfix) with ESMTP id 47E84DAD86 for ; Mon, 7 Nov 2005 17:35:20 -0400 (AST) Received: from [192.168.3.1] ([192.168.3.1]) by nz.telogis.com with esmtp; Tue, 08 Nov 2005 10:30:16 +1300 id 006BD844.436FC769.00003B46 Message-ID: <436FC767.1010702@telogis.com> Date: Tue, 08 Nov 2005 10:30:15 +1300 From: Ralph Mason User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Figuring out which command failed Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/124 X-Sequence-Number: 15381 Hi, I have a transaction that has multiple separate command in it (nothing unusual there). However sometimes one of the sql statements will fail and so the whole transaction fails. In some cases I could fix the failing statement if only I knew which one it was. Can anyone think of any way to get which statement actually failed from the error message? If the error message gave me the line of the failure it would be excellent, but it doesn't. Perhaps it would be easy for me to patch my version of Postgres to do that? I realize I could do this with 2 phase commit, but that isn't ready yet! Any thoughts or ideas are much appreciated Thanks Ralph From pgsql-performance-owner@postgresql.org Mon Nov 7 17:40:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C8AC2D6892 for ; Mon, 7 Nov 2005 17:40:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69119-05 for ; Mon, 7 Nov 2005 21:40:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nz.telogis.com (unknown [203.98.10.169]) by svr1.postgresql.org (Postfix) with ESMTP id 770E5D6834 for ; Mon, 7 Nov 2005 17:40:13 -0400 (AST) Received: from [192.168.3.1] ([192.168.3.1]) by nz.telogis.com with esmtp; Tue, 08 Nov 2005 10:40:08 +1300 id 006116D6.436FC9BD.00003B66 Message-ID: <436FC9B1.4000906@telogis.com> Date: Tue, 08 Nov 2005 10:40:01 +1300 From: Ralph Mason User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Temporary Table References: <004101c5e3b0$ee534130$1e21100a@ghwk02002147> <20051107110719.GA7012@surnet.cl> In-Reply-To: <20051107110719.GA7012@surnet.cl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/125 X-Sequence-Number: 15382 Alvaro Herrera wrote: > Christian Paul B. Cosinas wrote: > >> Does Creating Temporary table in a function and NOT dropping them affects >> the performance of the database? >> > > The system will drop it automatically, so it shouldn't affect. > > What _could_ be affecting you if you execute that function a lot, is > accumulated bloat in pg_class, pg_attribute, or other system catalogs. > You may want to make sure these are vacuumed often. > > The answer in my experience is a very loud YES YES YES If you use lots of temporary tables you will grow and dirty your system catalogs, so you need to be vacuuming them regularly also (pg_call, pg_attribute) Otherwise your db will slow to a crawl after a while. Ralph From pgsql-performance-owner@postgresql.org Mon Nov 7 23:01:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5F7C2D8055 for ; Mon, 7 Nov 2005 23:01:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84192-09 for ; Tue, 8 Nov 2005 03:01:04 +0000 (GMT) X-Greylist: delayed 01:00:45.562753 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id B1811D7C60 for ; Mon, 7 Nov 2005 23:01:05 -0400 (AST) Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by svr2.postgresql.org (Postfix) with ESMTP id 02D08F0D2C for ; Tue, 8 Nov 2005 02:00:23 +0000 (GMT) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jA827ZxT023899 for ; Mon, 7 Nov 2005 18:07:36 -0800 Message-ID: <4370062B.4050202@modgraph-usa.com> Date: Mon, 07 Nov 2005 17:58:03 -0800 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Expensive function and the optimizer Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.025 required=5 tests=[AWL=0.025] X-Spam-Score: 0.025 X-Spam-Level: X-Archive-Number: 200511/134 X-Sequence-Number: 15391 I have a function, call it "myfunc()", that is REALLY expensive computationally. Think of it like, "If you call this function, it's going to telephone the Microsoft Help line and wait in their support queue to get the answer." Ok, it's not that bad, but it's so bad that the optimizer should ALWAYS consider it last, no matter what. (Realistically, the function takes 1-2 msec average, so applying it to 40K rows takes 40-80 seconds. It's a graph-theory algorithm, known to be NP-complete.) Is there some way to explain this cost to the optimizer in a permanent way, like when the function is installed? Here's what I get with one critical query (somewhat paraphrased for simplicity): explain analyze select A.ID from A join B ON (A.ID = B.ID) where A.row_num >= 0 and A.row_num <= 43477 and B.ID = 52 and myfunc(A.FOO, 'FooBar') order by row_num; QUERY PLAN ---------------------------------------------------------------------------------- Nested Loop (cost=0.00..72590.13 rows=122 width=8) -> Index Scan using i_a_row_num on a (cost=0.00..10691.35 rows=12222 width=8) Index Cond: ((row_num >= 0) AND (row_num <= 43477)) Filter: myfunc((foo)::text, 'FooBar'::text) -> Index Scan using i_b_id on b (cost=0.00..5.05 rows=1 width=4) Index Cond: ("outer".id = b.id) Filter: (id = 52) Total runtime: 62592.631 ms (8 rows) Notice the "Filter: myfunc(...)" that comes in the first loop. This means it's applying myfunc() to 43477 rows in this example. The second index scan would cut this number down from 43477 rows to about 20 rows, making the query time drop from 62 seconds down to a fraction of a second. Is there any way to give Postgres this information? The only way I've thought of is something like this: select X.id from (select A.id, A.foo, A.row_num from A join B ON (A.id = B.id) where A.row_num >= 0 and A.row_num <= 43477 and B.id = 52) as X where myfunc(X.foo, 'FooBar') order by X.row_num; I can do this, but it means carefully hand-crafting each query rather than writing a more natural query. Thanks, Craig From pgsql-performance-owner@postgresql.org Mon Nov 7 22:10:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF067DAD68 for ; Mon, 7 Nov 2005 22:10:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68577-09 for ; Tue, 8 Nov 2005 02:10:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 6DCF5DAA49 for ; Mon, 7 Nov 2005 22:10:41 -0400 (AST) Received: from [192.168.1.105] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jA82680h014921; Mon, 7 Nov 2005 18:06:13 -0800 Message-ID: <4370091E.8060700@commandprompt.com> Date: Mon, 07 Nov 2005 18:10:38 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Christian Paul B. Cosinas" Cc: "'Alvaro Nunes Melo'" , pgsql-performance@postgresql.org Subject: Re: Temporary Table References: <008301c5e44c$70eee900$1e21100a@ghwk02002147> In-Reply-To: <008301c5e44c$70eee900$1e21100a@ghwk02002147> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Mon, 07 Nov 2005 18:06:13 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.567 required=5 tests=[AWL=-0.527, URIBL_SBL=1.094] X-Spam-Score: 0.567 X-Spam-Level: X-Archive-Number: 200511/128 X-Sequence-Number: 15385 Christian Paul B. Cosinas wrote: > I try to run this command in my linux server. > VACUUM FULL pg_class; > VACUUM FULL pg_attribute; > VACUUM FULL pg_depend; > > But it give me the following error: > -bash: VACUUM: command not found That needs to be run from psql ... > > > > > > I choose Polesoft Lockspam to fight spam, and you? > http://www.polesoft.com/refer.html > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Mon Nov 7 22:13:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7074DD72B6 for ; Mon, 7 Nov 2005 22:13:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71052-10 for ; Tue, 8 Nov 2005 02:13:49 +0000 (GMT) X-Greylist: delayed 21:36:12.623567 by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id DC879D6E2C for ; Mon, 7 Nov 2005 22:13:50 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 5F59525070; Tue, 8 Nov 2005 10:13:52 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 5E70824FFA; Tue, 8 Nov 2005 10:13:51 +0800 (WST) Message-ID: <43700A15.9000506@familyhealth.com.au> Date: Tue, 08 Nov 2005 10:14:45 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Christian Paul B. Cosinas" Cc: 'Alvaro Nunes Melo' , pgsql-performance@postgresql.org Subject: Re: Temporary Table References: <008301c5e44c$70eee900$1e21100a@ghwk02002147> In-Reply-To: <008301c5e44c$70eee900$1e21100a@ghwk02002147> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.581 required=5 tests=[AWL=-0.513, URIBL_SBL=1.094] X-Spam-Score: 0.581 X-Spam-Level: X-Archive-Number: 200511/129 X-Sequence-Number: 15386 Ummm...they're SQL commands. Run them in PostgreSQL, not on the unix command line... Christian Paul B. Cosinas wrote: > I try to run this command in my linux server. > VACUUM FULL pg_class; > VACUUM FULL pg_attribute; > VACUUM FULL pg_depend; > > But it give me the following error: > -bash: VACUUM: command not found > > > > > > I choose Polesoft Lockspam to fight spam, and you? > http://www.polesoft.com/refer.html > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Mon Nov 7 22:14:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDCD0DACE8 for ; Mon, 7 Nov 2005 22:14:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70702-07 for ; Tue, 8 Nov 2005 02:14:11 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id F0EB6D9A17 for ; Mon, 7 Nov 2005 22:14:12 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 6344E25092; Tue, 8 Nov 2005 10:14:16 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 80DBB25091; Tue, 8 Nov 2005 10:14:15 +0800 (WST) Message-ID: <43700A2E.8060008@familyhealth.com.au> Date: Tue, 08 Nov 2005 10:15:10 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Christian Paul B. Cosinas" Cc: 'Alvaro Nunes Melo' , pgsql-performance@postgresql.org Subject: Re: Temporary Table References: <008201c5e44b$c0cdf390$1e21100a@ghwk02002147> In-Reply-To: <008201c5e44b$c0cdf390$1e21100a@ghwk02002147> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.035 required=5 tests=[AWL=0.035] X-Spam-Score: 0.035 X-Spam-Level: X-Archive-Number: 200511/130 X-Sequence-Number: 15387 > In what directory in my linux server will I find these 3 tables? Directory? They're tables in your database... From pgsql-performance-owner@postgresql.org Mon Nov 7 22:29:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F78ED9A17 for ; Mon, 7 Nov 2005 22:29:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81356-02 for ; Tue, 8 Nov 2005 02:29:30 +0000 (GMT) X-Greylist: delayed 00:06:38.782794 by SQLgrey- Received: from smtp111.sbc.mail.mud.yahoo.com (smtp111.sbc.mail.mud.yahoo.com [68.142.198.210]) by svr1.postgresql.org (Postfix) with SMTP id 484D8D6892 for ; Mon, 7 Nov 2005 22:29:32 -0400 (AST) Received: (qmail 99335 invoked from network); 8 Nov 2005 02:22:55 -0000 Received: from unknown (HELO discord.dyndns.org) (jeffroe996@sbcglobal.net@69.227.55.89 with plain) by smtp111.sbc.mail.mud.yahoo.com with SMTP; 8 Nov 2005 02:22:55 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by discord.dyndns.org (8.13.4/8.13.4) with ESMTP id jA82MsUC018935; Mon, 7 Nov 2005 18:22:54 -0800 Date: Mon, 7 Nov 2005 18:22:54 -0800 (PST) From: Jeff Frost X-X-Sender: jeff@discord.dyndns.org To: "Christian Paul B. Cosinas" Cc: "'Joshua D. Drake'" , "'Alvaro Nunes Melo'" , pgsql-performance@postgresql.org Subject: Re: Temporary Table In-Reply-To: <008401c5e44e$42600c20$1e21100a@ghwk02002147> Message-ID: References: <008401c5e44e$42600c20$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.572 required=5 tests=[AWL=-0.522, URIBL_SBL=1.094] X-Spam-Score: 0.572 X-Spam-Level: X-Archive-Number: 200511/133 X-Sequence-Number: 15390 You can use the vacuumdb external command. Here's an example: vacuumdb --full --analyze --table mytablename mydbname On Tue, 8 Nov 2005, Christian Paul B. Cosinas wrote: > But How Can I put this in the Cron of my Linux Server? > I really don't have an idea :) > What I want to do is to loop around all the databases in my server and > execute the vacuum of these 3 tables in each tables. > > -----Original Message----- > From: Joshua D. Drake [mailto:jd@commandprompt.com] > Sent: Tuesday, November 08, 2005 2:11 AM > To: Christian Paul B. Cosinas > Cc: 'Alvaro Nunes Melo'; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Temporary Table > > Christian Paul B. Cosinas wrote: >> I try to run this command in my linux server. >> VACUUM FULL pg_class; >> VACUUM FULL pg_attribute; >> VACUUM FULL pg_depend; >> >> But it give me the following error: >> -bash: VACUUM: command not found > > That needs to be run from psql ... > >> >> >> >> >> >> I choose Polesoft Lockspam to fight spam, and you? >> http://www.polesoft.com/refer.html >> >> >> ---------------------------(end of >> broadcast)--------------------------- >> TIP 4: Have you searched our list archives? >> >> http://archives.postgresql.org > > > I choose Polesoft Lockspam to fight spam, and you? > http://www.polesoft.com/refer.html > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- Jeff Frost, Owner Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 From pgsql-performance-owner@postgresql.org Mon Nov 7 22:23:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 72CF9D72B6 for ; Mon, 7 Nov 2005 22:23:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78079-07 for ; Tue, 8 Nov 2005 02:23:23 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id AF2ECD6E2C for ; Mon, 7 Nov 2005 22:23:25 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 8AADF25094; Tue, 8 Nov 2005 10:23:29 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id DE48025087; Tue, 8 Nov 2005 10:23:25 +0800 (WST) Message-ID: <43700C54.2010701@familyhealth.com.au> Date: Tue, 08 Nov 2005 10:24:20 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Christian Paul B. Cosinas" Cc: "'Joshua D. Drake'" , 'Alvaro Nunes Melo' , pgsql-performance@postgresql.org Subject: Re: Temporary Table References: <008401c5e44e$42600c20$1e21100a@ghwk02002147> In-Reply-To: <008401c5e44e$42600c20$1e21100a@ghwk02002147> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.583 required=5 tests=[AWL=-0.511, URIBL_SBL=1.094] X-Spam-Score: 0.583 X-Spam-Level: X-Archive-Number: 200511/132 X-Sequence-Number: 15389 Or you could just run the 'vacuumdb' utility... Put something like this in cron: # Vacuum full local pgsql database 30 * * * * postgres vacuumdb -a -q -z You really should read the manual. Chris Christian Paul B. Cosinas wrote: > I see. > > But How Can I put this in the Cron of my Linux Server? > I really don't have an idea :) > What I want to do is to loop around all the databases in my server and > execute the vacuum of these 3 tables in each tables. > > -----Original Message----- > From: Joshua D. Drake [mailto:jd@commandprompt.com] > Sent: Tuesday, November 08, 2005 2:11 AM > To: Christian Paul B. Cosinas > Cc: 'Alvaro Nunes Melo'; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Temporary Table > > Christian Paul B. Cosinas wrote: > >>I try to run this command in my linux server. >>VACUUM FULL pg_class; >>VACUUM FULL pg_attribute; >>VACUUM FULL pg_depend; >> >>But it give me the following error: >> -bash: VACUUM: command not found > > > That needs to be run from psql ... > > >> >> >> >> >>I choose Polesoft Lockspam to fight spam, and you? >>http://www.polesoft.com/refer.html >> >> >>---------------------------(end of >>broadcast)--------------------------- >>TIP 4: Have you searched our list archives? >> >> http://archives.postgresql.org > > > > I choose Polesoft Lockspam to fight spam, and you? > http://www.polesoft.com/refer.html > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Mon Nov 7 23:02:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 86F79DB127 for ; Mon, 7 Nov 2005 23:02:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91812-07 for ; Tue, 8 Nov 2005 03:02:26 +0000 (GMT) X-Greylist: delayed 00:26:46.548572 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id F24B6DB1D9 for ; Mon, 7 Nov 2005 23:01:55 -0400 (AST) Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.78.240.40]) by svr2.postgresql.org (Postfix) with ESMTP id 7B336F0DE4 for ; Tue, 8 Nov 2005 02:35:33 +0000 (GMT) Received: from 218-101-8-114.xtreme.net.nz ([218.101.8.114] helo=ubu.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1EZJKS-00037g-VN; Tue, 08 Nov 2005 15:35:21 +1300 Received: by ubu.mcmillan.net.nz (Postfix, from userid 1000) id 96B396F0A0A; Tue, 8 Nov 2005 15:35:20 +1300 (NZDT) Subject: Re: Temporary Table From: Andrew McMillan To: "Christian Paul B. Cosinas" Cc: "'Joshua D. Drake'" , 'Alvaro Nunes Melo' , pgsql-performance@postgresql.org In-Reply-To: <008401c5e44e$42600c20$1e21100a@ghwk02002147> References: <008401c5e44e$42600c20$1e21100a@ghwk02002147> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-bSOP61PawZ62D/NruzET" Organization: Catalyst .Net Ltd Date: Tue, 08 Nov 2005 15:35:20 +1300 Message-Id: <1131417320.5555.10.camel@ubu.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Evolution 2.5.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/135 X-Sequence-Number: 15392 --=-bSOP61PawZ62D/NruzET Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2005-11-08 at 10:22 +0000, Christian Paul B. Cosinas wrote: > I see. >=20 > But How Can I put this in the Cron of my Linux Server? > I really don't have an idea :) > What I want to do is to loop around all the databases in my server and > execute the vacuum of these 3 tables in each tables. I usually write a small shell script something like: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #!/bin/sh psql somedatabase <; Tue, 8 Nov 2005 00:12:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10321-06 for ; Tue, 8 Nov 2005 04:12:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id EBC42D7123 for ; Tue, 8 Nov 2005 00:12:09 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA84C7jL001159; Mon, 7 Nov 2005 23:12:07 -0500 (EST) To: "Craig A. James" Cc: pgsql-performance@postgresql.org Subject: Re: Expensive function and the optimizer In-reply-to: <4370062B.4050202@modgraph-usa.com> References: <4370062B.4050202@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Mon, 07 Nov 2005 17:58:03 -0800" Date: Mon, 07 Nov 2005 23:12:07 -0500 Message-ID: <1158.1131423127@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/136 X-Sequence-Number: 15393 "Craig A. James" writes: > Is there some way to explain this cost to the optimizer in a permanent > way, Nope, sorry. One thing you could do in the particular case at hand is to rejigger the WHERE clause involving the function so that it requires values from both tables and therefore can't be applied till after the join is made. (If nothing else, give the function an extra dummy argument that can be passed as a variable from the other table.) This is an ugly and non-general solution of course. > The only way I've thought of is something like this: > select X.id from > (select A.id, A.foo, A.row_num > from A join B ON (A.id = B.id) > where A.row_num >= 0 and A.row_num <= 43477 > and B.id = 52) as X > where myfunc(X.foo, 'FooBar') order by X.row_num; As written, that won't work because the planner will happily flatten the query to the same thing you had before. You can put an OFFSET 0 into the sub-select to prevent that from happening, but realize that this creates a pretty impervious optimization fence ... the side-effects might be undesirable when you come to look at real queries instead of toy cases. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 8 05:01:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 588B5DA769 for ; Tue, 8 Nov 2005 05:01:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09630-06 for ; Tue, 8 Nov 2005 09:01:15 +0000 (GMT) X-Greylist: delayed 01:55:54.723731 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 1BF97D9D64 for ; Tue, 8 Nov 2005 05:01:07 -0400 (AST) Received: from smtpauth04.mail.atl.earthlink.net (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) by svr2.postgresql.org (Postfix) with ESMTP id 70CA2F0B9B for ; Tue, 8 Nov 2005 07:05:13 +0000 (GMT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=interserv.com; b=lKPYg1AFam6B658W3zgSiBJnFHEW5ju4BQrr0Aerc3Be0n+4YYZXulMbL/VaciNS; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from c-67-172-134-193.hsd1.co.comcast.net ([67.172.134.193] helo=[127.0.0.1]) by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EZNXY-0005Hd-3d for pgsql-performance@postgresql.org; Tue, 08 Nov 2005 02:05:08 -0500 Message-ID: <43704E1D.80708@interserv.com> Date: Tue, 08 Nov 2005 00:05:01 -0700 From: Charlie Savage User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Sort performance on large tables Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: e034cf2bd229a6001a54e280ff29e56240c5d2d4e9129c5a1d857c7956ec51dcc893167dfb778fe6350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 67.172.134.193 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/137 X-Sequence-Number: 15394 Hi everyone, I have a question about the performance of sort. Setup: Dell Dimension 3000, Suse 10, 1GB ram, PostgreSQL 8.1 RC 1 with PostGIS, 1 built-in 80 GB IDE drive, 1 SATA Seagate 400GB drive. The IDE drive has the OS and the WAL files, the SATA drive the database. From hdparm the max IO for the IDE drive is about 50Mb/s and the SATA drive is about 65Mb/s. Thus a very low-end machine - but it used just for development (i.e., it is not a production machine) and the only thing it does is run a PostgresSQL database. I have a staging table called completechain that holds US tiger data (i.e., streets and addresses for the US). The table is approximately 18GB. Its big because there is a lot of data, but also because the table is not normalized (it comes that way). I want to extract data out of the file, with the most important values being stored in a column called tlid. The tlid field is an integer, and the values are 98% unique. There is a second column called ogc_fid which is unique (it is a serial field). I need to extract out unique TLID's (doesn't matter which duplicate I get rid of). To do this I am running this query: SELECT tlid, min(ogc_fid) FROM completechain GROUP BY tlid; The results from explain analyze are: "GroupAggregate (cost=10400373.80..11361807.88 rows=48071704 width=8) (actual time=7311682.715..8315746.835 rows=47599910 loops=1)" " -> Sort (cost=10400373.80..10520553.06 rows=48071704 width=8) (actual time=7311682.682..7972304.777 rows=48199165 loops=1)" " Sort Key: tlid" " -> Seq Scan on completechain (cost=0.00..2228584.04 rows=48071704 width=8) (actual time=27.514..773245.046 rows=48199165 loops=1)" "Total runtime: 8486057.185 ms" Doing a similar query produces the same results: SELECT DISTINCT ON (tlid), tlid, ogc_fid FROM completechain; Note it takes over 10 times longer to do the sort than the full sequential scan. Should I expect results like this? I realize that the computer is quite low-end and is very IO bound for this query, but I'm still surprised that the sort operation takes so long. Out of curiosity, I setup an Oracle database on the same machine with the same data and ran the same query. Oracle was over an order of magnitude faster. Looking at its query plan, it avoided the sort by using "HASH GROUP BY." Does such a construct exist in PostgreSQL (I see only hash joins)? Also as an experiment I forced oracle to do a sort by running this query: SELECT tlid, min(ogc_fid) FROM completechain GROUP BY tlid ORDER BY tlid; Even with this, it was more than a magnitude faster than Postgresql. Which makes me think I have somehow misconfigured postgresql (see the relevant parts of postgresql.conf below). Any idea/help appreciated. Thanks, Charlie ------------------------------- #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #--------------------------------------------------------------------------- shared_buffers = 40000 # 40000 buffers * 8192 bytes/buffer = 327,680,000 bytes #shared_buffers = 1000 # min 16 or max_connections*2, 8KB each temp_buffers = 5000 #temp_buffers = 1000 # min 100, 8KB each #max_prepared_transactions = 5 # can be 0 or more # note: increasing max_prepared_transactions costs ~600 bytes of shared memory # per transaction slot, plus lock space (see max_locks_per_transaction). work_mem = 16384 # in Kb #work_mem = 1024 # min 64, size in KB maintenance_work_mem = 262144 # in kb #maintenance_work_mem = 16384 # min 1024, size in KB #max_stack_depth = 2048 # min 100, size in KB # - Free Space Map - max_fsm_pages = 60000 #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 1000 # min 100, ~70 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' # - Cost-Based Vacuum Delay - #vacuum_cost_delay = 0 # 0-1000 milliseconds #vacuum_cost_page_hit = 1 # 0-10000 credits #vacuum_cost_page_miss = 10 # 0-10000 credits #vacuum_cost_page_dirty = 20 # 0-10000 credits #vacuum_cost_limit = 200 # 0-10000 credits # - Background writer - #bgwriter_delay = 200 # 10-10000 milliseconds between rounds #bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers scanned/round #bgwriter_lru_maxpages = 5 # 0-1000 buffers max written/round #bgwriter_all_percent = 0.333 # 0-100% of all buffers scanned/round #bgwriter_all_maxpages = 5 # 0-1000 buffers max written/round #--------------------------------------------------------------------------- # WRITE AHEAD LOG #--------------------------------------------------------------------------- # - Settings - fsync = on # turns forced synchronization on or off #wal_sync_method = fsync # the default is the first option # supported by the operating system: # open_datasync # fdatasync # fsync # fsync_writethrough # open_sync #full_page_writes = on # recover from partial page writes wal_buffers = 128 #wal_buffers = 8 # min 4, 8KB each #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 # - Checkpoints - checkpoint_segments = 256 # 256 * 16Mb = 4,294,967,296 bytes checkpoint_timeout = 1200 # 1200 seconds (20 minutes) checkpoint_warning = 30 # in seconds, 0 is off #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 300 # range 30-3600, in seconds #checkpoint_warning = 30 # in seconds, 0 is off # - Archiving - #archive_command = '' # command to use to archive a logfile # segment #--------------------------------------------------------------------------- # QUERY TUNING #--------------------------------------------------------------------------- # - Planner Method Configuration - #enable_bitmapscan = on #enable_hashagg = on #enable_hashjoin = on #enable_indexscan = on #enable_mergejoin = on #enable_nestloop = on #enable_seqscan = on #enable_sort = on #enable_tidscan = on # - Planner Cost Constants - effective_cache_size = 80000 # 80000 * 8192 = 655,360,000 bytes #effective_cache_size = 1000 # typically 8KB each random_page_cost = 2.5 # units are one sequential page fetch #random_page_cost = 4 # units are one sequential page fetch # cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) #cpu_operator_cost = 0.0025 # (same) # - Genetic Query Optimizer - #geqo = on #geqo_threshold = 12 #geqo_effort = 5 # range 1-10 #geqo_pool_size = 0 # selects default based on effort #geqo_generations = 0 # selects default based on effort #geqo_selection_bias = 2.0 # range 1.5-2.0 # - Other Planner Options - default_statistics_target = 100 # range 1-1000 #default_statistics_target = 10 # range 1-1000 #constraint_exclusion = off #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit # JOINs #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # RUNTIME STATISTICS #--------------------------------------------------------------------------- # - Statistics Monitoring - #log_parser_stats = off #log_planner_stats = off #log_executor_stats = off #log_statement_stats = off # - Query/Index Statistics Collector - stats_start_collector = on stats_command_string = on stats_block_level = on stats_row_level = on #stats_start_collector = on #stats_command_string = off #stats_block_level = off #stats_row_level = off #stats_reset_on_server_start = off #--------------------------------------------------------------------------- # AUTOVACUUM PARAMETERS #--------------------------------------------------------------------------- autovacuum = true autovacuum_naptime = 600 #autovacuum = false # enable autovacuum subprocess? #autovacuum_naptime = 60 # time between autovacuum runs, in secs #autovacuum_vacuum_threshold = 1000 # min # of tuple updates before # vacuum #autovacuum_analyze_threshold = 500 # min # of tuple updates before # analyze #autovacuum_vacuum_scale_factor = 0.4 # fraction of rel size before # vacuum #autovacuum_analyze_scale_factor = 0.2 # fraction of rel size before # analyze #autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for # autovac, -1 means use # vacuum_cost_delay #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for # autovac, -1 means use # vacuum_cost_ ---------------------- CREATE TABLE tiger.completechain ( ogc_fid int4 NOT NULL DEFAULT nextval('completechain_ogc_fid_seq'::regclass), module varchar(8) NOT NULL, tlid int4 NOT NULL, side1 int4, source varchar(1) NOT NULL, fedirp varchar(2), fename varchar(30), fetype varchar(4), fedirs varchar(2), cfcc varchar(3) NOT NULL, fraddl varchar(11), toaddl varchar(11), fraddr varchar(11), toaddr varchar(11), friaddl varchar(1), toiaddl varchar(1), friaddr varchar(1), toiaddr varchar(1), zipl int4, zipr int4, aianhhfpl int4, aianhhfpr int4, aihhtlil varchar(1), aihhtlir varchar(1), census1 varchar(1), census2 varchar(1), statel int4, stater int4, countyl int4, countyr int4, cousubl int4, cousubr int4, submcdl int4, submcdr int4, placel int4, placer int4, tractl int4, tractr int4, blockl int4, blockr int4, wkb_geometry public.geometry NOT NULL, CONSTRAINT enforce_dims_wkb_geometry CHECK (ndims(wkb_geometry) = 2), CONSTRAINT enforce_geotype_wkb_geometry CHECK (geometrytype(wkb_geometry) = 'LINESTRING'::text OR wkb_geometry IS NULL), CONSTRAINT enforce_srid_wkb_geometry CHECK (srid(wkb_geometry) = 4269) ) WITHOUT OIDS; ALTER TABLE tiger.completechain OWNER TO postgres; From pgsql-performance-owner@postgresql.org Mon Nov 7 22:00:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E1394DA7EB for ; Mon, 7 Nov 2005 21:59:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72938-01 for ; Tue, 8 Nov 2005 01:59:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (mail.heliustech.net [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id 0CB97D9E41 for ; Mon, 7 Nov 2005 21:59:49 -0400 (AST) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id jA81xjt17399; Tue, 8 Nov 2005 09:59:47 +0800 From: "Christian Paul B. Cosinas" To: "'Alvaro Nunes Melo'" , Subject: Re: Temporary Table Date: Tue, 8 Nov 2005 10:04:01 -0000 Message-ID: <008201c5e44b$c0cdf390$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXaGuESJlWsZB6mToaTb7utC7xN7gKMJJlQ In-Reply-To: <435F5F1C.1010703@atua.com.br> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.83 required=5 tests=[AWL=-0.762, DATE_IN_FUTURE_06_12=1.498, URIBL_SBL=1.094] X-Spam-Score: 1.83 X-Spam-Level: * X-Archive-Number: 200511/126 X-Sequence-Number: 15383 In what directory in my linux server will I find these 3 tables? -----Original Message----- From: Alvaro Nunes Melo [mailto:al_nunes@atua.com.br] Sent: Wednesday, October 26, 2005 10:49 AM To: Christian Paul B. Cosinas Subject: Re: [PERFORM] Temporary Table Christian Paul B. Cosinas wrote: >I am creating a temporary table in every function that I execute. >Which I think is bout 100,000 temporary tables a day. > > I think that a lot. ;) >What is the command for vacuuming these 3 tables? > > VACUUM FULL pg_class; VACUUM FULL pg_attribute; VACUUM FULL pg_depend; I'm using this ones. Before using them, take a look in the size that this tables are using in your HD, and compare to what you get after running this commands. I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html From pgsql-performance-owner@postgresql.org Mon Nov 7 22:04:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F33ED9AFA for ; Mon, 7 Nov 2005 22:04:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72156-07 for ; Tue, 8 Nov 2005 02:04:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (mail.heliustech.net [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id 45B2CD8055 for ; Mon, 7 Nov 2005 22:04:43 -0400 (AST) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id jA824g417794; Tue, 8 Nov 2005 10:04:43 +0800 From: "Christian Paul B. Cosinas" To: "'Alvaro Nunes Melo'" , Subject: Re: Temporary Table Date: Tue, 8 Nov 2005 10:09:00 -0000 Message-ID: <008301c5e44c$70eee900$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXaGuESJlWsZB6mToaTb7utC7xN7gKMUdQw In-Reply-To: <435F5F1C.1010703@atua.com.br> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.853 required=5 tests=[AWL=-0.739, DATE_IN_FUTURE_06_12=1.498, URIBL_SBL=1.094] X-Spam-Score: 1.853 X-Spam-Level: * X-Archive-Number: 200511/127 X-Sequence-Number: 15384 I try to run this command in my linux server. VACUUM FULL pg_class; VACUUM FULL pg_attribute; VACUUM FULL pg_depend; But it give me the following error: -bash: VACUUM: command not found I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html From pgsql-performance-owner@postgresql.org Mon Nov 7 22:17:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A6782DAA49 for ; Mon, 7 Nov 2005 22:17:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76871-04 for ; Tue, 8 Nov 2005 02:17:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mailer.eglobalreach.net (mail.heliustech.net [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id 969E4DA48F for ; Mon, 7 Nov 2005 22:17:47 -0400 (AST) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id jA82Hi927629; Tue, 8 Nov 2005 10:17:44 +0800 From: "Christian Paul B. Cosinas" To: "'Joshua D. Drake'" Cc: "'Alvaro Nunes Melo'" , Subject: Re: Temporary Table Date: Tue, 8 Nov 2005 10:22:01 -0000 Message-ID: <008401c5e44e$42600c20$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXkCZ/+hrHRUvOURJiU8IRxQspFigARG0Sw In-Reply-To: <4370091E.8060700@commandprompt.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.917 required=5 tests=[AWL=-0.675, DATE_IN_FUTURE_06_12=1.498, URIBL_SBL=1.094] X-Spam-Score: 1.917 X-Spam-Level: * X-Archive-Number: 200511/131 X-Sequence-Number: 15388 I see. But How Can I put this in the Cron of my Linux Server? I really don't have an idea :) What I want to do is to loop around all the databases in my server and execute the vacuum of these 3 tables in each tables. -----Original Message----- From: Joshua D. Drake [mailto:jd@commandprompt.com] Sent: Tuesday, November 08, 2005 2:11 AM To: Christian Paul B. Cosinas Cc: 'Alvaro Nunes Melo'; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Temporary Table Christian Paul B. Cosinas wrote: > I try to run this command in my linux server. > VACUUM FULL pg_class; > VACUUM FULL pg_attribute; > VACUUM FULL pg_depend; > > But it give me the following error: > -bash: VACUUM: command not found That needs to be run from psql ... > > > > > > I choose Polesoft Lockspam to fight spam, and you? > http://www.polesoft.com/refer.html > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html From pgsql-performance-owner@postgresql.org Tue Nov 8 09:45:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DEBCAD8E2A for ; Tue, 8 Nov 2005 09:45:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92820-02 for ; Tue, 8 Nov 2005 13:45:13 +0000 (GMT) X-Greylist: delayed 03:10:43.862651 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id D39BAD893A for ; Tue, 8 Nov 2005 09:45:11 -0400 (AST) Received: from relay.icomedias.com (office.icomedias.com [62.99.232.80]) by svr2.postgresql.org (Postfix) with ESMTP id A4AD3F0D67 for ; Tue, 8 Nov 2005 10:34:27 +0000 (GMT) Received: from loki.icomedias.com ([10.192.17.128]) by relay.icomedias.com (8.13.4/8.13.4) with ESMTP id jA8AYGDS031660; Tue, 8 Nov 2005 11:34:16 +0100 From: Mario Weilguni To: pgsql-performance@postgresql.org Subject: Re: 8.1 iss Date: Tue, 8 Nov 2005 11:34:19 +0100 User-Agent: KMail/1.8.92 Cc: "PostgreSQL" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200511081134.19495.mweilguni@sime.com> X-Scanned-By: MIMEDefang 2.43 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.269 required=5 tests=[AWL=0.269] X-Spam-Score: 0.269 X-Spam-Level: X-Archive-Number: 200511/139 X-Sequence-Number: 15396 Am Montag, 7. November 2005 18:22 schrieb PostgreSQL: > My most humble apologies to the pg development team (pg_lets?). > > I took Greg Stark's advice and set: > > shared_buffers = 10000 # was 50000 > work_mem = 1048576 # 1Gb - was 16384 > > Also, I noticed that the EXPLAIN ANALYZE consistently thought reads would > take longer than they actually did, so I decreased random_page_cost down to > 1 (the server has a SATA Raid at level 10). Don't do that, use 1.5 or 2, setting it to 1 will only work well if you have small databases fitting completly in memory. From pgsql-performance-owner@postgresql.org Tue Nov 8 07:15:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 40CA0D7FCB for ; Tue, 8 Nov 2005 07:15:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44321-03 for ; Tue, 8 Nov 2005 11:15:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 830D2D7FC7 for ; Tue, 8 Nov 2005 07:15:24 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 5BE90418966; Tue, 8 Nov 2005 11:15:20 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 87F0515EDA; Tue, 8 Nov 2005 11:14:44 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24004-05; Tue, 8 Nov 2005 11:14:42 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id CF29315ED9; Tue, 8 Nov 2005 11:14:41 +0000 (GMT) Message-ID: <437088A1.8090304@archonet.com> Date: Tue, 08 Nov 2005 11:14:41 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Charlie Savage Cc: pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables References: <43704E1D.80708@interserv.com> In-Reply-To: <43704E1D.80708@interserv.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/138 X-Sequence-Number: 15395 Charlie Savage wrote: > Hi everyone, > > I have a question about the performance of sort. > Note it takes over 10 times longer to do the sort than the full > sequential scan. > > Should I expect results like this? I realize that the computer is quite > low-end and is very IO bound for this query, but I'm still surprised > that the sort operation takes so long. The sort will be spilling to disk, which will grind your I/O to a halt. > work_mem = 16384 # in Kb Try upping this. You should be able to issue "set work_mem = 100000" before running your query IIRC. That should let PG do its sorting in larger chunks. Also, if your most common access pattern is ordered via tlid look into clustering the table on that. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Tue Nov 8 12:32:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 90772D6836 for ; Tue, 8 Nov 2005 12:32:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41596-07 for ; Tue, 8 Nov 2005 16:31:56 +0000 (GMT) X-Greylist: delayed 03:11:33.466839 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id A9B1ED7B39 for ; Tue, 8 Nov 2005 12:31:52 -0400 (AST) Received: from mailserver.sandvine.com (sandvine.com [199.243.201.138]) by svr2.postgresql.org (Postfix) with ESMTP id D0E76F105E for ; Tue, 8 Nov 2005 13:20:24 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Sort performance on large tables Date: Tue, 8 Nov 2005 08:19:44 -0500 Message-ID: <2BCEB9A37A4D354AA276774EE13FB8C263B0BF@mailserver.sandvine.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sort performance on large tables Thread-Index: AcXkQ4HduZ54PzCmQ7a8YaRl+VD55AAI1WcA From: "Marc Morin" To: "Charlie Savage" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/141 X-Sequence-Number: 15398 I have run into this type of query problem as well. I solved it in my application by the following type of query. SELECT tlid FROM completechain AS o WHERE not exists (=20 SELECT 1 FROM completechain WHERE tlid=3Do.tlid and ogc_fid!=3Do.ogc_fid ); Assumes of course that you have an index on tlid. > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Charlie Savage > Sent: Tuesday, November 08, 2005 2:05 AM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] Sort performance on large tables >=20 > Hi everyone, >=20 > I have a question about the performance of sort. >=20 > Setup: Dell Dimension 3000, Suse 10, 1GB ram, PostgreSQL 8.1=20 > RC 1 with PostGIS, 1 built-in 80 GB IDE drive, 1 SATA Seagate=20 > 400GB drive. The IDE drive has the OS and the WAL files, the=20 > SATA drive the database.=20 > From hdparm the max IO for the IDE drive is about 50Mb/s and=20 > the SATA drive is about 65Mb/s. Thus a very low-end machine=20 > - but it used just for development (i.e., it is not a=20 > production machine) and the only thing it does is run a=20 > PostgresSQL database. >=20 > I have a staging table called completechain that holds US=20 > tiger data (i.e., streets and addresses for the US). The=20 > table is approximately 18GB. Its big because there is a lot=20 > of data, but also because the table is not normalized (it=20 > comes that way). >=20 > I want to extract data out of the file, with the most=20 > important values being stored in a column called tlid. The=20 > tlid field is an integer, and the values are 98% unique. =20 > There is a second column called ogc_fid which is unique (it=20 > is a serial field). I need to extract out unique TLID's=20 > (doesn't matter which duplicate I get rid of). To do this I=20 > am running this query: >=20 > SELECT tlid, min(ogc_fid) > FROM completechain > GROUP BY tlid; >=20 > The results from explain analyze are: >=20 > "GroupAggregate (cost=3D10400373.80..11361807.88 rows=3D48071704=20 > width=3D8) (actual time=3D7311682.715..8315746.835 rows=3D47599910 = loops=3D1)" > " -> Sort (cost=3D10400373.80..10520553.06 rows=3D48071704=20 > width=3D8) (actual time=3D7311682.682..7972304.777 rows=3D48199165 = loops=3D1)" > " Sort Key: tlid" > " -> Seq Scan on completechain (cost=3D0.00..2228584.04=20 > rows=3D48071704 width=3D8) (actual time=3D27.514..773245.046=20 > rows=3D48199165 loops=3D1)" > "Total runtime: 8486057.185 ms" > =09 > Doing a similar query produces the same results: >=20 > SELECT DISTINCT ON (tlid), tlid, ogc_fid FROM completechain; >=20 > Note it takes over 10 times longer to do the sort than the=20 > full sequential scan. >=20 > Should I expect results like this? I realize that the=20 > computer is quite low-end and is very IO bound for this=20 > query, but I'm still surprised that the sort operation takes so long. >=20 > Out of curiosity, I setup an Oracle database on the same=20 > machine with the same data and ran the same query. Oracle=20 > was over an order of magnitude faster. Looking at its query=20 > plan, it avoided the sort by using "HASH GROUP BY." Does=20 > such a construct exist in PostgreSQL (I see only hash joins)? >=20 > Also as an experiment I forced oracle to do a sort by running=20 > this query: >=20 > SELECT tlid, min(ogc_fid) > FROM completechain > GROUP BY tlid > ORDER BY tlid; >=20 > Even with this, it was more than a magnitude faster than Postgresql.=20 > Which makes me think I have somehow misconfigured postgresql=20 > (see the relevant parts of postgresql.conf below). >=20 > Any idea/help appreciated. >=20 > Thanks, >=20 > Charlie >=20 >=20 > ------------------------------- >=20 > #------------------------------------------------------------- > -------------- > # RESOURCE USAGE (except WAL) > #------------------------------------------------------------- > -------------- >=20 > shared_buffers =3D 40000 # 40000 buffers * 8192=20 > bytes/buffer =3D 327,680,000 bytes > #shared_buffers =3D 1000 # min 16 or=20 > max_connections*2, 8KB each >=20 > temp_buffers =3D 5000 > #temp_buffers =3D 1000 # min 100, 8KB each > #max_prepared_transactions =3D 5 # can be 0 or more > # note: increasing max_prepared_transactions costs ~600 bytes=20 > of shared memory # per transaction slot, plus lock space (see=20 > max_locks_per_transaction). >=20 > work_mem =3D 16384 # in Kb > #work_mem =3D 1024 # min 64, size in KB >=20 > maintenance_work_mem =3D 262144 # in kb > #maintenance_work_mem =3D 16384 # min 1024, size in KB > #max_stack_depth =3D 2048 # min 100, size in KB >=20 > # - Free Space Map - >=20 > max_fsm_pages =3D 60000=09 > #max_fsm_pages =3D 20000 # min=20 > max_fsm_relations*16, 6 bytes each >=20 > #max_fsm_relations =3D 1000 # min 100, ~70 bytes each >=20 > # - Kernel Resource Usage - >=20 > #max_files_per_process =3D 1000 # min 25 > #preload_libraries =3D '' >=20 > # - Cost-Based Vacuum Delay - >=20 > #vacuum_cost_delay =3D 0 # 0-1000 milliseconds > #vacuum_cost_page_hit =3D 1 # 0-10000 credits > #vacuum_cost_page_miss =3D 10 # 0-10000 credits > #vacuum_cost_page_dirty =3D 20 # 0-10000 credits > #vacuum_cost_limit =3D 200 # 0-10000 credits >=20 > # - Background writer - >=20 > #bgwriter_delay =3D 200 # 10-10000 milliseconds=20 > between rounds > #bgwriter_lru_percent =3D 1.0 # 0-100% of LRU buffers=20 > scanned/round > #bgwriter_lru_maxpages =3D 5 # 0-1000 buffers max=20 > written/round > #bgwriter_all_percent =3D 0.333 # 0-100% of all buffers=20 > scanned/round > #bgwriter_all_maxpages =3D 5 # 0-1000 buffers max=20 > written/round >=20 >=20 > #------------------------------------------------------------- > -------------- > # WRITE AHEAD LOG > #------------------------------------------------------------- > -------------- >=20 > # - Settings - >=20 > fsync =3D on # turns forced=20 > synchronization on or off > #wal_sync_method =3D fsync # the default is the=20 > first option > # supported by the=20 > operating system: > # open_datasync > # fdatasync > # fsync > # fsync_writethrough > # open_sync > #full_page_writes =3D on # recover from=20 > partial page writes >=20 > wal_buffers =3D 128 > #wal_buffers =3D 8 # min 4, 8KB each >=20 > #commit_delay =3D 0 # range 0-100000, in=20 > microseconds > #commit_siblings =3D 5 # range 1-1000 >=20 > # - Checkpoints - >=20 > checkpoint_segments =3D 256 # 256 * 16Mb =3D=20 > 4,294,967,296 bytes > checkpoint_timeout =3D 1200 # 1200 seconds (20 minutes) > checkpoint_warning =3D 30 # in seconds, 0 is off >=20 > #checkpoint_segments =3D 3 # in logfile segments,=20 > min 1, 16MB each > #checkpoint_timeout =3D 300 # range 30-3600, in seconds > #checkpoint_warning =3D 30 # in seconds, 0 is off >=20 > # - Archiving - >=20 > #archive_command =3D '' # command to use to=20 > archive a logfile > # segment >=20 >=20 > #------------------------------------------------------------- > -------------- > # QUERY TUNING > #------------------------------------------------------------- > -------------- >=20 > # - Planner Method Configuration - >=20 > #enable_bitmapscan =3D on > #enable_hashagg =3D on > #enable_hashjoin =3D on > #enable_indexscan =3D on > #enable_mergejoin =3D on > #enable_nestloop =3D on > #enable_seqscan =3D on > #enable_sort =3D on > #enable_tidscan =3D on >=20 > # - Planner Cost Constants - >=20 > effective_cache_size =3D 80000 # 80000 * 8192 =3D=20 > 655,360,000 bytes > #effective_cache_size =3D 1000 # typically 8KB each >=20 > random_page_cost =3D 2.5 # units are one=20 > sequential page fetch > #random_page_cost =3D 4 # units are one=20 > sequential page fetch > # cost > #cpu_tuple_cost =3D 0.01 # (same) > #cpu_index_tuple_cost =3D 0.001 # (same) > #cpu_operator_cost =3D 0.0025 # (same) >=20 > # - Genetic Query Optimizer - >=20 > #geqo =3D on > #geqo_threshold =3D 12 > #geqo_effort =3D 5 # range 1-10 > #geqo_pool_size =3D 0 # selects default based=20 > on effort > #geqo_generations =3D 0 # selects default based=20 > on effort > #geqo_selection_bias =3D 2.0 # range 1.5-2.0 >=20 > # - Other Planner Options - >=20 > default_statistics_target =3D 100 # range 1-1000 > #default_statistics_target =3D 10 # range 1-1000 > #constraint_exclusion =3D off > #from_collapse_limit =3D 8 > #join_collapse_limit =3D 8 # 1 disables collapsing=20 > of explicit > # JOINs >=20 >=20 > #------------------------------------------------------------- > -------------- > #------------------------------------------------------------- > -------------- > # RUNTIME STATISTICS > #------------------------------------------------------------- > -------------- >=20 > # - Statistics Monitoring - >=20 > #log_parser_stats =3D off > #log_planner_stats =3D off > #log_executor_stats =3D off > #log_statement_stats =3D off >=20 > # - Query/Index Statistics Collector - >=20 > stats_start_collector =3D on > stats_command_string =3D on > stats_block_level =3D on > stats_row_level =3D on >=20 > #stats_start_collector =3D on > #stats_command_string =3D off > #stats_block_level =3D off > #stats_row_level =3D off > #stats_reset_on_server_start =3D off >=20 >=20 > #------------------------------------------------------------- > -------------- > # AUTOVACUUM PARAMETERS > #------------------------------------------------------------- > -------------- >=20 > autovacuum =3D true > autovacuum_naptime =3D 600 >=20 > #autovacuum =3D false # enable autovacuum subprocess? > #autovacuum_naptime =3D 60 # time between=20 > autovacuum runs, in secs > #autovacuum_vacuum_threshold =3D 1000 # min # of tuple updates before > # vacuum > #autovacuum_analyze_threshold =3D 500 # min # of tuple updates before > # analyze > #autovacuum_vacuum_scale_factor =3D 0.4 # fraction of rel size before > # vacuum > #autovacuum_analyze_scale_factor =3D 0.2 # fraction of=20 > rel size before > # analyze > #autovacuum_vacuum_cost_delay =3D -1 # default vacuum cost delay for > # autovac, -1 means use > # vacuum_cost_delay > #autovacuum_vacuum_cost_limit =3D -1 # default vacuum cost limit for > # autovac, -1 means use > # vacuum_cost_ >=20 >=20 > ---------------------- >=20 > CREATE TABLE tiger.completechain > ( > ogc_fid int4 NOT NULL DEFAULT > nextval('completechain_ogc_fid_seq'::regclass), > module varchar(8) NOT NULL, > tlid int4 NOT NULL, > side1 int4, > source varchar(1) NOT NULL, > fedirp varchar(2), > fename varchar(30), > fetype varchar(4), > fedirs varchar(2), > cfcc varchar(3) NOT NULL, > fraddl varchar(11), > toaddl varchar(11), > fraddr varchar(11), > toaddr varchar(11), > friaddl varchar(1), > toiaddl varchar(1), > friaddr varchar(1), > toiaddr varchar(1), > zipl int4, > zipr int4, > aianhhfpl int4, > aianhhfpr int4, > aihhtlil varchar(1), > aihhtlir varchar(1), > census1 varchar(1), > census2 varchar(1), > statel int4, > stater int4, > countyl int4, > countyr int4, > cousubl int4, > cousubr int4, > submcdl int4, > submcdr int4, > placel int4, > placer int4, > tractl int4, > tractr int4, > blockl int4, > blockr int4, > wkb_geometry public.geometry NOT NULL, > CONSTRAINT enforce_dims_wkb_geometry CHECK=20 > (ndims(wkb_geometry) =3D 2), > CONSTRAINT enforce_geotype_wkb_geometry CHECK > (geometrytype(wkb_geometry) =3D 'LINESTRING'::text OR=20 > wkb_geometry IS NULL), > CONSTRAINT enforce_srid_wkb_geometry CHECK=20 > (srid(wkb_geometry) =3D 4269) > ) > WITHOUT OIDS; > ALTER TABLE tiger.completechain OWNER TO postgres; >=20 >=20 >=20 >=20 >=20 >=20 > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >=20 >=20 From pgsql-performance-owner@postgresql.org Tue Nov 8 12:25:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 76961D7AEE for ; Tue, 8 Nov 2005 12:25:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40867-07 for ; Tue, 8 Nov 2005 16:25:05 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id CD7D6D7AE4 for ; Tue, 8 Nov 2005 12:25:05 -0400 (AST) Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr2.postgresql.org (Postfix) with ESMTP id E0662F1012 for ; Tue, 8 Nov 2005 16:25:04 +0000 (GMT) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 08 Nov 2005 11:24:58 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 8 Nov 2005 11:24:05 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Sort performance on large tables Date: Tue, 8 Nov 2005 11:21:39 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D0193B9F0@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sort performance on large tables Thread-Index: AcXkQ7vIMS+Ti1G7TxaOjDuOZh5zCQAO+Ixg From: "Luke Lonergan" To: "Charlie Savage" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 08 Nov 2005 16:24:05.0378 (UTC) FILETIME=[D6646E20:01C5E480] X-WSS-ID: 6F6E0ED02RS1149045-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/140 X-Sequence-Number: 15397 Charlie,=20 > Should I expect results like this? I realize that the=20 > computer is quite low-end and is very IO bound for this=20 > query, but I'm still surprised that the sort operation takes so long. It's the sort performance of Postgres that's your problem. =20 > Out of curiosity, I setup an Oracle database on the same=20 > machine with the same data and ran the same query. Oracle=20 > was over an order of magnitude faster. Looking at its query=20 > plan, it avoided the sort by using "HASH GROUP BY." Does=20 > such a construct exist in PostgreSQL (I see only hash joins)? Yes, hashaggregate does a similar thing. You can force the planner to do it, don't remember off the top of my head but someone else on-list will. =20 > Also as an experiment I forced oracle to do a sort by running=20 > this query: >=20 > SELECT tlid, min(ogc_fid) > FROM completechain > GROUP BY tlid > ORDER BY tlid; >=20 > Even with this, it was more than a magnitude faster than Postgresql.=20 > Which makes me think I have somehow misconfigured postgresql=20 > (see the relevant parts of postgresql.conf below). Just as we find with a similar comparison (with a "popular commercial, proprietary database" :-) Though some might suggest you increase work_mem or other tuning suggestions to speed sorting, none work. In fact, we find that increasing work_mem actually slows sorting slightly. We are commissioning an improved sorting routine for bizgres (www.bizgres.org) which will be contributed to the postgres main, but won't come out at least until 8.2 comes out, possibly 12 mos. In the meantime, you will be able to use the new routine in the bizgres version of postgres, possibly in the next couple of months. Also - we (Greenplum) are about to announce the public beta of the bizgres MPP database, which will use all of your CPUs, and those of other nodes in a cluster, for sorting. We see a linear scaling of sort performance, so you could add CPUs and/or hosts and scale out of the problem. Cheers, - Luke From pgsql-performance-owner@postgresql.org Tue Nov 8 13:56:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F11CDD8EE1 for ; Tue, 8 Nov 2005 13:55:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67786-02 for ; Tue, 8 Nov 2005 17:55:57 +0000 (GMT) X-Greylist: delayed 00:17:34.809212 by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 55698D8EB7 for ; Tue, 8 Nov 2005 13:55:57 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id D4B5E35512; Tue, 8 Nov 2005 09:38:21 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D30C6354F1; Tue, 8 Nov 2005 09:38:21 -0800 (PST) Date: Tue, 8 Nov 2005 09:38:21 -0800 (PST) From: Stephan Szabo To: Luke Lonergan Cc: Charlie Savage , pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables In-Reply-To: <3E37B936B592014B978C4415F90D662D0193B9F0@MI8NYCMAIL06.Mi8.com> Message-ID: <20051108093500.N31541@megazone.bigpanda.com> References: <3E37B936B592014B978C4415F90D662D0193B9F0@MI8NYCMAIL06.Mi8.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/142 X-Sequence-Number: 15399 On Tue, 8 Nov 2005, Luke Lonergan wrote: > > SELECT tlid, min(ogc_fid) > > FROM completechain > > GROUP BY tlid > > ORDER BY tlid; > > > > Even with this, it was more than a magnitude faster than Postgresql. > > Which makes me think I have somehow misconfigured postgresql > > (see the relevant parts of postgresql.conf below). > > Just as we find with a similar comparison (with a "popular commercial, > proprietary database" :-) Though some might suggest you increase > work_mem or other tuning suggestions to speed sorting, none work. In > fact, we find that increasing work_mem actually slows sorting slightly. I wish you'd qualify your statements, because I can demonstrably show that I can make sorts go faster on my machine at least by increasing work_mem under some conditions. From pgsql-performance-owner@postgresql.org Tue Nov 8 15:10:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A176D7CE2 for ; Tue, 8 Nov 2005 15:10:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88771-03 for ; Tue, 8 Nov 2005 19:10:52 +0000 (GMT) X-Greylist: delayed 02:45:48.137469 by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id 0E14AD7B14 for ; Tue, 8 Nov 2005 15:10:52 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Tue, 08 Nov 2005 14:10:43 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 8 Nov 2005 14:09:09 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 8 Nov 2005 14:09:08 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 08 Nov 2005 11:09:07 -0800 Subject: Re: Sort performance on large tables From: "Luke Lonergan" To: "Stephan Szabo" , "Simon Riggs" , "Kurt Harriman" Cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Sort performance on large tables Thread-Index: AcXki0Y6Ii/3K6rFQ2e9hfcWTSaFmAADJ39f In-Reply-To: <20051108093500.N31541@megazone.bigpanda.com> MIME-Version: 1.0 X-OriginalArrivalTime: 08 Nov 2005 19:09:09.0403 (UTC) FILETIME=[E5A6B6B0:01C5E497] X-WSS-ID: 6F6E27B92BW4092657-09-01 Content-Type: multipart/alternative; boundary=B_3214292948_8404042 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.408 required=5 tests=[AWL=0.154, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.408 X-Spam-Level: * X-Archive-Number: 200511/143 X-Sequence-Number: 15400 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214292948_8404042 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Stephan, On 11/8/05 9:38 AM, "Stephan Szabo" wrote: >> > >> > Just as we find with a similar comparison (with a "popular commercial, >> > proprietary database" :-) Though some might suggest you increase >> > work_mem or other tuning suggestions to speed sorting, none work. In >> > fact, we find that increasing work_mem actually slows sorting slightly= . >=20 > I wish you'd qualify your statements, because I can demonstrably show tha= t > I can make sorts go faster on my machine at least by increasing work_mem > under some conditions. >=20 Cool =AD can you provide your test case please? I=B9ll ask our folks to do the same, but as I recall we did some pretty thorough testing and found that it doesn=B9t help. Moreover, the conclusion was that the current algorithm isn=B9= t designed to use memory effectively. Recognize also that we=B9re looking for a factor of 10 or more improvement here =AD this is not a small increase that=B9s needed. - Luke --B_3214292948_8404042 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Re: [PERFORM] Sort performance on large tables Steph= an,

On 11/8/05 9:38 AM, "Stephan Szabo" <sszabo@megazone.bigpanda.= com> wrote:

>
> Just as we find with a similar comparison (with a "popular commer= cial,
> proprietary database" :-) Though some might suggest you increase<= BR> > work_mem or other tuning suggestions to speed sorting, none work. &nbs= p;In
> fact, we find that increasing work_mem actually slows sorting slightly= .

I wish you'd qualify your statements, because I can demonstrably show that<= BR> I can make sorts go faster on my machine at least by increasing work_mem under some conditions.

Cool – can you provide your test case please? &n= bsp;I’ll ask our folks to do the same, but as I recall we did some pre= tty thorough testing and found that it doesn’t help.  Moreover, t= he conclusion was that the current algorithm isn’t designed to use mem= ory effectively.

Recognize also that we’re looking for a factor of 10 or more improvem= ent here – this is not a small increase that’s needed.

- Luke
--B_3214292948_8404042-- From pgsql-performance-owner@postgresql.org Tue Nov 8 16:48:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D8493D6815 for ; Tue, 8 Nov 2005 16:48:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17309-02 for ; Tue, 8 Nov 2005 20:48:43 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 7BF60D6805 for ; Tue, 8 Nov 2005 16:48:44 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 09B8835630; Tue, 8 Nov 2005 12:48:45 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id C91743562E; Tue, 8 Nov 2005 12:48:45 -0800 (PST) Date: Tue, 8 Nov 2005 12:48:45 -0800 (PST) From: Stephan Szabo To: Luke Lonergan Cc: Simon Riggs , Kurt Harriman , pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables In-Reply-To: Message-ID: <20051108124255.Y43056@megazone.bigpanda.com> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/144 X-Sequence-Number: 15401 On Tue, 8 Nov 2005, Luke Lonergan wrote: > Stephan, > > On 11/8/05 9:38 AM, "Stephan Szabo" wrote: > > >> > > >> > Just as we find with a similar comparison (with a "popular commercia= l, > >> > proprietary database" :-) Though some might suggest you increase > >> > work_mem or other tuning suggestions to speed sorting, none work. I= n > >> > fact, we find that increasing work_mem actually slows sorting slight= ly. > > > > I wish you'd qualify your statements, because I can demonstrably show t= hat > > I can make sorts go faster on my machine at least by increasing work_me= m > > under some conditions. > > > Cool =AD can you provide your test case please? I probably should have added the wink smiley to make it obvious I was talking about the simplest case, things that don't fit in work_mem at the current level but for which it's easy to raise work_mem to cover. It's not a big a gain as one might hope, but it does certainly drop again. > Recognize also that we=B9re looking for a factor of 10 or more improvemen= t > here =AD this is not a small increase that=B9s needed. I agree that we definately need help on that regard. I do see the effect where raising work_mem lowers the performance up until that point. I just think that it requires more care in the discussion than disregarding the suggestions entirely especially since people are going to see this in the archives. From pgsql-performance-owner@postgresql.org Tue Nov 8 18:06:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 19995D7AFA for ; Tue, 8 Nov 2005 18:06:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35197-10 for ; Tue, 8 Nov 2005 22:06:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id E4F59D6873 for ; Tue, 8 Nov 2005 18:06:07 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B6BFC31059; Tue, 8 Nov 2005 23:06:08 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Re: Sort performance on large tables Date: Tue, 08 Nov 2005 15:06:04 -0700 Organization: Hub.Org Networking Services Lines: 82 Message-ID: References: <43704E1D.80708@interserv.com> <437088A1.8090304@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <437088A1.8090304@archonet.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/145 X-Sequence-Number: 15402 Thanks everyone for the feedback. I tried increasing work_mem: set work_mem to 300000; select tlid, min(ogc_fid) from completechain group by tld; The results are: "GroupAggregate (cost=9041602.80..10003036.88 rows=48071704 width=8) (actual time=4371749.523..5106162.256 rows=47599910 loops=1)" " -> Sort (cost=9041602.80..9161782.06 rows=48071704 width=8) (actual time=4371690.894..4758660.433 rows=48199165 loops=1)" " Sort Key: tlid" " -> Seq Scan on completechain (cost=0.00..2228584.04 rows=48071704 width=8) (actual time=49.518..805234.970 rows=48199165 loops=1)" "Total runtime: 5279988.127 ms" Thus the time decreased from 8486 seconds to 5279 seconds - which is a nice improvement. However, that still leaves postgresql about 9 times slower. I tried increasing work_mem up to 500000, but at that point the machine started using its swap partition and performance degraded back to the original values. Charlie Richard Huxton wrote: > Charlie Savage wrote: >> Hi everyone, >> >> I have a question about the performance of sort. > >> Note it takes over 10 times longer to do the sort than the full >> sequential scan. >> >> Should I expect results like this? I realize that the computer is >> quite low-end and is very IO bound for this query, but I'm still >> surprised that the sort operation takes so long. > > The sort will be spilling to disk, which will grind your I/O to a halt. > >> work_mem = 16384 # in Kb > > Try upping this. You should be able to issue "set work_mem = 100000" > before running your query IIRC. That should let PG do its sorting in > larger chunks. > > Also, if your most common access pattern is ordered via tlid look into > clustering the table on that. Richard Huxton wrote: > Charlie Savage wrote: >> Hi everyone, >> >> I have a question about the performance of sort. > >> Note it takes over 10 times longer to do the sort than the full >> sequential scan. >> >> Should I expect results like this? I realize that the computer is >> quite low-end and is very IO bound for this query, but I'm still >> surprised that the sort operation takes so long. > > The sort will be spilling to disk, which will grind your I/O to a halt. > >> work_mem = 16384 # in Kb > > Try upping this. You should be able to issue "set work_mem = 100000" > before running your query IIRC. That should let PG do its sorting in > larger chunks. > > Also, if your most common access pattern is ordered via tlid look into > clustering the table on that. From pgsql-performance-owner@postgresql.org Tue Nov 8 18:26:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CED60D7AFA for ; Tue, 8 Nov 2005 18:26:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42847-09 for ; Tue, 8 Nov 2005 22:26:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 64462D79A1 for ; Tue, 8 Nov 2005 18:26:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jA8MQL3u009450; Tue, 8 Nov 2005 17:26:22 -0500 (EST) To: Charlie Savage Cc: pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables In-reply-to: References: <43704E1D.80708@interserv.com> <437088A1.8090304@archonet.com> Comments: In-reply-to Charlie Savage message dated "Tue, 08 Nov 2005 15:06:04 -0700" Date: Tue, 08 Nov 2005 17:26:21 -0500 Message-ID: <9449.1131488781@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/146 X-Sequence-Number: 15403 Charlie Savage writes: > Thus the time decreased from 8486 seconds to 5279 seconds - which is a > nice improvement. However, that still leaves postgresql about 9 times > slower. BTW, what data type are you sorting, exactly? If it's a string type, what is your LC_COLLATE setting? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 8 22:31:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A77FD8A09 for ; Tue, 8 Nov 2005 22:31:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13195-04 for ; Wed, 9 Nov 2005 02:31:40 +0000 (GMT) X-Greylist: delayed 03:04:39.163601 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 8E165D86DA for ; Tue, 8 Nov 2005 22:31:42 -0400 (AST) Received: from chilco.textdrive.com (chilco.textdrive.com [207.7.108.242]) by svr2.postgresql.org (Postfix) with ESMTP id 5CC8BF0D05 for ; Tue, 8 Nov 2005 23:27:05 +0000 (GMT) Received: from [192.168.15.103] (pcp0012204803pcs.blairblvd.tn.nash.comcast.net [69.245.49.69]) by chilco.textdrive.com (Postfix) with ESMTP id BBD8EDAC46; Tue, 8 Nov 2005 23:27:07 +0000 (UTC) In-Reply-To: <436FC767.1010702@telogis.com> References: <436FC767.1010702@telogis.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <80733A02-C543-4F12-93C3-9DE328522E21@sitening.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "Thomas F. O'Connell" Subject: Re: Figuring out which command failed Date: Tue, 8 Nov 2005 17:26:28 -0600 To: Ralph Mason X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.015 required=5 tests=[AWL=0.015] X-Spam-Score: 0.015 X-Spam-Level: X-Archive-Number: 200511/150 X-Sequence-Number: 15407 On Nov 7, 2005, at 3:30 PM, Ralph Mason wrote: > Hi, > > I have a transaction that has multiple separate command in it > (nothing unusual there). > > However sometimes one of the sql statements will fail and so the > whole transaction fails. > > In some cases I could fix the failing statement if only I knew > which one it was. Can anyone think of any way to get which > statement actually failed from the error message? If the error > message gave me the line of the failure it would be excellent, but > it doesn't. Perhaps it would be easy for me to patch my version of > Postgres to do that? > > I realize I could do this with 2 phase commit, but that isn't ready > yet! > > Any thoughts or ideas are much appreciated > > Thanks > Ralph 2PC might not've been ready yesterday, but it's ready today! http://www.postgresql.org/docs/whatsnew -- Thomas F. O'Connell Database Architecture and Programming Co-Founder Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-469-5150 615-469-5151 (fax) From pgsql-performance-owner@postgresql.org Tue Nov 8 19:47:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6AAD5D7AFA for ; Tue, 8 Nov 2005 19:47:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59607-10 for ; Tue, 8 Nov 2005 23:47:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id C2EC5D6805 for ; Tue, 8 Nov 2005 19:47:11 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 358FD31059; Wed, 9 Nov 2005 00:47:13 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Re: Sort performance on large tables Date: Tue, 08 Nov 2005 16:47:10 -0700 Organization: Hub.Org Networking Services Lines: 18 Message-ID: References: <43704E1D.80708@interserv.com> <437088A1.8090304@archonet.com> <9449.1131488781@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <9449.1131488781@sss.pgh.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/147 X-Sequence-Number: 15404 Its an int4. Charlie Tom Lane wrote: > Charlie Savage writes: >> Thus the time decreased from 8486 seconds to 5279 seconds - which is a >> nice improvement. However, that still leaves postgresql about 9 times >> slower. > > BTW, what data type are you sorting, exactly? If it's a string type, > what is your LC_COLLATE setting? > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Tue Nov 8 21:47:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E9D10D8722 for ; Tue, 8 Nov 2005 21:47:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97330-09 for ; Wed, 9 Nov 2005 01:47:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id B0C8DD86DA for ; Tue, 8 Nov 2005 21:47:48 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 9F2412506B; Wed, 9 Nov 2005 09:47:51 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 5B8AC24FF7; Wed, 9 Nov 2005 09:47:50 +0800 (WST) Message-ID: <437155B3.3050507@familyhealth.com.au> Date: Wed, 09 Nov 2005 09:49:39 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Charlie Savage Cc: pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables References: <43704E1D.80708@interserv.com> <437088A1.8090304@archonet.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200511/148 X-Sequence-Number: 15405 I'd set up a trigger to maintain summary tables perhaps... Chris Charlie Savage wrote: > Thanks everyone for the feedback. > > I tried increasing work_mem: > > set work_mem to 300000; > > select tlid, min(ogc_fid) > from completechain > group by tld; > > The results are: > > "GroupAggregate (cost=9041602.80..10003036.88 rows=48071704 width=8) > (actual time=4371749.523..5106162.256 rows=47599910 loops=1)" > " -> Sort (cost=9041602.80..9161782.06 rows=48071704 width=8) (actual > time=4371690.894..4758660.433 rows=48199165 loops=1)" > " Sort Key: tlid" > " -> Seq Scan on completechain (cost=0.00..2228584.04 > rows=48071704 width=8) (actual time=49.518..805234.970 rows=48199165 > loops=1)" > "Total runtime: 5279988.127 ms" > > Thus the time decreased from 8486 seconds to 5279 seconds - which is a > nice improvement. However, that still leaves postgresql about 9 times > slower. > > I tried increasing work_mem up to 500000, but at that point the machine > started using its swap partition and performance degraded back to the > original values. > > Charlie > > > Richard Huxton wrote: > > Charlie Savage wrote: > >> Hi everyone, > >> > >> I have a question about the performance of sort. > > > >> Note it takes over 10 times longer to do the sort than the full > >> sequential scan. > >> > >> Should I expect results like this? I realize that the computer is > >> quite low-end and is very IO bound for this query, but I'm still > >> surprised that the sort operation takes so long. > > > > The sort will be spilling to disk, which will grind your I/O to a halt. > > > >> work_mem = 16384 # in Kb > > > > Try upping this. You should be able to issue "set work_mem = 100000" > > before running your query IIRC. That should let PG do its sorting in > > larger chunks. > > > > Also, if your most common access pattern is ordered via tlid look into > > clustering the table on that. > > > > Richard Huxton wrote: > >> Charlie Savage wrote: >> >>> Hi everyone, >>> >>> I have a question about the performance of sort. >> >> >>> Note it takes over 10 times longer to do the sort than the full >>> sequential scan. >>> >>> Should I expect results like this? I realize that the computer is >>> quite low-end and is very IO bound for this query, but I'm still >>> surprised that the sort operation takes so long. >> >> >> The sort will be spilling to disk, which will grind your I/O to a halt. >> >>> work_mem = 16384 # in Kb >> >> >> Try upping this. You should be able to issue "set work_mem = 100000" >> before running your query IIRC. That should let PG do its sorting in >> larger chunks. >> >> Also, if your most common access pattern is ordered via tlid look into >> clustering the table on that. > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Nov 8 22:23:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 411D2D6805 for ; Tue, 8 Nov 2005 22:23:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10550-04 for ; Wed, 9 Nov 2005 02:23:47 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by svr1.postgresql.org (Postfix) with ESMTP id B3877D6815 for ; Tue, 8 Nov 2005 22:23:49 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 14so55168nzn for ; Tue, 08 Nov 2005 18:23:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=UFRu4mL3QwpjxxqgJ4oKWvgDGd42DD/w0aWBjYe2KyYtkVRQXWMNvBlODcyMDpR0OQUmHZ1GQGN+CZ4EzKbcU2JxkVWLctSHaOt29eNV1IVV1odvvQK8bMRCkVIRbCC3lNV1Kfy5sCGjFgLLyVafiQCc5CwXlCF45rg+DgCFhIw= Received: by 10.36.252.24 with SMTP id z24mr124565nzh; Tue, 08 Nov 2005 18:23:54 -0800 (PST) Received: by 10.36.252.36 with HTTP; Tue, 8 Nov 2005 18:23:54 -0800 (PST) Message-ID: Date: Wed, 9 Nov 2005 10:23:54 +0800 From: William Lai To: pgsql-performance@postgresql.org Subject: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10573_10962096.1131503034224" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.975 required=5 tests=[HTML_MESSAGE=0.001, HTML_SHORT_LENGTH=0.629, MISSING_SUBJECT=1.345] X-Spam-Score: 1.975 X-Spam-Level: * X-Archive-Number: 200511/149 X-Sequence-Number: 15406 ------=_Part_10573_10962096.1131503034224 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline unsubscribe ------=_Part_10573_10962096.1131503034224 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline unsubscribe ------=_Part_10573_10962096.1131503034224-- From pgsql-performance-owner@postgresql.org Wed Nov 9 01:49:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3A8C7D8E00 for ; Wed, 9 Nov 2005 01:49:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66145-08 for ; Wed, 9 Nov 2005 05:49:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id A904AD8B0C for ; Wed, 9 Nov 2005 01:49:51 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0733831058; Wed, 9 Nov 2005 06:49:51 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Re: Sort performance on large tables Date: Tue, 08 Nov 2005 22:49:43 -0700 Organization: Hub.Org Networking Services Lines: 412 Message-ID: <43718DF7.6060609@interserv.com> References: <2BCEB9A37A4D354AA276774EE13FB8C263B0BF@mailserver.sandvine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Marc Morin User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <2BCEB9A37A4D354AA276774EE13FB8C263B0BF@mailserver.sandvine.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/151 X-Sequence-Number: 15408 Very interesting technique. It doesn't actually do quite what I want since it returns all rows that do not have duplicates and not a complete list of unique tlid values. But I could massage it to do what I want. Anyway, the timing: "Seq Scan on completechain t1 (cost=0.00..218139733.60 rows=24099582 width=4) (actual time=25.890..3404650.452 rows=47000655 loops=1)" " Filter: (NOT (subplan))" " SubPlan" " -> Index Scan using idx_completechain_tlid on completechain t2 (cost=0.00..4.48 rows=1 width=0) (actual time=0.059..0.059 rows=0 loops=48199165)" " Index Cond: ($0 = tlid)" " Filter: ($1 <> ogc_fid)" "Total runtime: 3551423.162 ms" Marc Morin wrote: So a 60% reduction in time. Thanks again for the tip. Charlie > I have run into this type of query problem as well. I solved it in my > application by the following type of query. > > > Assumes of course that you have an index on tlid. > >> -----Original Message----- >> From: pgsql-performance-owner@postgresql.org >> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of >> Charlie Savage >> Sent: Tuesday, November 08, 2005 2:05 AM >> To: pgsql-performance@postgresql.org >> Subject: [PERFORM] Sort performance on large tables >> >> Hi everyone, >> >> I have a question about the performance of sort. >> >> Setup: Dell Dimension 3000, Suse 10, 1GB ram, PostgreSQL 8.1 >> RC 1 with PostGIS, 1 built-in 80 GB IDE drive, 1 SATA Seagate >> 400GB drive. The IDE drive has the OS and the WAL files, the >> SATA drive the database. >> From hdparm the max IO for the IDE drive is about 50Mb/s and >> the SATA drive is about 65Mb/s. Thus a very low-end machine >> - but it used just for development (i.e., it is not a >> production machine) and the only thing it does is run a >> PostgresSQL database. >> >> I have a staging table called completechain that holds US >> tiger data (i.e., streets and addresses for the US). The >> table is approximately 18GB. Its big because there is a lot >> of data, but also because the table is not normalized (it >> comes that way). >> >> I want to extract data out of the file, with the most >> important values being stored in a column called tlid. The >> tlid field is an integer, and the values are 98% unique. >> There is a second column called ogc_fid which is unique (it >> is a serial field). I need to extract out unique TLID's >> (doesn't matter which duplicate I get rid of). To do this I >> am running this query: >> >> SELECT tlid, min(ogc_fid) >> FROM completechain >> GROUP BY tlid; >> >> The results from explain analyze are: >> >> "GroupAggregate (cost=10400373.80..11361807.88 rows=48071704 >> width=8) (actual time=7311682.715..8315746.835 rows=47599910 loops=1)" >> " -> Sort (cost=10400373.80..10520553.06 rows=48071704 >> width=8) (actual time=7311682.682..7972304.777 rows=48199165 loops=1)" >> " Sort Key: tlid" >> " -> Seq Scan on completechain (cost=0.00..2228584.04 >> rows=48071704 width=8) (actual time=27.514..773245.046 >> rows=48199165 loops=1)" >> "Total runtime: 8486057.185 ms" >> >> Doing a similar query produces the same results: >> >> SELECT DISTINCT ON (tlid), tlid, ogc_fid FROM completechain; >> >> Note it takes over 10 times longer to do the sort than the >> full sequential scan. >> >> Should I expect results like this? I realize that the >> computer is quite low-end and is very IO bound for this >> query, but I'm still surprised that the sort operation takes so long. >> >> Out of curiosity, I setup an Oracle database on the same >> machine with the same data and ran the same query. Oracle >> was over an order of magnitude faster. Looking at its query >> plan, it avoided the sort by using "HASH GROUP BY." Does >> such a construct exist in PostgreSQL (I see only hash joins)? >> >> Also as an experiment I forced oracle to do a sort by running >> this query: >> >> SELECT tlid, min(ogc_fid) >> FROM completechain >> GROUP BY tlid >> ORDER BY tlid; >> >> Even with this, it was more than a magnitude faster than Postgresql. >> Which makes me think I have somehow misconfigured postgresql >> (see the relevant parts of postgresql.conf below). >> >> Any idea/help appreciated. >> >> Thanks, >> >> Charlie >> >> >> ------------------------------- >> >> #------------------------------------------------------------- >> -------------- >> # RESOURCE USAGE (except WAL) >> #------------------------------------------------------------- >> -------------- >> >> shared_buffers = 40000 # 40000 buffers * 8192 >> bytes/buffer = 327,680,000 bytes >> #shared_buffers = 1000 # min 16 or >> max_connections*2, 8KB each >> >> temp_buffers = 5000 >> #temp_buffers = 1000 # min 100, 8KB each >> #max_prepared_transactions = 5 # can be 0 or more >> # note: increasing max_prepared_transactions costs ~600 bytes >> of shared memory # per transaction slot, plus lock space (see >> max_locks_per_transaction). >> >> work_mem = 16384 # in Kb >> #work_mem = 1024 # min 64, size in KB >> >> maintenance_work_mem = 262144 # in kb >> #maintenance_work_mem = 16384 # min 1024, size in KB >> #max_stack_depth = 2048 # min 100, size in KB >> >> # - Free Space Map - >> >> max_fsm_pages = 60000 >> #max_fsm_pages = 20000 # min >> max_fsm_relations*16, 6 bytes each >> >> #max_fsm_relations = 1000 # min 100, ~70 bytes each >> >> # - Kernel Resource Usage - >> >> #max_files_per_process = 1000 # min 25 >> #preload_libraries = '' >> >> # - Cost-Based Vacuum Delay - >> >> #vacuum_cost_delay = 0 # 0-1000 milliseconds >> #vacuum_cost_page_hit = 1 # 0-10000 credits >> #vacuum_cost_page_miss = 10 # 0-10000 credits >> #vacuum_cost_page_dirty = 20 # 0-10000 credits >> #vacuum_cost_limit = 200 # 0-10000 credits >> >> # - Background writer - >> >> #bgwriter_delay = 200 # 10-10000 milliseconds >> between rounds >> #bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers >> scanned/round >> #bgwriter_lru_maxpages = 5 # 0-1000 buffers max >> written/round >> #bgwriter_all_percent = 0.333 # 0-100% of all buffers >> scanned/round >> #bgwriter_all_maxpages = 5 # 0-1000 buffers max >> written/round >> >> >> #------------------------------------------------------------- >> -------------- >> # WRITE AHEAD LOG >> #------------------------------------------------------------- >> -------------- >> >> # - Settings - >> >> fsync = on # turns forced >> synchronization on or off >> #wal_sync_method = fsync # the default is the >> first option >> # supported by the >> operating system: >> # open_datasync >> # fdatasync >> # fsync >> # fsync_writethrough >> # open_sync >> #full_page_writes = on # recover from >> partial page writes >> >> wal_buffers = 128 >> #wal_buffers = 8 # min 4, 8KB each >> >> #commit_delay = 0 # range 0-100000, in >> microseconds >> #commit_siblings = 5 # range 1-1000 >> >> # - Checkpoints - >> >> checkpoint_segments = 256 # 256 * 16Mb = >> 4,294,967,296 bytes >> checkpoint_timeout = 1200 # 1200 seconds (20 minutes) >> checkpoint_warning = 30 # in seconds, 0 is off >> >> #checkpoint_segments = 3 # in logfile segments, >> min 1, 16MB each >> #checkpoint_timeout = 300 # range 30-3600, in seconds >> #checkpoint_warning = 30 # in seconds, 0 is off >> >> # - Archiving - >> >> #archive_command = '' # command to use to >> archive a logfile >> # segment >> >> >> #------------------------------------------------------------- >> -------------- >> # QUERY TUNING >> #------------------------------------------------------------- >> -------------- >> >> # - Planner Method Configuration - >> >> #enable_bitmapscan = on >> #enable_hashagg = on >> #enable_hashjoin = on >> #enable_indexscan = on >> #enable_mergejoin = on >> #enable_nestloop = on >> #enable_seqscan = on >> #enable_sort = on >> #enable_tidscan = on >> >> # - Planner Cost Constants - >> >> effective_cache_size = 80000 # 80000 * 8192 = >> 655,360,000 bytes >> #effective_cache_size = 1000 # typically 8KB each >> >> random_page_cost = 2.5 # units are one >> sequential page fetch >> #random_page_cost = 4 # units are one >> sequential page fetch >> # cost >> #cpu_tuple_cost = 0.01 # (same) >> #cpu_index_tuple_cost = 0.001 # (same) >> #cpu_operator_cost = 0.0025 # (same) >> >> # - Genetic Query Optimizer - >> >> #geqo = on >> #geqo_threshold = 12 >> #geqo_effort = 5 # range 1-10 >> #geqo_pool_size = 0 # selects default based >> on effort >> #geqo_generations = 0 # selects default based >> on effort >> #geqo_selection_bias = 2.0 # range 1.5-2.0 >> >> # - Other Planner Options - >> >> default_statistics_target = 100 # range 1-1000 >> #default_statistics_target = 10 # range 1-1000 >> #constraint_exclusion = off >> #from_collapse_limit = 8 >> #join_collapse_limit = 8 # 1 disables collapsing >> of explicit >> # JOINs >> >> >> #------------------------------------------------------------- >> -------------- >> #------------------------------------------------------------- >> -------------- >> # RUNTIME STATISTICS >> #------------------------------------------------------------- >> -------------- >> >> # - Statistics Monitoring - >> >> #log_parser_stats = off >> #log_planner_stats = off >> #log_executor_stats = off >> #log_statement_stats = off >> >> # - Query/Index Statistics Collector - >> >> stats_start_collector = on >> stats_command_string = on >> stats_block_level = on >> stats_row_level = on >> >> #stats_start_collector = on >> #stats_command_string = off >> #stats_block_level = off >> #stats_row_level = off >> #stats_reset_on_server_start = off >> >> >> #------------------------------------------------------------- >> -------------- >> # AUTOVACUUM PARAMETERS >> #------------------------------------------------------------- >> -------------- >> >> autovacuum = true >> autovacuum_naptime = 600 >> >> #autovacuum = false # enable autovacuum subprocess? >> #autovacuum_naptime = 60 # time between >> autovacuum runs, in secs >> #autovacuum_vacuum_threshold = 1000 # min # of tuple updates before >> # vacuum >> #autovacuum_analyze_threshold = 500 # min # of tuple updates before >> # analyze >> #autovacuum_vacuum_scale_factor = 0.4 # fraction of rel size before >> # vacuum >> #autovacuum_analyze_scale_factor = 0.2 # fraction of >> rel size before >> # analyze >> #autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for >> # autovac, -1 means use >> # vacuum_cost_delay >> #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for >> # autovac, -1 means use >> # vacuum_cost_ >> >> >> ---------------------- >> >> CREATE TABLE tiger.completechain >> ( >> ogc_fid int4 NOT NULL DEFAULT >> nextval('completechain_ogc_fid_seq'::regclass), >> module varchar(8) NOT NULL, >> tlid int4 NOT NULL, >> side1 int4, >> source varchar(1) NOT NULL, >> fedirp varchar(2), >> fename varchar(30), >> fetype varchar(4), >> fedirs varchar(2), >> cfcc varchar(3) NOT NULL, >> fraddl varchar(11), >> toaddl varchar(11), >> fraddr varchar(11), >> toaddr varchar(11), >> friaddl varchar(1), >> toiaddl varchar(1), >> friaddr varchar(1), >> toiaddr varchar(1), >> zipl int4, >> zipr int4, >> aianhhfpl int4, >> aianhhfpr int4, >> aihhtlil varchar(1), >> aihhtlir varchar(1), >> census1 varchar(1), >> census2 varchar(1), >> statel int4, >> stater int4, >> countyl int4, >> countyr int4, >> cousubl int4, >> cousubr int4, >> submcdl int4, >> submcdr int4, >> placel int4, >> placer int4, >> tractl int4, >> tractr int4, >> blockl int4, >> blockr int4, >> wkb_geometry public.geometry NOT NULL, >> CONSTRAINT enforce_dims_wkb_geometry CHECK >> (ndims(wkb_geometry) = 2), >> CONSTRAINT enforce_geotype_wkb_geometry CHECK >> (geometrytype(wkb_geometry) = 'LINESTRING'::text OR >> wkb_geometry IS NULL), >> CONSTRAINT enforce_srid_wkb_geometry CHECK >> (srid(wkb_geometry) = 4269) >> ) >> WITHOUT OIDS; >> ALTER TABLE tiger.completechain OWNER TO postgres; >> >> >> >> >> >> >> ---------------------------(end of >> broadcast)--------------------------- >> TIP 5: don't forget to increase your free space map settings >> >> > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Wed Nov 9 05:38:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46FC2D7B3A for ; Wed, 9 Nov 2005 05:38:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68834-09 for ; Wed, 9 Nov 2005 09:38:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by svr1.postgresql.org (Postfix) with ESMTP id C6ED0D6805 for ; Wed, 9 Nov 2005 05:38:40 -0400 (AST) Received: from 192.168.0.3 (unknown [84.12.200.148]) by smtp.nildram.co.uk (Postfix) with ESMTP id A63AE24D685; Wed, 9 Nov 2005 09:38:35 +0000 (GMT) Subject: Re: Sort performance on large tables From: Simon Riggs To: Charlie Savage , Luke Lonergan Cc: pgsql-performance@postgresql.org In-Reply-To: <43704E1D.80708@interserv.com> References: <43704E1D.80708@interserv.com> Content-Type: text/plain Organization: 2nd Quadrant Date: Wed, 09 Nov 2005 09:35:55 +0000 Message-Id: <1131528955.8300.2101.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/152 X-Sequence-Number: 15409 On Tue, 2005-11-08 at 00:05 -0700, Charlie Savage wrote: > Setup: Dell Dimension 3000, Suse 10, 1GB ram, PostgreSQL 8.1 RC 1 with > I want to extract data out of the file, with the most important values > being stored in a column called tlid. The tlid field is an integer, and > the values are 98% unique. There is a second column called ogc_fid > which is unique (it is a serial field). I need to extract out unique > TLID's (doesn't matter which duplicate I get rid of). To do this I am > running this query: > > SELECT tlid, min(ogc_fid) > FROM completechain > GROUP BY tlid; > > The results from explain analyze are: > > "GroupAggregate (cost=10400373.80..11361807.88 rows=48071704 width=8) > (actual time=7311682.715..8315746.835 rows=47599910 loops=1)" > " -> Sort (cost=10400373.80..10520553.06 rows=48071704 width=8) > (actual time=7311682.682..7972304.777 rows=48199165 loops=1)" > " Sort Key: tlid" > " -> Seq Scan on completechain (cost=0.00..2228584.04 > rows=48071704 width=8) (actual time=27.514..773245.046 rows=48199165 > loops=1)" > "Total runtime: 8486057.185 ms" > Should I expect results like this? I realize that the computer is quite > low-end and is very IO bound for this query, but I'm still surprised > that the sort operation takes so long. > > Out of curiosity, I setup an Oracle database on the same machine with > the same data and ran the same query. Oracle was over an order of > magnitude faster. Looking at its query plan, it avoided the sort by > using "HASH GROUP BY." Does such a construct exist in PostgreSQL (I see > only hash joins)? PostgreSQL can do HashAggregates as well as GroupAggregates, just like Oracle. HashAggs avoid the sort phase, so would improve performance considerably. The difference in performance you are getting is because of the different plan used. Did you specifically do anything to Oracle to help it get that plan, or was it a pure out-of-the-box install (or maybe even a "set this up for Data Warehousing" install)? To get a HashAgg plan, you need to be able to fit all of the unique values in memory. That would be 98% of 48071704 rows, each 8+ bytes wide, giving a HashAgg memory sizing of over 375MB. You must allocate memory of the next power of two above the level you want, so we would need to allocate 512MB to work_mem before it would consider using a HashAgg. Can you let us know how high you have to set work_mem before an EXPLAIN (not EXPLAIN ANALYZE) chooses the HashAgg plan? Please be aware that publishing Oracle performance results is against the terms of their licence and we seek to be both fair and legitimate, especially within this public discussion forum. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Nov 9 08:08:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 26123D8B60 for ; Wed, 9 Nov 2005 08:08:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17356-03 for ; Wed, 9 Nov 2005 12:08:39 +0000 (GMT) X-Greylist: delayed 01:05:09.043067 by SQLgrey- Received: from h6608.serverkompetenz.net (gpg-keyserver.de [81.169.179.29]) by svr1.postgresql.org (Postfix) with ESMTP id 93DD4D70C0 for ; Wed, 9 Nov 2005 08:08:40 -0400 (AST) Received: from [217.186.218.187] (helo=[192.168.0.51]) by h6608.serverkompetenz.net with asmtp (Exim 4.34) id 1EZoks-0002Hz-7m for pgsql-performance@postgresql.org; Wed, 09 Nov 2005 13:08:42 +0100 Message-ID: <4371E6A7.50808@web.de> Date: Wed, 09 Nov 2005 13:08:07 +0100 From: Jan Kesten User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Improving performance on multicolumn query X-Enigmail-Version: 0.92.0.0 OpenPGP: id=82201FC4; url=http://gpg-keyserver.de Content-Type: multipart/mixed; boundary="------------050207070808000904010206" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/153 X-Sequence-Number: 15410 This is a multi-part message in MIME format. --------------050207070808000904010206 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, all! I've been using postgresql for a long time now, but today I had some problem I couldn't solve properly - hope here some more experienced users have some hint's for me. First, I'm using postgresql 7.4.7 on a 2GHz machine having 1.5GByte RAM and I have a table with about 220 columns and 20000 rows - and the first five columns build a primary key (and a unique index). Now my problem: I need really many queries of rows using it's primary key and fetching about five different columns but these are quite slow (about 10 queries per second and as I have some other databases which can have about 300 queries per second I think this is slow): transfer=> explain analyse SELECT * FROM test WHERE test_a=9091150001 AND test_b=1 AND test_c=2 AND test_d=0 AND test_e=0; Index Scan using test_idx on test (cost=0.00..50.27 rows=1 width=1891) (actual time=0.161..0.167 rows=1 loops=1) Index Cond: (test_a = 9091150001::bigint) Filter: ((test_b = 1) AND (test_c = 2) AND (test_d = 0) AND (test_e 0)) So, what to do to speed things up? If I understand correctly this output, the planner uses my index (test_idx is the same as test_pkey created along with the table), but only for the first column. Accidently I can't refactor these tables as they were given to me. Thanks for any hint! Jan --------------050207070808000904010206 Content-Type: application/pgp-signature; name="signature.asc" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="signature.asc" LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NClZlcnNpb246IEdudVBHIHYxLjIuNCAo TWluZ1czMikNCkNvbW1lbnQ6IFVzaW5nIEdudVBHIHdpdGggVGh1bmRlcmJpcmQgLSBodHRw Oi8vZW5pZ21haWwubW96ZGV2Lm9yZw0KDQppRDhEQlFGRGNkZGV2dm1Da0lJZ0g4UVJBc3lX QUo0M1BGVUhCdmVlanBCTk1hRC9DczgwdjBnb1RnQ2dyMTZaDQprNUVuWEtKZDZQZjE4eHRi dEY1Y05uUT0NCj1wWmJvDQotLS0tLUVORCBQR1AgU0lHTkFUVVJFLS0tLS0NCg0K --------------050207070808000904010206-- From pgsql-performance-owner@postgresql.org Wed Nov 9 11:51:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F153D9B47 for ; Wed, 9 Nov 2005 11:51:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82118-02 for ; Wed, 9 Nov 2005 15:51:41 +0000 (GMT) X-Greylist: delayed 03:07:14.708408 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id C227ED967B for ; Wed, 9 Nov 2005 11:51:41 -0400 (AST) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr2.postgresql.org (Postfix) with ESMTP id 53B3BF0F48 for ; Wed, 9 Nov 2005 12:44:30 +0000 (GMT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EZpJQ-0002LS-SO for pgsql-performance@postgresql.org; Wed, 09 Nov 2005 13:44:26 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EZpJV-0002Nd-00 for ; Wed, 09 Nov 2005 13:44:29 +0100 Date: Wed, 9 Nov 2005 13:44:29 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Improving performance on multicolumn query Message-ID: <20051109124429.GA9127@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <4371E6A7.50808@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4371E6A7.50808@web.de> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/157 X-Sequence-Number: 15414 On Wed, Nov 09, 2005 at 01:08:07PM +0100, Jan Kesten wrote: > Now my problem: I need really many queries of rows using it's primary > key and fetching about five different columns but these are quite slow > (about 10 queries per second and as I have some other databases which > can have about 300 queries per second I think this is slow): > > transfer=> explain analyse SELECT * FROM test WHERE test_a=9091150001 > AND test_b=1 AND test_c=2 AND test_d=0 AND test_e=0; > > Index Scan using test_idx on test (cost=0.00..50.27 rows=1 width=1891) > (actual time=0.161..0.167 rows=1 loops=1) > Index Cond: (test_a = 9091150001::bigint) > Filter: ((test_b = 1) AND (test_c = 2) AND (test_d = 0) AND (test_e 0)) You don't post your table definitions (please do), but it looks like test_b, test_c, test_d and test_e might be bigints? If so, you may want to do explicit "AND test_b=1::bigint AND test_c=2::bigint" etc. -- 7.4 doesn't figure this out for you. (8.0 and higher does.) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Nov 9 08:55:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AD2FDD995D for ; Wed, 9 Nov 2005 08:55:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29643-08 for ; Wed, 9 Nov 2005 12:55:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id C3D1FD98DF for ; Wed, 9 Nov 2005 08:55:31 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id B36AE40C1C3; Wed, 9 Nov 2005 12:55:26 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id CD22915EDB; Wed, 9 Nov 2005 12:54:59 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25179-04; Wed, 9 Nov 2005 12:54:51 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 34AAF15EDA; Wed, 9 Nov 2005 12:54:46 +0000 (GMT) Message-ID: <4371F195.6060204@archonet.com> Date: Wed, 09 Nov 2005 12:54:45 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jan Kesten Cc: pgsql-performance@postgresql.org Subject: Re: Improving performance on multicolumn query References: <4371E6A7.50808@web.de> In-Reply-To: <4371E6A7.50808@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200511/154 X-Sequence-Number: 15411 Jan Kesten wrote: > > First, I'm using postgresql 7.4.7 on a 2GHz machine having 1.5GByte RAM > and I have a table with about 220 columns and 20000 rows - and the first > five columns build a primary key (and a unique index). > transfer=> explain analyse SELECT * FROM test WHERE test_a=9091150001 > AND test_b=1 AND test_c=2 AND test_d=0 AND test_e=0; > > Index Scan using test_idx on test (cost=0.00..50.27 rows=1 width=1891) > (actual time=0.161..0.167 rows=1 loops=1) > Index Cond: (test_a = 9091150001::bigint) > Filter: ((test_b = 1) AND (test_c = 2) AND (test_d = 0) AND (test_e 0)) This says it's taking less than a millisecond - which is almost certainly too fast to measure accurately anyway. Are you sure this query is the problem? > So, what to do to speed things up? If I understand correctly this > output, the planner uses my index (test_idx is the same as test_pkey > created along with the table), but only for the first column. 1. Are all of test_a/b/c/d/e bigint rather than int? 2. Have you tried explicitly casting your query parameters? ...WHERE test_a=123::bigint AND test_b=456::bigint... -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Nov 9 09:00:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8AD02D99AF for ; Wed, 9 Nov 2005 09:00:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29568-09 for ; Wed, 9 Nov 2005 13:00:13 +0000 (GMT) X-Greylist: delayed 00:15:50.393567 by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 0E6B6D9965 for ; Wed, 9 Nov 2005 09:00:15 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EZpYj-0003oo-65; Wed, 09 Nov 2005 14:00:18 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EZpYn-0002PM-00; Wed, 09 Nov 2005 14:00:17 +0100 Date: Wed, 9 Nov 2005 14:00:17 +0100 From: "Steinar H. Gunderson" To: Jan Kesten Cc: pgsql-performance@postgresql.org Subject: Re: Improving performance on multicolumn query Message-ID: <20051109130017.GA9229@uio.no> Mail-Followup-To: Jan Kesten , pgsql-performance@postgresql.org References: <4371E6A7.50808@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4371E6A7.50808@web.de> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/155 X-Sequence-Number: 15412 On Wed, Nov 09, 2005 at 01:08:07PM +0100, Jan Kesten wrote: > First, I'm using postgresql 7.4.7 on a 2GHz machine having 1.5GByte RAM > and I have a table with about 220 columns and 20000 rows - and the first > five columns build a primary key (and a unique index). I forgot this, but it should be mentioned: A primary key works as an unique index, so you don't need both. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Nov 9 09:19:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7957FD964B for ; Wed, 9 Nov 2005 09:19:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36670-03 for ; Wed, 9 Nov 2005 13:19:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 80650D95C1 for ; Wed, 9 Nov 2005 09:19:35 -0400 (AST) Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) by svr2.postgresql.org (Postfix) with ESMTP id CEB4CF0BD7 for ; Wed, 9 Nov 2005 13:19:38 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 4E824760373; Wed, 9 Nov 2005 21:19:34 +0800 (WST) Received: from vscan01.westnet.com.au ([127.0.0.1]) by localhost (vscan01.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12370-11; Wed, 9 Nov 2005 21:19:34 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan01.westnet.com.au (Postfix) with ESMTP id C32C576035D; Wed, 9 Nov 2005 21:19:33 +0800 (WST) Message-ID: <4371F765.1050209@familyhealth.com.au> Date: Wed, 09 Nov 2005 21:19:33 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jan Kesten Cc: pgsql-performance@postgresql.org Subject: Re: Improving performance on multicolumn query References: <4371E6A7.50808@web.de> In-Reply-To: <4371E6A7.50808@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.011 required=5 tests=[AWL=0.011] X-Spam-Score: 0.011 X-Spam-Level: X-Archive-Number: 200511/156 X-Sequence-Number: 15413 > transfer=> explain analyse SELECT * FROM test WHERE test_a=9091150001 > AND test_b=1 AND test_c=2 AND test_d=0 AND test_e=0; > > Index Scan using test_idx on test (cost=0.00..50.27 rows=1 width=1891) > (actual time=0.161..0.167 rows=1 loops=1) > Index Cond: (test_a = 9091150001::bigint) > Filter: ((test_b = 1) AND (test_c = 2) AND (test_d = 0) AND (test_e 0)) > > So, what to do to speed things up? If I understand correctly this > output, the planner uses my index (test_idx is the same as test_pkey > created along with the table), but only for the first column. Hi Jan, If you're using 7.4.x then the planner can't use the index for unquoted bigints. Try this: SELECT * FROM test WHERE test_a='9091150001' AND test_b='1' AND test_c=''2 AND test_d='0' AND test_e='0'; Chris From pgsql-performance-owner@postgresql.org Wed Nov 9 13:13:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A0EA0D7D42 for ; Wed, 9 Nov 2005 13:13:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05151-04 for ; Wed, 9 Nov 2005 17:13:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 924B4D79D9 for ; Wed, 9 Nov 2005 13:13:54 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B324931058; Wed, 9 Nov 2005 18:13:51 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Re: Sort performance on large tables Date: Wed, 09 Nov 2005 10:13:46 -0700 Organization: Hub.Org Networking Services Lines: 29 Message-ID: <43722E4A.8060904@interserv.com> References: <43704E1D.80708@interserv.com> <1131528955.8300.2101.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Simon Riggs User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <1131528955.8300.2101.camel@localhost.localdomain> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/158 X-Sequence-Number: 15415 Hi Simon, Thanks for the response Simon. > PostgreSQL can do HashAggregates as well as GroupAggregates, just like > Oracle. HashAggs avoid the sort phase, so would improve performance > considerably. The difference in performance you are getting is because > of the different plan used. Did you specifically do anything to Oracle > to help it get that plan, or was it a pure out-of-the-box install (or > maybe even a "set this up for Data Warehousing" install)? It was an out-of-the-box plan with the standard database install option (wasn't a Data Warehousing install). > Can you let us know how high you have to set work_mem before an EXPLAIN > (not EXPLAIN ANALYZE) chooses the HashAgg plan? The planner picked a HashAggregate only when I set work_mem to 2097151 - which I gather is the maximum allowed value according to a message returned from the server. > Please be aware that publishing Oracle performance results is against > the terms of their licence and we seek to be both fair and legitimate, > especially within this public discussion forum. Sorry, I didn't realize - I'll be more vague next time. Charlie From pgsql-performance-owner@postgresql.org Wed Nov 9 13:31:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 28429D70C0 for ; Wed, 9 Nov 2005 13:31:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07795-06 for ; Wed, 9 Nov 2005 17:31:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from h6608.serverkompetenz.net (gpg-keyserver.de [81.169.179.29]) by svr1.postgresql.org (Postfix) with ESMTP id 7D7F5D6FCC for ; Wed, 9 Nov 2005 13:31:41 -0400 (AST) Received: from brs9-d9bad87e.pool.mediaways.net ([217.186.216.126] helo=[192.168.0.51]) by h6608.serverkompetenz.net with asmtp (Exim 4.34) id 1EZtnP-0003bi-Kc for pgsql-performance@postgresql.org; Wed, 09 Nov 2005 18:31:39 +0100 Message-ID: <43723257.5060804@web.de> Date: Wed, 09 Nov 2005 18:31:03 +0100 From: Jan Kesten User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Improving performance on multicolumn query References: <4371E6A7.50808@web.de> <20051109124429.GA9127@uio.no> In-Reply-To: <20051109124429.GA9127@uio.no> X-Enigmail-Version: 0.92.0.0 OpenPGP: id=82201FC4; url=http://gpg-keyserver.de Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/159 X-Sequence-Number: 15416 Hi all! First thanks to any answer by now :-) > You don't post your table definitions (please do), but it looks like > test_b, test_c, test_d and test_e might be bigints? If so, you may > want to do explicit "AND test_b=1::bigint AND test_c=2::bigint" etc. > -- 7.4 doesn't figure this out for you. (8.0 and higher does.) I didn't post table defintion, but you all are right, test_a to test_e are all bigint. I use JDBC to connect to this database and use a prepared statment for the queries and set all parameters with pst.setLong() method. Perhaps this could be the problem? I'll try 'normal' statements with typecasting, because as far as I can see, the query is the problem (postgresql takes more than 98% cpu while running these statements) or the overhead produced (but not the network, as it has only 1-2% load). Quering other tables (not as big - both rows and columns are much less) run quite fast with the same code. So, thanks again - I'll try and report :-) Can't be so slow, I have some self-build database with millions of rows and they run very fast - but they don't use bigint ;-) Cheers, Jan From pgsql-performance-owner@postgresql.org Wed Nov 9 17:41:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A355EDA4D7 for ; Wed, 9 Nov 2005 17:41:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00578-08 for ; Wed, 9 Nov 2005 21:41:00 +0000 (GMT) X-Greylist: delayed 03:14:41.359269 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 3179ADAAB3 for ; Wed, 9 Nov 2005 17:40:48 -0400 (AST) Received: from pop-tawny.atl.sa.earthlink.net (pop-tawny.atl.sa.earthlink.net [207.69.195.67]) by svr2.postgresql.org (Postfix) with ESMTP id 87782F1098 for ; Wed, 9 Nov 2005 18:26:17 +0000 (GMT) Received: from elwamui-hound.atl.sa.earthlink.net ([209.86.224.34]) by pop-tawny.atl.sa.earthlink.net with esmtp (Exim 3.36 #10) id 1EZueD-0001ge-00; Wed, 09 Nov 2005 13:26:13 -0500 Message-ID: <11779240.1131560773750.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> Date: Wed, 9 Nov 2005 13:26:13 -0500 (EST) From: Ron Peacetree Reply-To: Ron Peacetree To: Charlie Savage , pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: EarthLink Zoo Mail 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.311 required=5 tests=[AWL=-0.168, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.311 X-Spam-Level: X-Archive-Number: 200511/164 X-Sequence-Number: 15421 ...and on those notes, let me repeat my often stated advice that a DB server should be configured with as much RAM as is feasible. 4GB or more strongly recommended. I'll add that the HW you are using for a DB server should be able to hold _at least_ 4GB of RAM (note that modern _laptops_ can hold 2GB. Next year's are likely to be able to hold 4GB.). I can't casually find specs on the D3000, but if it can't be upgraded to at least 4GB, you should be looking for new DB server HW. At this writing, 4 1GB DIMMs (4GB) should set you back ~$300 or less. 4 2GB DIMMs (8GB) should cost ~$600. As of now, very few mainboards support 4GB DIMMs and I doubt the D3000 has such a mainboard. If you can use them, 4 4GB DIMMs (16GB) will currently set you back ~$1600-$2400. Whatever the way you do it, it's well worth the money to have at least 4GB of RAM in a DB server. It makes all kinds of problems just not exist. Ron -----Original Message----- From: Simon Riggs Sent: Nov 9, 2005 4:35 AM To: Charlie Savage , Luke Lonergan Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Sort performance on large tables On Tue, 2005-11-08 at 00:05 -0700, Charlie Savage wrote: > Setup: Dell Dimension 3000, Suse 10, 1GB ram, PostgreSQL 8.1 RC 1 with > I want to extract data out of the file, with the most important values > being stored in a column called tlid. The tlid field is an integer, and > the values are 98% unique. There is a second column called ogc_fid > which is unique (it is a serial field). I need to extract out unique > TLID's (doesn't matter which duplicate I get rid of). To do this I am > running this query: > > SELECT tlid, min(ogc_fid) > FROM completechain > GROUP BY tlid; > > The results from explain analyze are: > > "GroupAggregate (cost=10400373.80..11361807.88 rows=48071704 width=8) > (actual time=7311682.715..8315746.835 rows=47599910 loops=1)" > " -> Sort (cost=10400373.80..10520553.06 rows=48071704 width=8) > (actual time=7311682.682..7972304.777 rows=48199165 loops=1)" > " Sort Key: tlid" > " -> Seq Scan on completechain (cost=0.00..2228584.04 > rows=48071704 width=8) (actual time=27.514..773245.046 rows=48199165 > loops=1)" > "Total runtime: 8486057.185 ms" > Should I expect results like this? I realize that the computer is quite > low-end and is very IO bound for this query, but I'm still surprised > that the sort operation takes so long. > > Out of curiosity, I setup an Oracle database on the same machine with > the same data and ran the same query. Oracle was over an order of > magnitude faster. Looking at its query plan, it avoided the sort by > using "HASH GROUP BY." Does such a construct exist in PostgreSQL (I see > only hash joins)? PostgreSQL can do HashAggregates as well as GroupAggregates, just like Oracle. HashAggs avoid the sort phase, so would improve performance considerably. The difference in performance you are getting is because of the different plan used. Did you specifically do anything to Oracle to help it get that plan, or was it a pure out-of-the-box install (or maybe even a "set this up for Data Warehousing" install)? To get a HashAgg plan, you need to be able to fit all of the unique values in memory. That would be 98% of 48071704 rows, each 8+ bytes wide, giving a HashAgg memory sizing of over 375MB. You must allocate memory of the next power of two above the level you want, so we would need to allocate 512MB to work_mem before it would consider using a HashAgg. Can you let us know how high you have to set work_mem before an EXPLAIN (not EXPLAIN ANALYZE) chooses the HashAgg plan? Please be aware that publishing Oracle performance results is against the terms of their licence and we seek to be both fair and legitimate, especially within this public discussion forum. Best Regards, Simon Riggs ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Wed Nov 9 15:59:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 304F3D7E67 for ; Wed, 9 Nov 2005 15:59:36 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57098-02 for ; Wed, 9 Nov 2005 19:59:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from brmea-mail-3.sun.com (brmea-mail-3.Sun.COM [192.18.98.34]) by svr1.postgresql.org (Postfix) with ESMTP id BEEB3D77CC for ; Wed, 9 Nov 2005 15:59:29 -0400 (AST) Received: from phys-hanwk-1 ([129.149.2.111]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id jA9JxT3F024796 for ; Wed, 9 Nov 2005 12:59:29 -0700 (MST) Received: from conversion-daemon.hanwk-mail1.sfbay.sun.com by hanwk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IPP00901DT7ZB@hanwk-mail1.sfbay.sun.com> (original mail from Ashok.Agrawal@Sun.COM) for pgsql-performance@postgresql.org; Wed, 09 Nov 2005 11:59:29 -0800 (PST) Received: from Sun.COM (sr1-unwk-09.SFBay.Sun.COM [129.149.2.159]) by hanwk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTP id <0IPP001URE6PUK@hanwk-mail1.sfbay.sun.com> for pgsql-performance@postgresql.org; Wed, 09 Nov 2005 11:59:13 -0800 (PST) Date: Wed, 09 Nov 2005 11:59:13 -0800 From: Ashok Agrawal Subject: Outer Join performance in PostgreSQL To: pgsql-performance@postgresql.org Reply-To: Ashok.Agrawal@Sun.COM Message-id: <43725511.3040809@Sun.COM> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.4) Gecko/20041214 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.062 required=5 tests=[AWL=0.061, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.062 X-Spam-Level: X-Archive-Number: 200511/160 X-Sequence-Number: 15417 I noticed outer join is very very slow in postgresql as compared to Oracle. SELECT a.dln_code, a.company_name, to_char(a.certificate_date,'DD-MON-YYYY'), to_char(a.certificate_type_id, '99'), COALESCE(b.certificate_type_description,'None') , a.description, a.blanket_single, a.certificate_status, COALESCE(a.sun_legal_entity, 'None'), COALESCE(a.other_entity_name, 'None'), COALESCE(a.notes, 'None'),COALESCE(c.name, NULL), COALESCE(to_char(a.created_date,'DD-MON-YYYY'), 'N/A'), COALESCE(c.name, NULL), COALESCE(to_char(a.updated_date,'DD-MON-YYYY'), 'N/A'), COALESCE(e.name, NULL), COALESCE(to_char(a.approved_date,'DD-MON-YYYY'), 'N/A') FROM ((((ecms_cert_headers a LEFT OUTER JOIN taxpack_user c ON (a.created_by = c.emp_no)) LEFT OUTER JOIN taxpack_user d ON (a.updated_by = d.emp_no)) LEFT OUTER JOIN taxpack_user e ON (a.approved_by = e.emp_no)) INNER JOIN ecms_certificate_types b ON (a.certificate_type_id= b.certificate_type_id )) WHERE a.dln_code = '17319' This query return only 1 record but take 25 second to execute in postgreSQL as compared to 1.3 second in Oracle. Any suggestion ? Below is explain output. Hash Join (cost=1666049.74..18486619.37 rows=157735046 width=874) Hash Cond: ("outer".certificate_type_id = "inner".certificate_type_id) -> Merge Right Join (cost=1666048.13..11324159.05 rows=643816513 width=826) Merge Cond: ("outer"."?column3?" = "inner"."?column16?") -> Sort (cost=30776.19..31207.80 rows=172645 width=64) Sort Key: (e.emp_no)::text -> Seq Scan on taxpack_user e (cost=0.00..4898.45 rows=172645 width=64) -> Sort (cost=1635271.94..1637136.51 rows=745827 width=811) Sort Key: (a.approved_by)::text -> Merge Left Join (cost=25230.45..36422.18 rows=745827 width=811) Merge Cond: ("outer"."?column17?" = "inner"."?column2?") -> Sort (cost=3117.35..3119.51 rows=864 width=844) Sort Key: (a.updated_by)::text -> Nested Loop Left Join (cost=0.00..3075.21 rows=864 width=844) -> Index Scan using pk_ecms_cert_headers on ecms_cert_headers a (cost=0.00..6.01 rows=1 width=829) Index Cond: ((dln_code)::text = '17319'::text) -> Index Scan using ash_n1 on taxpack_user c (cost=0.00..3058.40 rows=864 width=64) Index Cond: (("outer".created_by)::text = (c.emp_no)::text) -> Sort (cost=22113.10..22544.71 rows=172645 width=16) Sort Key: (d.emp_no)::text -> Seq Scan on taxpack_user d (cost=0.00..4898.45 rows=172645 width=16) -> Hash (cost=1.49..1.49 rows=49 width=50) -> Seq Scan on ecms_certificate_types b (cost=0.00..1.49 rows=49 width=50) (23 rows) Thanks Ashok From pgsql-performance-owner@postgresql.org Wed Nov 9 16:35:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 80F89DA2D0 for ; Wed, 9 Nov 2005 16:35:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72877-04 for ; Wed, 9 Nov 2005 20:35:22 +0000 (GMT) X-Greylist: delayed 00:24:00.222416 by SQLgrey- Received: from hoboe1bl1.telenet-ops.be (hoboe1bl1.telenet-ops.be [195.130.137.72]) by svr1.postgresql.org (Postfix) with ESMTP id 97CABDA2C7 for ; Wed, 9 Nov 2005 16:35:22 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by hoboe1bl1.telenet-ops.be (Postfix) with SMTP id 29042381E4 for ; Wed, 9 Nov 2005 21:11:19 +0100 (CET) Received: from [10.0.1.2] (d5152B313.access.telenet.be [81.82.179.19]) by hoboe1bl1.telenet-ops.be (Postfix) with ESMTP id C9B823805D for ; Wed, 9 Nov 2005 21:11:18 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v623) To: pgsql-performance@postgresql.org Message-Id: <717cfb0994c1b2752f7da311614e3148@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-38-788539305 From: Yves Vindevogel Subject: Some help on buffers and other performance tricks Date: Wed, 9 Nov 2005 21:11:18 +0100 X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/161 X-Sequence-Number: 15418 --Apple-Mail-38-788539305 Content-Type: multipart/alternative; boundary=Apple-Mail-39-788539306 --Apple-Mail-39-788539306 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi all, I've got PG 8.0 on Debian sarge set up ... I want to speed up performance on the system. The system will run PG, Apache front-end on port 80 and Tomcat / Cocoon=20= for the webapp. The webapp is not so heavily used, so we can give the max performance=20 to the database. The database has a lot of work to do, we upload files every day. The current server has 8 databases of around 1 million records. This=20 will be more in the future. There's only one main table, with some smaller tables. 95% of the=20 records are in that one table. A lot of updates are done on that table, affecting 10-20% of the=20 records. The system has 1 gig of ram. I could give 512Mb to PG. Filesystem is ext2, with the -noatime parameter in fstab Could I get some suggestions in how to configure my buffers, wals, ....=20= ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-39-788539306 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi all, I've got PG 8.0 on Debian sarge set up ... I want to speed up performance on the system. The system will run PG, Apache front-end on port 80 and Tomcat / Cocoon for the webapp. The webapp is not so heavily used, so we can give the max performance to the database. The database has a lot of work to do, we upload files every day. The current server has 8 databases of around 1 million records. This will be more in the future. There's only one main table, with some smaller tables. 95% of the records are in that one table. A lot of updates are done on that table, affecting 10-20% of the records. The system has 1 gig of ram. I could give 512Mb to PG. Filesystem is ext2, with the -noatime parameter in fstab Could I get some suggestions in how to configure my buffers, wals, .... ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-39-788539306-- --Apple-Mail-38-788539305 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM8LAAMjhhuR5ir4ULjigT5pn+P5co2T6pn+YBup6dp6xoh6kHie95modNOFkah0H+Qhd pyKBNmcf68r2Bo9GGtdpwIAUotM1Q4QMNzUDZhuVZbLsvy7KkqZZCnAb4AFcQY1C3LW1Wb5lOa2t ZvUt78NNjcMN83wEOMDczvuTzXNQ3QEN01WRL2b8XBYEDuugQEFUYgkpIo5FjIJTmhfZkHG8J0nm fB/sifp/EQYLBioUKsBkRKVgWPLX7stA4VnaDa+tZlZel0j+gCMpWS8MRULQNeIDY/4zTIAIyFX0 GFybZnr+rZ8p2a1s6tUNfADXXI1Yb8jLX+MNQk+1Az7zWqwVa/FaJrHpvSLeAQOhdE/l7CSJwrAb BXDXH+PkyA/gUiPGaftASWW6JeDgnGAsCmLNvcYqlz5+FchnZMrqGbeE3JoYhAMAKbEvOGeigtaE CDZwJcgxtiML0uMgQYzllKt2GhtP/EaH6cgAm+fnCtVEVXFOKNU54AC1B/tyLfBx4YJBGwhAAG5m yUoGH/TgxlZ7nGXw3YdEpYTPWOvaSq/JVEX28rEDQsGKDoGPx+QYnE1URg2paZY4dy7EHTx9cc41 upqIfwkjSgJWyW0MgBdK9I1DGAAwnS8G8+4cGYyUWWbKMg/gSiOjQG+FMQ44qqlmgBNUSYYMohKW 2ULFZaR8NdMFucoz/w/ZcAAMzgH+j/AKGV8QAZkhmWNM0AJ/I5zCiJEGYjF1qoGmxI5MqwT7JVlG buLULJhPXlbK+WMt3HwHmIbF8xaA0n6mvPgN7EJhx9Vcax+hsX6wGZuldNDnTSgQDoloGohS6BYE 62gPQqyRhlFE2gIYkCRgdD4WcAUsnxvlYklKgUCn4upi29JkkpG/pbYgtKbr86TLOnbLCF066ZLP kGsI+7NY9rRjZHB+0ew4M5S0AKT4FA8l0BaIUk4XHkj/EYLwzAtVyj/GwRYf49B8D6H+OMdw9R/j DG8vcTgx1xhpFTBoHYilRgaDygQAobXCynVVSSVdRYTLJls5CcIaqX0zpw/Kms76c2DSnTsNNPaA TbpggqOSCg4MkQwcAPiBAzimJqI4Xg3R/itX0P8bY66xD7MiYkgg5h4vAF2NgdY/xNGCH+HQVMIQ WiCNVM2L6Ap4s3ShFixMubA2HnjcUulhab3GuIbGxVjLlxXZoawMKFgsCiaSOUd6nB6XbH+PofKN LtqcH7eMf5AyimQOtegf4/TIEFvYP8dyjTm2eV1KdmNgrlIKr/cOxF+LjmRldTZY88L/U6P/YtyF +b82PDAhkOQsyNkHu8jS76NB4YXH+PvDUG7v3lIFeu8mFbuj6q8PXE2HEaXqIEUEgxnh2T2YhD/B WBZcUunVjO59yMB3PsHc3BONLemxwaP8NwsTMEPvVeMieJKvXmHZk8f48h5GHyYP8e+V3g3tvMQs VY01FLCxjgTHk8b943yBTOVoJEiXJzPgae1zr+2HwYhnIuRzrjczwP8eY8zDmKy7l8NOYcx40zKW nNswizytg+kXHc/qS48x9o7QbNMhZ0yMdvPBG7wmNz/jB6WYs436uFmbHhbFrAFgjhl4Y/g5IvH+ 0EkYFw+NuAHqmoet9bWJwPnDHEfM55E0udjTNW7uZ+y9p6L+oNe3Bxtoa4lACzgQee2kQ5Jwo1RK QPQfK8xejaJ6FG6w/wEh1NZJ+L6ydoH+zfqTUK0dK7AzsY7Yem9jaA0Fu2wVf9eJObqW+TxuwbCS K4JEYVnh2O/vWQM5K+wtCehCCAP5YABybV035xCAJIJqnrTyFqB9H8e1Lu/OumM870MTp3MGn9J8 g5Zsxhk2ZURLfGmrBAEg5m/CISIf4jRekblaCgRoyS0BjWNZVw6uZ70hnsrkND/Fbn3kWWtmz1ID a5NxyLYJ1xujdI3iZTm9dkYy4/P9yFKIcFoDQsbtKW4nT2YbLrpr450V6zTGem7N+YzXVzDZ0PSl ddIb8GQVrlD9sQjy4FKHVy0ZDDeLHCPWuuD/68Y0Vg1LX8c0bQSBiAq9JrVv2pYwZkzq6mqxDi8y XJgBkjZGftMMdUgm5PKyCBnogBI72hYgZlgrD6WWgMzPZkxGdUzfIfIzsdb66PXr/Jxp+XwRGlOL GnuJm2b0l7vo/dJeDL4N7qwWN+qn5CqedNMATuzZmObaad1s4dBMl/6wmG/Pt1+oAAYk2hToiuQc 5FxyjyRoHqH0xYKE+Q8k+UIgH0KAH+HSHqXmGwHSIuEGF0I25eWE8A96/g2akwhIk8Puf25mpi3w /IeG/M8y0O10/WgM3cpUS8l0mS+ocOYgDQS0ASDUTOB6EaJWDkXyXwFyL+GqGkPKHQHMOkxIXmIO HAHAJyyuKgvGIIHgU2H+G0GuHKH+FwF6KwEAtAH+CUEcLOAiNC2QnKcOZSZCmO9ongNep2sA3Y2W nY/KwE9hDazc8w8Sug9mh6cAZ0/UAEC0FKH+AOCOEoJQBeD8H+A2A+DYYGBuD2H+D6DmFCH+F0Fq hDB+PKGcGaaSGsGmJyGOGGg0EuEgP0CqCOEOH+BIA+DQH+AgBSDrD+CAEcH+AICwFNA+pamupfDQ /G1E2asfDksJDesNBCv012x+5WDmQSseeiAaCGEiH+BEAmC0H+A8AcCyH+A4AXGqAqAOCsLqAQCw H+BMAuDIH+CJEWPMCpFKCaCEEASEBFESA2AaC2H+AoAOCqK6AVGqA8AYCvGcAiC9HmBlHZBglBDt F80LF7BNDdBHDg2U0JGI0lGEseWsAgB6EYH+BUAkC4H+BKAuDDGcArH+BCAnH+A8AeC6K7HjG7H4 AoANHtG1G4A1GxGkAfHkBAAjJOBCAqC/FMAuDAH+BOApJ8A0BYDy2aWtGEzI1G2dKRIUwDGDF9BP DooBISnVImB9IsBRJHI2AuDHK3HHI4DFK3K6BGArI8BAAlJ8A8AhJqAlJxJBK3LDLBK9LmBNKCH+ AwBZEZIGcjGM3zKVIRL7BEH8zVKfKojrKlMCQVIk2jKuH/KzH/I5K7MjLFMpMnI5HGBIAvG/I5J9 MvMrK5M/K7LrJ9LxL1DXL5KYp1L/MM80g2wABMzWAGjVDZIc/XDrIiNjKtKxK1MtNBN7MlN9HFJ5 M3J7NDONMnNHLvLzKNKnMS5dNPMAsGpgLKLoAQNswAH8EAGAXGB0EobQAwEEJOblOa1uzJIfNvF9 MXFVMbMfOPODOBOBMxM1K3M7PfPdNFLtNLOZOcfjIOgVPIfeAaD2VGBUEY6ECyFQL+awXWH+HCHa KgW+KoAqDsPu3Mt8rxMO+fOjPTNzMZN3MhPtN/M/PlOJPrPhPvHBPzOXL3KPKhP69Mv4SmYWWs4m QyDGFUGsH+GeHEOkHW204SIED6FmaSBqeZHmQ3Fikw7iPwZWkCSs40Yg0CwTQAxpPUAhPZN5RDS1 PjOHPpRRRFOTP1RZSo5W1skw6MDa6g5omYZW94AYDkN+BOD+NKCoE6SKHy1WA8EOL2Z8cuhGTU/f SlArAu95L2cmiO1xSrQ7PXQ/S/S1RJS9RFUlNBTDRXNPRavw3St25kTXBiQsADBfUFNO/fUC6K+A N+9fTI2SkOfG6YmY9MZWDEFS+0TInFUQSfPI1NQ9MdSzRPUnS5MzRLUdRPUqD02RRaeoseDdSaQn ScQi9G/kPu+e/o+E8UQUoGv/IXMKsOfqZu8O/eV2S89E7QZ7XG8w/edGQYxiTeoSB3FKBQAlRBV9 S3LnWDUjXpN7LCBOAnJ8AyBXKKV0Z7KPKO6i764rXI9wS8DJVq6TAw+hP5MFBJDi0Ofq0i86mQPv XMDRWlBi6QVy6iAYCUEuJIBDESBGA0DNI2AxLjRCAxS4BGAvH5I5J2BLZdZVV9ZtZqDKJIA+DUH+ AiB4ES2a4pDFDE+fVIkg84ZylyTUn7RdYjIZYhQy14fipY9SDTWhSjRg6UAEC+fZGWEfEMBCDbFM AtJ9MzI9LlM8BFZjJ5ZpNBMzLCBJLKH+A+A3ZSAiByEMmcC0FO7Q7eTVSW+ectBY9HQ2oFDTNXak Ns9fIa0hPPVUfqfq5i3OjohIAEC6fYAWB6ERFUBSDxLuAtZSA7JSA/JoH/LPH+BIAtK7bZG4BGAt JCApH+A+AhJPGnJOA0AfH+AiBIDoWuBzc6AICvD8PxUAWJWWj2sfWwsPP9cXWzKc/PGE0jPQvwiE 9kWsAeB+EVI2AaCpdQAbGjGnHkA4AbJPHhI0A2AZI0A6AdI1drG+A6AfG/HhGjfVI1fLfJGpfBGq BGAZHsAvKJA+j7eZencVNSlZGBelINchalStIqbTV7J5I8BDLtdrJPfLfSAZHkA2AXfPfXENJTfl JrK0BFdjMoBOArX7UsYhUxaledgRcZgVBLMTepVU17StSxXlMrZzbgAtLDgrdoAlGiBBK1dhZZLi AxK/OFORRVNNhbhu0PhhafgTW1gXilgbgRhzUbV/OOAwDPFMAxe/ZrPriXXnWJidP3hiuZgPiphk eGA8EUJGWEc3MNhtgdUXSvi5XxS1Z3Zhe/MzbfjNRRUrieVpeejtOg0OseDeNYQexAIEE4GcX2B4 EkRKAMDsNjXSTWcVVVjvi1jzh1WHM/j8AvkAAvkFlHkLjVjdjZF4pPk0nANKLKQIBCESL2D6F6XG XgvWqwHQMqEsGIRaL6RSAgD6bcQAbyNRBkLQDCWNhdNxkPj1V5h3i7N7lLlPlTmtUpjTTHak1tUE DHDyQMDWN+ggQIByEiJOEGOcGIG8Okq7CMXay2KMG8HaU4rcMGCIE8aSBcEWL2Ci4ccggbKXhxlD j3jPPdmxbdLnm3PxNJhZkO1CseseDUNKBIEMJWB8EqhCBqEuGgH+DiFiL+GXQcINAEIhl4McIkXc IICurWWuDulCNiDW85VVi3mplHmuH/j/oZM9odRTohkNNQnjYIc6QIAILmH+BgEOLOtabCUcIPpV qiIOHMKeOQGoJ6C+FaMwAuEJT474DYTfliJQrbgjmrj5OBoXkDobrTJ/LsArX+LQDI72nBlkJQLv C2FBpAEoGOMGGhqsvKH7nlqpqlnpsKKMHgJ+tgGQPKCmFIaSAwD8LOA4EGJWBiCdEFH1G/iPp0Av rXlRrboTdXLDdrI0BSBkD4H/n8JOAkD7o0EwhCECF+PKG6HceBsQRtsPtyOuq4/+22RcFYJGBkBK Ddp4AtI8A2AdHkA/H9uPZZrVp5lNp9OFMzK7iLJ9HhHlgrJ8BSA3FSEWECe+vNsVnkXdt4MVqnvR qiHmHkKgF+F0JqEMD8fECQB4D7uPI8AyAZGjubJ8BAAqClbqAng4AbfZdsKyBTuMDiDOE2H+FmFe JGHMU1vXwrvVwrwxCKagF3pADyDiFEH+CWCAEHJ+A3G4B+BmDmH+DQC7EEFGE4NKHYHUXvwxxqIj t3xtxyIaw0ImGwGus8HgUZx1yGavxxyJyPyRySKIKQFuFibQGOGEYFyVynypymKQCaB/xIDkDOE8 IQFSFEVGE+EsQIIWGEF4L+EwEeP6IOE4EoN2DOC0ErpCDLy6DYDAEyH+FiFU6EHyq6H+DqDUFAH+ G4GwOWIWw0IIEMD68HzsE0H+DgDIE4H+DaDD0cG8G4X2FgFS6EFGE2LAIWG0GsHMH+EoEWTaIOFn uEH+DKCzzkDjzoH+DJ1aH+FuFgbRsGIIEKD2fZyCrEIOGUGMI2E8EqNLz6XmDsDXEgDUC6EwH+DW C9zx1ZzkF4FuOOHUq0D8Dnb8DeDHwd0h0kEeEKQsKQCkCLFKDv2SIQD6DkFJENg2H/ygYFxkPCBu BQDkH+CwCXIsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-38-788539305 Content-Type: multipart/alternative; boundary=Apple-Mail-40-788539307 --Apple-Mail-40-788539307 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-40-788539307 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-40-788539307-- --Apple-Mail-38-788539305-- From pgsql-performance-owner@postgresql.org Wed Nov 9 17:43:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0555ADA44B for ; Wed, 9 Nov 2005 17:41:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03208-03 for ; Wed, 9 Nov 2005 21:41:12 +0000 (GMT) X-Greylist: delayed 00:57:45.373243 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id E857EDAC6A for ; Wed, 9 Nov 2005 17:41:04 -0400 (AST) Received: from asmail001.abovesecurity.com (asmail001.abovesecurity.com [206.162.148.235]) by svr2.postgresql.org (Postfix) with ESMTP id 99C4BF0C70 for ; Wed, 9 Nov 2005 20:43:21 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: (View and SQL) VS plpgsql X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Wed, 9 Nov 2005 15:43:18 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: (View and SQL) VS plpgsql Thread-Index: AcXlbjcI8fv5lTwCRd6ecpvDfXlSkA== From: "Eric Lauzon" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.057 required=5 tests=[AWL=0.057] X-Spam-Score: 0.057 X-Spam-Level: X-Archive-Number: 200511/165 X-Sequence-Number: 15422 Hello all , i post this question here because i wasen't able to find answer to my question elsewhere , i hope someone can answer. Abstract: The function that can be found at the end of the e-mail emulate two = thing. First it will fill a record set of result with needed column from a = table and two "empty result column" a min and a max. Those two column are then filled by a second query on the same table = that will do a min and a max on an index idx_utctime. The function loop for the first recordset and return a setof record that = is casted by caller to the function. The goald of this is to enabled the application that will receive the = result set to minimise its work by having to group internaly two matching rowset. We use to handle = two resultset but i am looking toward improving performances and at first glance it seem to speed up = the process. Questions: 1. How could this be done in a single combinasion of SQL and view?=20 2. In a case like that is plpgsql really givig significant overhead? 3. Performance difference [I would need a working pure-SQL version to = compare PLANNER and Explain results ] STUFF: --TABLE && INDEX CREATE TABLE archive_event ( inst int4 NOT NULL, cid int8 NOT NULL, src int8 NOT NULL, dst int8 NOT NULL, bid int8 NOT NULL, tid int4 NOT NULL, utctime int4 NOT NULL, CONSTRAINT ids_archives_event_pkey PRIMARY KEY (inst, cid), CONSTRAINT ids_archives_event_cid_index UNIQUE (cid) )=20 --index CREATE INDEX idx_archive_utctime ON archive_event USING btree (utctime); CREATE INDEX idx_archive_src ON archive_event USING btree (src); CREATE INDEX idx_archive_bid_tid ON archive_event USING btree (tid, bid); --FUNCTION CREATE OR REPLACE FUNCTION console_get_source_rule_level_1() RETURNS SETOF RECORD AS ' DECLARE one_record record; r_record record; BEGIN FOR r_record IN SELECT count(cid) AS hits,src, bid, tid,NULL::int8 as = min_time,NULL::int8 as max_time FROM archive_event WHERE inst=3D\'3\' = AND (utctime BETWEEN \'1114920000\' AND \'1131512399\') GROUP BY src, = bid, tid LOOP SELECT INTO one_record MIN(utctime) as timestart,MAX(utctime) as = timestop from archive_event where src =3Dr_record.src AND bid = =3Dr_record.bid AND tid =3D r_record.tid AND inst =3D\'3\' AND (utctime = BETWEEN \'1114920000\' AND \'1131512399\'); r_record.min_time :=3D one_record.timestart; r_record.max_time :=3D one_record.timestop; =20 RETURN NEXT r_record; END LOOP; RETURN; END; ' LANGUAGE 'plpgsql' VOLATILE; GRANT EXECUTE ON FUNCTION console_get_source_rule_level_1() TO console = WITH GRANT OPTION; --FUNCTION CALLER SELECT * from get_source_rule_level_1() AS (hits int8,src int8,bid = int8,tid int4,min_time int8,max_time int8) Eric Lauzon [Recherche & D=E9veloppement] Above S=E9curit=E9 / Above Security T=E9l : (450) 430-8166 Fax : (450) 430-1858=20 From pgsql-performance-owner@postgresql.org Wed Nov 9 17:40:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 362ADDA52E for ; Wed, 9 Nov 2005 17:40:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00593-05 for ; Wed, 9 Nov 2005 21:40:27 +0000 (GMT) X-Greylist: delayed 00:54:36.928463 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 1CBDDDA245 for ; Wed, 9 Nov 2005 17:40:27 -0400 (AST) Received: from william.ironicdesign.com (william.ironicdesign.com [216.180.99.12]) by svr2.postgresql.org (Postfix) with ESMTP id 1E844F1238 for ; Wed, 9 Nov 2005 20:45:51 +0000 (GMT) Received: from hero.mallet-assembly.org (user-10lf9os.cable.mindspring.com [65.87.167.28]) by william.ironicdesign.com (Postfix) with ESMTP id 2B2FF46006D for ; Wed, 9 Nov 2005 14:45:46 -0600 (CST) From: Michael Alan Dorman To: pgsql-performance@postgresql.org Subject: Re: Outer Join performance in PostgreSQL References: <43725511.3040809@Sun.COM> Mail-Followup-To: pgsql-performance@postgresql.org Date: Wed, 09 Nov 2005 15:45:53 -0500 In-Reply-To: <43725511.3040809@Sun.COM> (Ashok Agrawal's message of "Wed, 09 Nov 2005 11:59:13 -0800") Message-ID: <87d5l9r1mm.fsf@hero.mallet-assembly.org> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/163 X-Sequence-Number: 15420 Ashok Agrawal writes: > I noticed outer join is very very slow in postgresql as compared > to Oracle. I think the three things the people best able to help you are going to ask for are 1) what version of PostgreSQL, 2) what are the tables, and how many rows in each, and 3) output from 'explain analyze' rather than just 'explain'. That said, I'm willing to take an amateurish stab at it even without that. In fact, I don't think the outer joins are the issue at all. I see that you're forcing a right join from ecms_certificate_types to ecms_cert_headers. This seems to be causing postgresql to think it must (unnecessarily) consider three quarters of a billion rows, which, if I'm reading right, seems to be producing the majority of the estimated cost: > Hash Join (cost=1666049.74..18486619.37 rows=157735046 width=874) > Hash Cond: ("outer".certificate_type_id = "inner".certificate_type_id) > -> Merge Right Join (cost=1666048.13..11324159.05 rows=643816513 width=826) In fact, looking at the fact that you're doing a COALESCE on a column from b, it seems to me that doing a right join from ecms_cert_headers to ecms_certificate_types is just wrong. It seems to me that that should be a left join as well. With that in mind, I would rewrite the whole FROM clause as: FROM ecms_cert_headers a LEFT OUTER JOIN ecms_certificate_types b ON (a.certificate_type_id = b.certificate_type_id) LEFT OUTER JOIN taxpack_user c ON (a.created_by = c.emp_no) LEFT OUTER JOIN taxpack_user d ON (a.updated_by = d.emp_no) LEFT OUTER JOIN taxpack_user e ON (a.approved_by = e.emp_no) WHERE a.dln_code = '17319' It seems to me that this more reflects the intent of the data that is being retrieved. I would also expect it to be a boatload faster. Assuming I've understood the intent correctly, I would guess that the difference is the result of the Oracle planner being able to eliminate the right join or something. Mike From pgsql-performance-owner@postgresql.org Wed Nov 9 17:24:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 73160D9DE0 for ; Wed, 9 Nov 2005 17:24:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93400-09 for ; Wed, 9 Nov 2005 21:24:49 +0000 (GMT) X-Greylist: delayed 02:58:33.844077 by SQLgrey- Received: from pop-tawny.atl.sa.earthlink.net (pop-tawny.atl.sa.earthlink.net [207.69.195.67]) by svr1.postgresql.org (Postfix) with ESMTP id 8D13CD9AE8 for ; Wed, 9 Nov 2005 17:24:49 -0400 (AST) Received: from elwamui-hound.atl.sa.earthlink.net ([209.86.224.34]) by pop-tawny.atl.sa.earthlink.net with esmtp (Exim 3.36 #10) id 1EZxR3-0005bY-00; Wed, 09 Nov 2005 16:24:49 -0500 Message-ID: <17035565.1131571489652.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> Date: Wed, 9 Nov 2005 16:24:49 -0500 (EST) From: Ron Peacetree Reply-To: Ron Peacetree To: Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailer: EarthLink Zoo Mail 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.31 required=5 tests=[AWL=-0.169, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.31 X-Spam-Level: X-Archive-Number: 200511/162 X-Sequence-Number: 15419 0=3D Optimize your schema to be a tight as possible. Your goal is to give = yourself the maximum chance that everything you want to work on is in RAM w= hen you need it. 1=3D Upgrade your RAM to as much as you can possibly strain to afford. 4GB= at least. It's that important. 2=3D If the _entire_ DB does not fit in RAM after upgrading your RAM, the n= ext step is making sure your HD IO subsystem is adequate to your needs. 3=3D Read the various pg tuning docs that are available and Do The Right Th= ing. 4=3D If performance is still not acceptable, then it's time to drill down i= nto what specific actions/queries are problems. If you get to here and the entire DBMS is still not close to acceptable, yo= ur fundamental assumptions have to be re-examined. Ron -----Original Message----- From: Yves Vindevogel Sent: Nov 9, 2005 3:11 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Some help on buffers and other performance tricks Hi all, I've got PG 8.0 on Debian sarge set up ... I want to speed up performance on the system. The system will run PG, Apache front-end on port 80 and Tomcat / Cocoon=20 for the webapp. The webapp is not so heavily used, so we can give the max performance=20 to the database. The database has a lot of work to do, we upload files every day. The current server has 8 databases of around 1 million records. This=20 will be more in the future. There's only one main table, with some smaller tables. 95% of the=20 records are in that one table. A lot of updates are done on that table, affecting 10-20% of the=20 records. The system has 1 gig of ram. I could give 512Mb to PG. Filesystem is ext2, with the -noatime parameter in fstab Could I get some suggestions in how to configure my buffers, wals, ....=20 ? Met vriendelijke groeten, Bien =EF=BF=BD vous, Kind regards, Yves Vindevogel Implements From pgsql-performance-owner@postgresql.org Wed Nov 9 18:47:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8410AD9AE8 for ; Wed, 9 Nov 2005 18:47:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20349-09 for ; Wed, 9 Nov 2005 22:47:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 55524D98B8 for ; Wed, 9 Nov 2005 18:47:20 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id AA18235512; Wed, 9 Nov 2005 14:47:22 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id A87853550F; Wed, 9 Nov 2005 14:47:22 -0800 (PST) Date: Wed, 9 Nov 2005 14:47:22 -0800 (PST) From: Stephan Szabo To: Ashok Agrawal Cc: pgsql-performance@postgresql.org Subject: Re: Outer Join performance in PostgreSQL In-Reply-To: <43725511.3040809@Sun.COM> Message-ID: <20051109144311.B34905@megazone.bigpanda.com> References: <43725511.3040809@Sun.COM> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/166 X-Sequence-Number: 15423 On Wed, 9 Nov 2005, Ashok Agrawal wrote: > I noticed outer join is very very slow in postgresql as compared > to Oracle. > > SELECT a.dln_code, a.company_name, > to_char(a.certificate_date,'DD-MON-YYYY'), > to_char(a.certificate_type_id, '99'), > COALESCE(b.certificate_type_description,'None') , > a.description, a.blanket_single, a.certificate_status, > COALESCE(a.sun_legal_entity, 'None'), > COALESCE(a.other_entity_name, 'None'), > COALESCE(a.notes, 'None'),COALESCE(c.name, NULL), > COALESCE(to_char(a.created_date,'DD-MON-YYYY'), 'N/A'), > COALESCE(c.name, NULL), > COALESCE(to_char(a.updated_date,'DD-MON-YYYY'), 'N/A'), > COALESCE(e.name, NULL), > COALESCE(to_char(a.approved_date,'DD-MON-YYYY'), 'N/A') > FROM ((((ecms_cert_headers a > LEFT OUTER JOIN taxpack_user c ON (a.created_by = c.emp_no)) > LEFT OUTER JOIN taxpack_user d ON (a.updated_by = d.emp_no)) > LEFT OUTER JOIN taxpack_user e ON (a.approved_by = e.emp_no)) > INNER JOIN ecms_certificate_types b ON > (a.certificate_type_id= b.certificate_type_id )) > WHERE a.dln_code = '17319' I think in the above it's safe to do the inner join first, although PostgreSQL won't determine that currently and that could have something to do with the difference in performance if Oracle did reorder the joins. If you were to run the query doing the INNER JOIN first, does that give the correct results and run more quickly in PostgreSQL? In either case, explain analyze output would be handy to find the actual times taken by the steps. From pgsql-performance-owner@postgresql.org Wed Nov 9 19:08:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F46CDA282 for ; Wed, 9 Nov 2005 19:08:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25750-04 for ; Wed, 9 Nov 2005 23:08:02 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by svr1.postgresql.org (Postfix) with ESMTP id DA6B3DA20D for ; Wed, 9 Nov 2005 19:08:01 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 09 Nov 2005 20:10:03 -0300 X-IronPort-AV: i="3.97,310,1125892800"; d="scan'208"; a="24327048:sNHT10221403366" Received: from alvh.no-ip.org (216.155.78.23) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 4350159700348836; Wed, 9 Nov 2005 20:07:40 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 84F4AC2D450; Wed, 9 Nov 2005 20:07:52 -0300 (CLST) Date: Wed, 9 Nov 2005 20:07:52 -0300 From: Alvaro Herrera To: Ron Peacetree Cc: Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Message-ID: <20051109230752.GC8230@surnet.cl> Mail-Followup-To: Ron Peacetree , Yves Vindevogel , pgsql-performance@postgresql.org References: <17035565.1131571489652.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17035565.1131571489652.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.881 required=5 tests=[AWL=-0.364, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 1.881 X-Spam-Level: * X-Archive-Number: 200511/167 X-Sequence-Number: 15424 Ron Peacetree wrote: > 0= Optimize your schema to be a tight as possible. Your goal is to give yourself the maximum chance that everything you want to work on is in RAM when you need it. > 1= Upgrade your RAM to as much as you can possibly strain to afford. 4GB at least. It's that important. > 2= If the _entire_ DB does not fit in RAM after upgrading your RAM, the next step is making sure your HD IO subsystem is adequate to your needs. > 3= Read the various pg tuning docs that are available and Do The Right Thing. > 4= If performance is still not acceptable, then it's time to drill down into what specific actions/queries are problems. > If you get to here and the entire DBMS is still not close to acceptable, your fundamental assumptions have to be re-examined. IMHO you should really be examining your queries _before_ you do any investment in hardware, because later those may prove unnecessary. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Wed Nov 9 22:58:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B2E62DAAA7 for ; Wed, 9 Nov 2005 22:58:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96737-01 for ; Thu, 10 Nov 2005 02:58:22 +0000 (GMT) X-Greylist: delayed 03:05:01.144894 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id E6257DA932 for ; Wed, 9 Nov 2005 22:58:23 -0400 (AST) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr2.postgresql.org (Postfix) with ESMTP id ECE64F12C0 for ; Wed, 9 Nov 2005 23:53:24 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jA9NrFN3006953; Wed, 9 Nov 2005 17:53:15 -0600 Date: Wed, 9 Nov 2005 17:53:32 -0600 From: Frank Wiles To: Alvaro Herrera Cc: rjpeace@earthlink.net, yves.vindevogel@implements.be, pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Message-Id: <20051109175332.3edbd5fc.frank@wiles.org> In-Reply-To: <20051109230752.GC8230@surnet.cl> References: <17035565.1131571489652.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> <20051109230752.GC8230@surnet.cl> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.016 required=5 tests=[AWL=0.016] X-Spam-Score: 0.016 X-Spam-Level: X-Archive-Number: 200511/170 X-Sequence-Number: 15427 On Wed, 9 Nov 2005 20:07:52 -0300 Alvaro Herrera wrote: > IMHO you should really be examining your queries _before_ you do any > investment in hardware, because later those may prove unnecessary. It all really depends on what you're doing. For some of the systems I run, 4 GBs of RAM is *WAY* overkill, RAID 1+0 is overkill, etc. In general I would slightly change the "order of operations" from: 1) Buy tons of RAM 2) Buy lots of disk I/O 3) Tune your conf 4) Examine your queries to 1) Tune your conf 2) Spend a few minutes examining your queries 3) Buy as much RAM as you can afford 4) Buy as much disk I/O as you can 5) Do in depth tuning of your queries/conf Personally I avoid planning my schema around my performance at the start. I just try to represent the data in a sensible, normalized way. While I'm sure I sub-consciously make decisions based on performance considerations early on, I don't do any major schema overhauls until I find I can't get the performance I need via tuning. Obviously there are systems/datasets/quantities where this won't always work out best, but for the majority of systems out there complicating your schema, maxing your hardware, and THEN tuning is IMHO the wrong approach. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Wed Nov 9 20:44:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8229ADA5FB for ; Wed, 9 Nov 2005 20:44:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52845-10 for ; Thu, 10 Nov 2005 00:44:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by svr1.postgresql.org (Postfix) with ESMTP id 8AD7FDA4D7 for ; Wed, 9 Nov 2005 20:44:36 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 09 Nov 2005 21:45:44 -0300 X-IronPort-AV: i="3.97,310,1125892800"; d="scan'208"; a="24361317:sNHT146117720810" Received: from alvh.no-ip.org (216.155.78.23) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 435015970034B36A; Wed, 9 Nov 2005 21:43:20 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 20543C2D450; Wed, 9 Nov 2005 21:43:33 -0300 (CLST) Date: Wed, 9 Nov 2005 21:43:33 -0300 From: Alvaro Herrera To: Frank Wiles Cc: rjpeace@earthlink.net, yves.vindevogel@implements.be, pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Message-ID: <20051110004332.GE8230@surnet.cl> Mail-Followup-To: Frank Wiles , rjpeace@earthlink.net, yves.vindevogel@implements.be, pgsql-performance@postgresql.org References: <17035565.1131571489652.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> <20051109230752.GC8230@surnet.cl> <20051109175332.3edbd5fc.frank@wiles.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20051109175332.3edbd5fc.frank@wiles.org> User-Agent: Mutt/1.5.10i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.12 required=5 tests=[AWL=0.793, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 1.12 X-Spam-Level: * X-Archive-Number: 200511/168 X-Sequence-Number: 15425 Frank Wiles wrote: > Obviously there are systems/datasets/quantities where this won't > always work out best, but for the majority of systems out there > complicating your schema, maxing your hardware, and THEN tuning > is IMHO the wrong approach. I wasn't suggesting to complicate the schema -- I was actually thinking in systems where some queries are not using indexes, some queries are plain wrong, etc. Buying a very expensive RAID and then noticing that you just needed to create an index, is going to make somebody feel at least somewhat stupid. -- Alvaro Herrera Valdivia, Chile ICBM: S 39� 49' 17.7", W 73� 14' 26.8" Y una voz del caos me habl� y me dijo "Sonr�e y s� feliz, podr�a ser peor". Y sonre�. Y fui feliz. Y fue peor. From pgsql-performance-owner@postgresql.org Wed Nov 9 20:54:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 445C9D7E67 for ; Wed, 9 Nov 2005 20:54:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55962-10 for ; Thu, 10 Nov 2005 00:54:34 +0000 (GMT) X-Greylist: delayed 01:01:16.39754 by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 97385DAC10 for ; Wed, 9 Nov 2005 20:54:35 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jAA0sXX3007180; Wed, 9 Nov 2005 18:54:33 -0600 Date: Wed, 9 Nov 2005 18:54:50 -0600 From: Frank Wiles To: Alvaro Herrera Cc: rjpeace@earthlink.net, yves.vindevogel@implements.be, pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Message-Id: <20051109185450.2f20275d.frank@wiles.org> In-Reply-To: <20051110004332.GE8230@surnet.cl> References: <17035565.1131571489652.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> <20051109230752.GC8230@surnet.cl> <20051109175332.3edbd5fc.frank@wiles.org> <20051110004332.GE8230@surnet.cl> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.016 required=5 tests=[AWL=0.016] X-Spam-Score: 0.016 X-Spam-Level: X-Archive-Number: 200511/169 X-Sequence-Number: 15426 On Wed, 9 Nov 2005 21:43:33 -0300 Alvaro Herrera wrote: > Frank Wiles wrote: > > > Obviously there are systems/datasets/quantities where this won't > > always work out best, but for the majority of systems out there > > complicating your schema, maxing your hardware, and THEN tuning > > is IMHO the wrong approach. > > I wasn't suggesting to complicate the schema -- I was actually > thinking in systems where some queries are not using indexes, some > queries are plain wrong, etc. Buying a very expensive RAID and then > noticing that you just needed to create an index, is going to make > somebody feel at least somewhat stupid. Sorry I was referring to Ron statement that the first step should be to "Optimize your schema to be as tight as possible." But I agree, finding out you need an index after spending $$$ on extra hardware would be bad. Especially if you have to explain it to the person forking over the $$$! :) --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Nov 10 00:20:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F465DA5BE for ; Thu, 10 Nov 2005 00:20:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25219-03 for ; Thu, 10 Nov 2005 04:20:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pop-tawny.atl.sa.earthlink.net (pop-tawny.atl.sa.earthlink.net [207.69.195.67]) by svr1.postgresql.org (Postfix) with ESMTP id 18554DA4C2 for ; Thu, 10 Nov 2005 00:20:11 -0400 (AST) Received: from elwamui-hound.atl.sa.earthlink.net ([209.86.224.34]) by pop-tawny.atl.sa.earthlink.net with esmtp (Exim 3.36 #10) id 1Ea3v0-0000nl-00; Wed, 09 Nov 2005 23:20:10 -0500 Message-ID: <1793468.1131596410309.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> Date: Wed, 9 Nov 2005 23:20:10 -0500 (EST) From: Ron Peacetree Reply-To: Ron Peacetree To: Frank Wiles , pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: EarthLink Zoo Mail 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.312 required=5 tests=[AWL=-0.167, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.312 X-Spam-Level: X-Archive-Number: 200511/171 X-Sequence-Number: 15428 The point Gentlemen, was that Good Architecture is King. That's what I was trying to emphasize by calling proper DB architecture step 0. All other things being equal (and they usually aren't, this sort of stuff is _very_ context dependent), the more of your critical schema that you can fit into RAM during normal operation the better. ...and it all starts with proper DB design. Otherwise, you are quite right in stating that you risk wasting time, effort, and HW. Ron -----Original Message----- From: Frank Wiles Sent: Nov 9, 2005 6:53 PM To: Alvaro Herrera Cc: rjpeace@earthlink.net, yves.vindevogel@implements.be, pgsql-performance@postgresql.org Subject: Re: [PERFORM] Some help on buffers and other performance tricks On Wed, 9 Nov 2005 20:07:52 -0300 Alvaro Herrera wrote: > IMHO you should really be examining your queries _before_ you do any > investment in hardware, because later those may prove unnecessary. It all really depends on what you're doing. For some of the systems I run, 4 GBs of RAM is *WAY* overkill, RAID 1+0 is overkill, etc. In general I would slightly change the "order of operations" from: 1) Buy tons of RAM 2) Buy lots of disk I/O 3) Tune your conf 4) Examine your queries to 1) Tune your conf 2) Spend a few minutes examining your queries 3) Buy as much RAM as you can afford 4) Buy as much disk I/O as you can 5) Do in depth tuning of your queries/conf Personally I avoid planning my schema around my performance at the start. I just try to represent the data in a sensible, normalized way. While I'm sure I sub-consciously make decisions based on performance considerations early on, I don't do any major schema overhauls until I find I can't get the performance I need via tuning. Obviously there are systems/datasets/quantities where this won't always work out best, but for the majority of systems out there complicating your schema, maxing your hardware, and THEN tuning is IMHO the wrong approach. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Thu Nov 10 04:50:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 52CCEDAA17 for ; Thu, 10 Nov 2005 04:50:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21371-09 for ; Thu, 10 Nov 2005 08:50:40 +0000 (GMT) X-Greylist: delayed 00:05:03.677166 by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by svr1.postgresql.org (Postfix) with ESMTP id 11F93DA747 for ; Thu, 10 Nov 2005 04:50:40 -0400 (AST) Received: from p508E7143.dip.t-dialin.net [80.142.113.67] (helo=swtexchange2.technology.de) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2Dk-1Ea83r1Gyi-0003P7; Thu, 10 Nov 2005 09:45:35 +0100 content-class: urn:content-classes:message Subject: Re: (View and SQL) VS plpgsql MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Nov 2005 09:45:34 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.0.6556.0 Message-ID: <16F953410A0F1346848DCB476A989CFE01D5D2@swtexchange2.technology.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: (View and SQL) VS plpgsql Thread-Index: AcXlbjcI8fv5lTwCRd6ecpvDfXlSkAAZBSFQAAAER0A= From: =?iso-8859-1?Q?N=F6rder-Tuitje=2C_Marcus?= To: "Eric Lauzon" , X-Provags-ID: kundenserver.de abuse@kundenserver.de login:24478085a861b01e05bdc3b8f80dc176 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.134 required=5 tests=[AWL=0.134] X-Spam-Score: 0.134 X-Spam-Level: X-Archive-Number: 200511/172 X-Sequence-Number: 15429 FOR r_record IN SELECT count(cid) AS hits,src, bid, tid,NULL::int8 as = min_time,NULL::int8 as max_time FROM archive_event WHERE inst=3D\'3\' = AND (utctime BETWEEN \'1114920000\' AND \'1131512399\') GROUP BY src, = bid, tid LOOP SELECT INTO one_record MIN(utctime) as timestart,MAX(utctime) as = timestop from archive_event where src =3Dr_record.src AND bid = =3Dr_record.bid AND tid =3D r_record.tid AND inst =3D\'3\' AND (utctime = BETWEEN \'1114920000\' AND \'1131512399\'); (it seems to me, that you might combine both queries) 1. have you ever tried to select the min/max within the first stmt ? as = i see you are reducing data in second stmt using same key as in stmt 1. 2. you are querying data using two keys (int, utctime). you may create = a combined index speeding up your query 3. same for grouping. you are grouping over three fields. composite = indexing may helps (8.1 supports index based grouping) regards, marcus -----Urspr=FCngliche Nachricht----- Von: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]Im Auftrag von Eric Lauzon Gesendet: Mittwoch, 9. November 2005 21:43 An: pgsql-performance@postgresql.org Betreff: [PERFORM] (View and SQL) VS plpgsql Hello all , i post this question here because i wasen't able to find answer to my question elsewhere , i hope someone can answer. Abstract: The function that can be found at the end of the e-mail emulate two = thing. First it will fill a record set of result with needed column from a = table and two "empty result column" a min and a max. Those two column are then filled by a second query on the same table = that will do a min and a max on an index idx_utctime. The function loop for the first recordset and return a setof record that = is casted by caller to the function. The goald of this is to enabled the application that will receive the = result set to minimise its work by having to group internaly two matching rowset. We use to handle = two resultset but i am looking toward improving performances and at first glance it seem to speed up = the process. Questions: 1. How could this be done in a single combinasion of SQL and view?=20 2. In a case like that is plpgsql really givig significant overhead? 3. Performance difference [I would need a working pure-SQL version to = compare PLANNER and Explain results ] STUFF: --TABLE && INDEX CREATE TABLE archive_event ( inst int4 NOT NULL, cid int8 NOT NULL, src int8 NOT NULL, dst int8 NOT NULL, bid int8 NOT NULL, tid int4 NOT NULL, utctime int4 NOT NULL, CONSTRAINT ids_archives_event_pkey PRIMARY KEY (inst, cid), CONSTRAINT ids_archives_event_cid_index UNIQUE (cid) )=20 --index CREATE INDEX idx_archive_utctime ON archive_event USING btree (utctime); CREATE INDEX idx_archive_src ON archive_event USING btree (src); CREATE INDEX idx_archive_bid_tid ON archive_event USING btree (tid, bid); --FUNCTION CREATE OR REPLACE FUNCTION console_get_source_rule_level_1() RETURNS SETOF RECORD AS ' DECLARE one_record record; r_record record; BEGIN FOR r_record IN SELECT count(cid) AS hits,src, bid, tid,NULL::int8 as = min_time,NULL::int8 as max_time FROM archive_event WHERE inst=3D\'3\' = AND (utctime BETWEEN \'1114920000\' AND \'1131512399\') GROUP BY src, = bid, tid LOOP SELECT INTO one_record MIN(utctime) as timestart,MAX(utctime) as = timestop from archive_event where src =3Dr_record.src AND bid = =3Dr_record.bid AND tid =3D r_record.tid AND inst =3D\'3\' AND (utctime = BETWEEN \'1114920000\' AND \'1131512399\'); r_record.min_time :=3D one_record.timestart; r_record.max_time :=3D one_record.timestop; =20 RETURN NEXT r_record; END LOOP; RETURN; END; ' LANGUAGE 'plpgsql' VOLATILE; GRANT EXECUTE ON FUNCTION console_get_source_rule_level_1() TO console = WITH GRANT OPTION; --FUNCTION CALLER SELECT * from get_source_rule_level_1() AS (hits int8,src int8,bid = int8,tid int4,min_time int8,max_time int8) Eric Lauzon [Recherche & D=E9veloppement] Above S=E9curit=E9 / Above Security T=E9l : (450) 430-8166 Fax : (450) 430-1858=20 ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Thu Nov 10 09:32:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CCF97DAA17 for ; Thu, 10 Nov 2005 09:32:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03285-10 for ; Thu, 10 Nov 2005 13:32:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 53565DA3FA for ; Thu, 10 Nov 2005 09:32:42 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EaCXi-00056o-1h for pgsql-performance@postgresql.org; Thu, 10 Nov 2005 14:32:43 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EaCXh-00013h-00 for ; Thu, 10 Nov 2005 14:32:41 +0100 Date: Thu, 10 Nov 2005 14:32:41 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: WAL sync behaviour Message-ID: <20051110133241.GA4031@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/173 X-Sequence-Number: 15430 Hi, We're having problems with our PostgreSQL server using forever for simple queries, even when there's little load -- or rather, the transactions seem to take forever to commit. We're using 8.1 (yay!) on a single Opteron, with WAL on the system two-disk (software) RAID-1, separate from the database four-disk RAID-10. All drives are 10000rpm SCSI disks, with write cache turned off; we value our data :-) We're running Linux 2.6.13.4, with 64-bit kernel but 32-bit userspace. The main oddity is that simple transactions take forever to execute, even on small tables with no triggers. A COMMIT on an otherwise idle system with one row to commit can take anything from 60-200ms to execute, which seems quite excessive -- sometimes (and I've verified that there's not a checkpoint or vacuum going on at that time), transactions seem to pile up and you get behaviour like: LOG: duration: 836.004 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.100', hostname = 'mivu-03.samfundet.no' WHERE posid = 'mivu-03' LOG: duration: 753.545 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.110', hostname = 'mivu-13.samfundet.no' WHERE posid = 'mivu-13' LOG: duration: 567.914 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.109', hostname = 'mivu-12.samfundet.no' WHERE posid = 'mivu-12' LOG: duration: 515.013 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.105', hostname = 'mivu-08.samfundet.no' WHERE posid = 'mivu-08' LOG: duration: 427.541 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.104', hostname = 'mivu-07.samfundet.no' WHERE posid = 'mivu-07' LOG: duration: 383.314 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.107', hostname = 'mivu-10.samfundet.no' WHERE posid = 'mivu-10' LOG: duration: 348.965 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.103', hostname = 'mivu-06.samfundet.no' WHERE posid = 'mivu-06' LOG: duration: 314.465 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.101', hostname = 'mivu-04.samfundet.no' WHERE posid = 'mivu-04' LOG: duration: 824.893 ms statement: UPDATE mivu3ping SET pingtime = NOW(), ip = '129.241.93.106', hostname = 'mivu-09.samfundet.no' WHERE posid = 'mivu-09' Sometimes, six or seven of these transactions even seem to wait for the same thing, reporting finishing times of something like 6, 5, 4, 3 and 2 seconds right after each other in the log! This is not a highly loaded system, so I don't really see why this should happen. (We had the same problems with 7.4, but if my imagination isn't playing games on me, they seem to have become slightly worse with 8.1.) strace shows that fdatasync() takes almost all that time, but when I run my own fdatasync() test program on the same file system, I can consistently sync a file (after an 8kB write) in about 30ms every time, so I don't really know why this would be so much slower with PostgreSQL. We're using the cfq scheduler, but deadline and noop give about the same results. Setting wal_sync_method = open_sync seems to improve the situation dramatically on simple commits; we get down into the 10-30ms range on an idle system. OTOH, behaviour seems to get slightly worse when there's more stuff going on, and we still get the 300ms transactions in batches every now and then. Any good ideas? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Nov 10 12:52:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 32A1DDB157 for ; Thu, 10 Nov 2005 12:51:58 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73900-06 for ; Thu, 10 Nov 2005 16:51:55 +0000 (GMT) X-Greylist: delayed 03:09:02.48297 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 9EC19DB059 for ; Thu, 10 Nov 2005 12:51:51 -0400 (AST) Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by svr2.postgresql.org (Postfix) with ESMTP id 93C52F0BD8 for ; Thu, 10 Nov 2005 13:42:57 +0000 (GMT) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Thu, 10 Nov 2005 05:42:54 -0800 Received: from 172.16.0.166 ([172.16.0.166]) by egcrc-ex01.egcrc.org ([172.16.1.4]) with Microsoft Exchange Server HTTP-DAV ; Thu, 10 Nov 2005 13:42:54 +0000 Received: from enzian by egcrc-ex01.egcrc.org; 10 Nov 2005 05:42:56 -0800 Subject: same plan, add 1 condition, 1900x slower From: Mitch Skinner To: pgsql-performance@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 10 Nov 2005 05:42:56 -0800 Message-Id: <1131630176.29496.91.camel@enzian> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 10 Nov 2005 13:42:54.0424 (UTC) FILETIME=[A6E17580:01C5E5FC] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/186 X-Sequence-Number: 15443 This is with Postgres 8.0.3. Any advice is appreciated. I'm not sure exactly what I expect, but I was hoping that if it used the external_id_map_source_target_id index it would be faster. Mainly I was surprised that the same plan could perform so much differently with just an extra condition. I've increased the statistics target on util.external_id_map.source, but I'm fuzzy on exactly where (what columns) the planner could use more information. statgen=> explain analyze select * from subject_source; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Merge Join (cost=0.00..316.79 rows=1186 width=46) (actual time=0.136..9.808 rows=1186 loops=1) Merge Cond: ("outer".id = "inner".target_id) -> Index Scan using subject_pkey on subject norm (cost=0.00..63.36 rows=1186 width=28) (actual time=0.050..1.834 rows=1186 loops=1) -> Index Scan using external_id_map_primary_key on external_id_map eim (cost=0.00..2345747.01 rows=15560708 width=26) (actual time=0.061..2.944 rows=2175 loops=1) Total runtime: 10.745 ms (5 rows) statgen=> explain analyze select * from subject_source where source='SCH'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Merge Join (cost=0.00..640.95 rows=1 width=46) (actual time=0.043..21074.403 rows=1186 loops=1) Merge Cond: ("outer".id = "inner".target_id) -> Index Scan using subject_pkey on subject norm (cost=0.00..63.36 rows=1186 width=28) (actual time=0.014..1.478 rows=1186 loops=1) -> Index Scan using external_id_map_primary_key on external_id_map eim (cost=0.00..2384648.78 rows=4150 width=26) (actual time=0.020..21068.508 rows=1186 loops=1) Filter: (source = 'SCH'::bpchar) Total runtime: 21075.142 ms (6 rows) statgen=> \d subject Table "public.subject" Column | Type | Modifiers ---------+---------+----------- id | bigint | not null sex | integer | parent1 | bigint | parent2 | bigint | Indexes: "subject_pkey" PRIMARY KEY, btree (id) Foreign-key constraints: "subject_parent1" FOREIGN KEY (parent1) REFERENCES subject(id) DEFERRABLE INITIALLY DEFERRED "subject_parent2" FOREIGN KEY (parent2) REFERENCES subject(id) DEFERRABLE INITIALLY DEFERRED "subject_id_map" FOREIGN KEY (id) REFERENCES util.external_id_map(target_id) DEFERRABLE INITIALLY DEFERRED statgen=> \d subject_source View "public.subject_source" Column | Type | Modifiers -----------+-----------------------+----------- id | bigint | sex | integer | parent1 | bigint | parent2 | bigint | source | character(3) | source_id | character varying(32) | View definition: SELECT norm.id, norm.sex, norm.parent1, norm.parent2, eim.source, eim.source_id FROM subject norm JOIN util.external_id_map eim ON norm.id = eim.target_id; statgen=> \d util.external_id_map Table "util.external_id_map" Column | Type | Modifiers -----------+-----------------------+----------- source_id | character varying(32) | not null source | character(3) | not null target_id | bigint | not null Indexes: "external_id_map_primary_key" PRIMARY KEY, btree (target_id) "external_id_map_source_source_id_unique" UNIQUE, btree (source, source_id) "external_id_map_source" btree (source) "external_id_map_source_target_id" btree (source, target_id) Foreign-key constraints: "external_id_map_source" FOREIGN KEY (source) REFERENCES util.source(id) Thanks in advance, Mitch From pgsql-performance-owner@postgresql.org Thu Nov 10 10:17:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 245A7DA4C2 for ; Thu, 10 Nov 2005 10:17:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18095-06 for ; Thu, 10 Nov 2005 14:16:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id B8D1DD9CDC for ; Thu, 10 Nov 2005 10:16:58 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id E1A7640127E; Thu, 10 Nov 2005 14:15:14 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 2402515ED9; Thu, 10 Nov 2005 14:14:35 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30593-08; Thu, 10 Nov 2005 14:14:31 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 20FBF15ED5; Thu, 10 Nov 2005 14:14:31 +0000 (GMT) Message-ID: <437355C6.4030604@archonet.com> Date: Thu, 10 Nov 2005 14:14:30 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Steinar H. Gunderson" Cc: pgsql-performance@postgresql.org Subject: Re: WAL sync behaviour References: <20051110133241.GA4031@uio.no> In-Reply-To: <20051110133241.GA4031@uio.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.031 required=5 tests=[AWL=0.031] X-Spam-Score: 0.031 X-Spam-Level: X-Archive-Number: 200511/174 X-Sequence-Number: 15431 Steinar H. Gunderson wrote: > Hi, > > We're having problems with our PostgreSQL server using forever for simple > queries, even when there's little load -- or rather, the transactions seem > to take forever to commit. We're using 8.1 (yay!) on a single Opteron, with > WAL on the system two-disk (software) RAID-1, separate from the database > four-disk RAID-10. All drives are 10000rpm SCSI disks, with write cache > turned off; we value our data :-) We're running Linux 2.6.13.4, with 64-bit > kernel but 32-bit userspace. You're beyond my area of expertise, but I do know that someone's going to ask what filesystem this is (ext2/xfs/etc). And probably to see the strace too. Hmm - the only things I can think to check: Do vmstat/iostat show any unusual activity? Are your system logs on these disks too? Could it be the journalling on the fs clashing with the WAL? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Nov 10 10:25:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD1CDDAFCE for ; Thu, 10 Nov 2005 10:25:36 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22939-02 for ; Thu, 10 Nov 2005 14:25:32 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 562E3DAF90 for ; Thu, 10 Nov 2005 10:25:33 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EaDMt-0001M1-Vc for pgsql-performance@postgresql.org; Thu, 10 Nov 2005 15:25:37 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EaDMt-0001Bu-00 for ; Thu, 10 Nov 2005 15:25:35 +0100 Date: Thu, 10 Nov 2005 15:25:35 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: WAL sync behaviour Message-ID: <20051110142535.GA4530@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <437355C6.4030604@archonet.com> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/175 X-Sequence-Number: 15432 On Thu, Nov 10, 2005 at 02:14:30PM +0000, Richard Huxton wrote: > You're beyond my area of expertise, but I do know that someone's going > to ask what filesystem this is (ext2/xfs/etc). Ah, yes, I forgot -- it's ext3. We're considering simply moving the WAL onto a separate partition (with data=writeback and noatime) if that can help us any. > And probably to see the strace too. The strace with wal_sync_method = fdatasync goes like this (I attach just before I do the commit): cirkus:~> sudo strace -T -p 15718 Process 15718 attached - interrupt to quit read(8, "\27\3\1\0 ", 5) = 5 <2.635856> read(8, "\336\333\24KB\325Ga\324\264[\307v\254h\254\350\20\220a"..., 32) = 32 <0.000031> read(8, "\27\3\1\0000", 5) = 5 <0.000027> read(8, "$E\217 send(7, "\3\0\0\0\30\0\0\0\20\0\0\0f=\0\0commit;\0", 24, 0) = 24 <0.000071> gettimeofday({1131632603, 187599}, NULL) = 0 <0.000026> time(NULL) = 1131632603 <0.000027> open("pg_xlog/0000000100000000000000A2", O_RDWR|O_LARGEFILE) = 14 <0.000039> _llseek(14, 12500992, [12500992], SEEK_SET) = 0 <0.000026> write(14, "]\320\1\0\1\0\0\0\0\0\0\0\0\300\276\242\362\0\0\0\31\0"..., 8192) = 8192 <0.000057> fdatasync(14) = 0 <0.260194> gettimeofday({1131632603, 448459}, NULL) = 0 <0.000034> time(NULL) = 1131632603 <0.000027> time([1131632603]) = 1131632603 <0.000025> getpid() = 15718 <0.000025> rt_sigaction(SIGPIPE, {0x558a27e0, [], 0}, {SIG_IGN}, 8) = 0 <0.000029> send(3, "<134>Nov 10 15:23:23 postgres[15"..., 121, 0) = 121 <0.000032> rt_sigaction(SIGPIPE, {SIG_IGN}, NULL, 8) = 0 <0.000029> send(7, "\4\0\0\0\330\3\0\0\20\0\0\0f=\0\0\247@\0\0\16\0\0\0\1\0"..., 984, 0) = 984 <0.000076> send(7, "\4\0\0\0\330\3\0\0\20\0\0\0f=\0\0\247@\0\0\16\0\0\0\0\0"..., 984, 0) = 984 <0.000051> send(7, "\4\0\0\0\330\3\0\0\20\0\0\0f=\0\0\247@\0\0\16\0\0\0\0\0"..., 984, 0) = 984 <0.000050> send(7, "\4\0\0\0\250\0\0\0\20\0\0\0f=\0\0\247@\0\0\2\0\0\0\0\0"..., 168, 0) = 168 <0.000050> send(7, "\4\0\0\0\250\0\0\0\20\0\0\0f=\0\0\0\0\0\0\2\0\0\0\0\0\0"..., 168, 0) = 168 <0.000049> send(7, "\3\0\0\0\27\0\0\0\20\0\0\0f=\0\0\0", 23, 0) = 23 <0.000047> write(8, "\27\3\1\0 B\260\253rq)\232\265o\225\272\235\v\375\31\323"..., 90) = 90 <0.000229> read(8, Process 15718 detached > Do vmstat/iostat show any unusual activity? No, there's not much activity. In fact, it's close to idle. > Are your system logs on these disks too? Yes, they are, but nothing much is logged, really -- and sync is off for most of the logs in syslogd. > Could it be the journalling on the fs clashing with the WAL? Unsure -- that's what I was hoping to get some information on :-) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Nov 10 11:43:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 64853D8BF3 for ; Thu, 10 Nov 2005 11:43:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52260-06 for ; Thu, 10 Nov 2005 15:43:10 +0000 (GMT) X-Greylist: delayed 01:00:03.527391 by SQLgrey- Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by svr1.postgresql.org (Postfix) with ESMTP id A02F6D89CA for ; Thu, 10 Nov 2005 11:43:11 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.64.202]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IPQ00K7XU7XQQ70@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 10 Nov 2005 08:43:10 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 867416001EE for ; Thu, 10 Nov 2005 09:43:09 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29980-06-3 for ; Thu, 10 Nov 2005 09:43:09 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 6B30E6001E3; Thu, 10 Nov 2005 09:43:09 -0500 (EST) Date: Thu, 10 Nov 2005 09:43:09 -0500 From: Michael Stone Subject: Re: WAL sync behaviour In-reply-to: <20051110142535.GA4530@uio.no> To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20051110144309.GO9905@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200511/178 X-Sequence-Number: 15435 On Thu, Nov 10, 2005 at 03:25:35PM +0100, Steinar H. Gunderson wrote: >Ah, yes, I forgot -- it's ext3. We're considering simply moving the WAL onto >a separate partition (with data=writeback and noatime) if that can help us >any. There's no reason to use a journaled filesystem for the wal. Use ext2 in preference to ext3. Mike Stone From pgsql-performance-owner@postgresql.org Thu Nov 10 11:16:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DD6EFD8FC5 for ; Thu, 10 Nov 2005 11:16:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36868-08 for ; Thu, 10 Nov 2005 15:16:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 2A99ED7BB0 for ; Thu, 10 Nov 2005 11:16:06 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 10 Nov 2005 09:16:10 -0600 Subject: Re: Some help on buffers and other performance tricks From: Scott Marlowe To: Ron Peacetree Cc: Frank Wiles , pgsql-performance@postgresql.org In-Reply-To: <1793468.1131596410309.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> References: <1793468.1131596410309.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1131635770.3554.58.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 10 Nov 2005 09:16:10 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.006, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/176 X-Sequence-Number: 15433 On Wed, 2005-11-09 at 22:20, Ron Peacetree wrote: > The point Gentlemen, was that Good Architecture is King. That's what I was trying to emphasize by calling proper DB architecture step 0. All other things being equal (and they usually aren't, this sort of stuff is _very_ context dependent), the more of your critical schema that you can fit into RAM during normal operation the better. > > ...and it all starts with proper DB design. Otherwise, you are quite right in stating that you risk wasting time, effort, and HW. Very valid point. It's the reason, in my last job, we had a mainline server with dual 2800MHz CPUs and a big RAID array. And our development, build and test system was a Dual Pentium Pro 200 with 256 Meg of ram. You notice slow queries real fast on such a box. From pgsql-performance-owner@postgresql.org Thu Nov 10 11:24:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 75A68DB12C for ; Thu, 10 Nov 2005 11:24:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41811-08 for ; Thu, 10 Nov 2005 15:24:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 72D33DB0E7 for ; Thu, 10 Nov 2005 11:24:42 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jAAFOhXR009054; Thu, 10 Nov 2005 09:24:44 -0600 Date: Thu, 10 Nov 2005 09:25:01 -0600 From: Frank Wiles To: Scott Marlowe Cc: pgsql-performance@postgresql.org Subject: Re: Some help on buffers and other performance tricks Message-Id: <20051110092501.36663aa4.frank@wiles.org> In-Reply-To: <1131635770.3554.58.camel@state.g2switchworks.com> References: <1793468.1131596410309.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> <1131635770.3554.58.camel@state.g2switchworks.com> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.015 required=5 tests=[AWL=0.015] X-Spam-Score: 0.015 X-Spam-Level: X-Archive-Number: 200511/177 X-Sequence-Number: 15434 On Thu, 10 Nov 2005 09:16:10 -0600 Scott Marlowe wrote: > Very valid point. It's the reason, in my last job, we had a mainline > server with dual 2800MHz CPUs and a big RAID array. > > And our development, build and test system was a Dual Pentium Pro 200 > with 256 Meg of ram. You notice slow queries real fast on such a box. I know several people who use this development method. It can sometimes lead to premature optimizations, but overall I think it is a great way to work. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Nov 10 11:43:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 74859D8FC5 for ; Thu, 10 Nov 2005 11:43:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45211-10 for ; Thu, 10 Nov 2005 15:43:44 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (c-24-11-237-16.hsd1.mi.comcast.net [24.11.237.16]) by svr1.postgresql.org (Postfix) with ESMTP id B97FDD89CA for ; Thu, 10 Nov 2005 11:43:46 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Some help on buffers and other performance tricks Date: Thu, 10 Nov 2005 10:43:50 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD84A@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Some help on buffers and other performance tricks Thread-Index: AcXlrtjZZr9lrQTFTfKQB2f7ayk1AAAXYC4Q From: "Merlin Moncure" To: "Ron Peacetree" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.242 required=5 tests=[AWL=-0.746, RCVD_IN_SORBS_DUL=1.988] X-Spam-Score: 1.242 X-Spam-Level: * X-Archive-Number: 200511/179 X-Sequence-Number: 15436 > The point Gentlemen, was that Good Architecture is King. That's what I > was trying to emphasize by calling proper DB architecture step 0. All > other things being equal (and they usually aren't, this sort of stuff is > _very_ context dependent), the more of your critical schema that you can > fit into RAM during normal operation the better. >=20 > ...and it all starts with proper DB design. Otherwise, you are quite > right in stating that you risk wasting time, effort, and HW. >=20 > Ron +1! I answer lots of question on this list that are in the form of 'query x is running to slow'. Often, the first thing that pops in my mind is 'why are you running query x in the first place?' =20 The #1 indicator that something is not right is 'distinct' clause. Distinct (and its evil cousin, union) are often brought in to address problems. The human brain is the best optimizer. Even on old hardware the server can handle a *lot* of data. It's just about where we add inefficiency...lousy database designs lead to lousy queries or (even worse) extra application code. Merlin From pgsql-performance-owner@postgresql.org Thu Nov 10 11:51:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7F018D90DA for ; Thu, 10 Nov 2005 11:51:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56812-01 for ; Thu, 10 Nov 2005 15:51:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id BB7EDD7C91 for ; Thu, 10 Nov 2005 11:51:09 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 10 Nov 2005 09:51:14 -0600 Subject: Re: Some help on buffers and other performance tricks From: Scott Marlowe To: Frank Wiles Cc: pgsql-performance@postgresql.org In-Reply-To: <20051110092501.36663aa4.frank@wiles.org> References: <1793468.1131596410309.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> <1131635770.3554.58.camel@state.g2switchworks.com> <20051110092501.36663aa4.frank@wiles.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1131637874.3554.73.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 10 Nov 2005 09:51:14 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.006, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/180 X-Sequence-Number: 15437 On Thu, 2005-11-10 at 09:25, Frank Wiles wrote: > On Thu, 10 Nov 2005 09:16:10 -0600 > Scott Marlowe wrote: > > > Very valid point. It's the reason, in my last job, we had a mainline > > server with dual 2800MHz CPUs and a big RAID array. > > > > And our development, build and test system was a Dual Pentium Pro 200 > > with 256 Meg of ram. You notice slow queries real fast on such a box. > > I know several people who use this development method. It can > sometimes lead to premature optimizations, but overall I think it is > a great way to work. Hehe. Yeah, you get used to things running a bit slower pretty quickly. Keep in mind though, that the test box is likely only supporting one single application at a time, whereas the production server may be running dozens or even hundreds of apps, so it's important to catch performance issues before they get to production. Plus, the Dual PPRo 200 WAS running a decent RAID array, even if it was a linux kernel software RAID and not hardware. But it was on 8 9 gigabyte SCSI drives, so it was quite fast for reads. In actuality, a lot of the folks developed their code on their own workstations (generally 1+GHz machines with 1G or more of ram) then had to move them over to the ppro 200 for testing and acceptance. So that kind of helps stop the premature optimizations. We were mainly looking to catch stupidity before it got to production. From pgsql-performance-owner@postgresql.org Thu Nov 10 11:52:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 07D34D89CA for ; Thu, 10 Nov 2005 11:52:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57127-02 for ; Thu, 10 Nov 2005 15:52:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 85DB2D7C91 for ; Thu, 10 Nov 2005 11:52:33 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 10 Nov 2005 09:52:38 -0600 Subject: Re: WAL sync behaviour From: Scott Marlowe To: Michael Stone Cc: pgsql-performance@postgresql.org In-Reply-To: <20051110144309.GO9905@mathom.us> References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1131637958.3554.75.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 10 Nov 2005 09:52:38 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.006, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/181 X-Sequence-Number: 15438 On Thu, 2005-11-10 at 08:43, Michael Stone wrote: > On Thu, Nov 10, 2005 at 03:25:35PM +0100, Steinar H. Gunderson wrote: > >Ah, yes, I forgot -- it's ext3. We're considering simply moving the WAL onto > >a separate partition (with data=writeback and noatime) if that can help us > >any. > > There's no reason to use a journaled filesystem for the wal. Use ext2 in > preference to ext3. Not from what I understood. Ext2 can't guarantee that your data will even be there in any form after a crash. I believe only metadata journaling is needed though. From pgsql-performance-owner@postgresql.org Thu Nov 10 12:04:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B0E13DB1D4 for ; Thu, 10 Nov 2005 12:03:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59891-07 for ; Thu, 10 Nov 2005 16:03:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by svr1.postgresql.org (Postfix) with ESMTP id 90A7ADB178 for ; Thu, 10 Nov 2005 12:03:55 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.64.202]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IPQ0055QXTJJOB1@vms048.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 10 Nov 2005 10:00:56 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 33BDB6001EE; Thu, 10 Nov 2005 11:00:55 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30964-05-4; Thu, 10 Nov 2005 11:00:55 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 15B296001D7; Thu, 10 Nov 2005 11:00:55 -0500 (EST) Date: Thu, 10 Nov 2005 11:00:55 -0500 From: Michael Stone Subject: Re: WAL sync behaviour In-reply-to: <1131637958.3554.75.camel@state.g2switchworks.com> To: Scott Marlowe Cc: pgsql-performance@postgresql.org Mail-Followup-To: Scott Marlowe , pgsql-performance@postgresql.org Message-id: <20051110160054.GP9905@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> <1131637958.3554.75.camel@state.g2switchworks.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200511/182 X-Sequence-Number: 15439 On Thu, Nov 10, 2005 at 09:52:38AM -0600, Scott Marlowe wrote: >Not from what I understood. Ext2 can't guarantee that your data will >even be there in any form after a crash. It can if you sync the data. (Which is the whole point of the WAL.) >I believe only metadata journaling is needed though. If you don't sync, metadata journaling doesn't do anything to guarantee that your data will be there, so you're adding no data security in the non-synchronous-write case. (Which is irrelevant for the WAL.) What metadata journalling gets you is fast recovery from crashes by avoiding a fsck. The fsck time is related to the number of files on a filesystem--so it's generally pretty quick on a WAL partition anyway. Mike Stone From pgsql-performance-owner@postgresql.org Thu Nov 10 12:23:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 191C0DA081 for ; Thu, 10 Nov 2005 12:23:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61309-09 for ; Thu, 10 Nov 2005 16:23:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pop-altamira.atl.sa.earthlink.net (pop-altamira.atl.sa.earthlink.net [207.69.195.62]) by svr1.postgresql.org (Postfix) with ESMTP id 24BA4D7BAF for ; Thu, 10 Nov 2005 12:23:30 -0400 (AST) Received: from elwamui-hound.atl.sa.earthlink.net ([209.86.224.34]) by pop-altamira.atl.sa.earthlink.net with esmtp (Exim 3.36 #10) id 1EaFCt-000011-00; Thu, 10 Nov 2005 11:23:23 -0500 Message-ID: <16531385.1131639803429.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> Date: Thu, 10 Nov 2005 11:23:23 -0500 (EST) From: Ron Peacetree Reply-To: Ron Peacetree To: Kurt De Grave , pgsql-performance@postgresql.org Subject: Re: Sort performance on large tables Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: EarthLink Zoo Mail 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.312 required=5 tests=[AWL=-0.167, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.312 X-Spam-Level: X-Archive-Number: 200511/183 X-Sequence-Number: 15440 My original post did not take into account VAT, I apologize for that oversight. However, unless you are naive, or made of gold, or have some sort of "special" relationship that requires you to, _NE VER_ buy RAM from your computer HW OEM. For at least two decades it's been a provable fact that OEMs like DEC, Sun, HP, Compaq, Dell, etc, etc charge far more per GB for the RAM they sell. Same goes for HDs. Buy your memory and HDs direct from reputable manufacturers, you'll get at least the same quality and pay considerably less. Your Dell example is evidence that supports my point. As of this writing, decent RAM should cost $75-$150 pr GB (not including VAT ;-) ). Don't let yourself be conned into paying more. I'm talking about decent RAM from reputable direct suppliers like Corsair and Kingston (_not_ their Value RAM, the actual Kingston branded stuff), OCZ, etc. Such companies sell via multiple channels, including repuatble websites like dealtime.com, pricewatch.com, newegg.com, etc, etc. You are quite correct that there's poor quality junk out there. I was not talking about it, only reasonable quality components. Ron -----Original Message----- From: Kurt De Grave Sent: Nov 10, 2005 5:40 AM To: Ron Peacetree Cc: Charlie Savage , pgsql-performance@postgresql.org Subject: Re: [PERFORM] Sort performance on large tables On Wed, 9 Nov 2005, Ron Peacetree wrote: > At this writing, 4 1GB DIMMs (4GB) should set you back ~$300 or less. > 4 2GB DIMMs (8GB) should cost ~$600. As of now, very few mainboards > support 4GB DIMMs and I doubt the D3000 has such a mainboard. If you > can use them, 4 4GB DIMMs (16GB) will currently set you back > ~$1600-$2400. Sorry, but every time again I see unrealistic memory prices quoted when the buy-more-memory argument passes by. What kind of memory are you buying for your servers? Non-ECC no-name memory that doesn't even pass a one-hour memtest86 for 20% of the items you buy? Just checked at Dell's web page: adding 4 1GB DIMMs to a PowerEdge 2850 sets you back _1280 EURO_ excluding VAT. And that's after they already charged you 140 euro for replacing the obsolete standard 4 512MB DIMMs with the same capacity in 1GB DIMMs. So the 4GB upgrade actually costs 1420 euro plus VAT, which is quite a bit more than $300. Okay, few people will happily buy at those prices. You can get the exact same goods much cheaper elsewhere, but it'll still cost you way more than the number you gave, plus you'll have to drive to the server's location, open up the box yourself, and risk incompatibilities and support problems if there's ever something wrong with that memory. Disclaimers: I know that you're talking about a desktop in this particular case. I wouldn't see a need for ECC in a development box either. I know a Dell hasn't been the smartest choice for a database box lately (but politics...). kurt. From pgsql-performance-owner@postgresql.org Thu Nov 10 12:34:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 439BCD7BAF for ; Thu, 10 Nov 2005 12:34:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67703-07 for ; Thu, 10 Nov 2005 16:34:04 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 822DDD7B75 for ; Thu, 10 Nov 2005 12:34:04 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so383386wri for ; Thu, 10 Nov 2005 08:34:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sVJL0tFT0QGeEnp3PIycXcDOWh7oy/KLYS/ffmFWRMqpDZ+64tNpGk1aroSNyqzFm9W/ZhYH+Y3ngx4aQm9VRYyK0tUsGAslS1By0fDnTUNRP5MbhIWFX4kTZVuxaIy4/bK/aCqYBVWoHdHtYlOPy2J/V0TZOGehmj9amE+gAbE= Received: by 10.54.142.2 with SMTP id p2mr813453wrd; Thu, 10 Nov 2005 08:34:03 -0800 (PST) Received: by 10.54.83.19 with HTTP; Thu, 10 Nov 2005 08:34:03 -0800 (PST) Message-ID: <33c6269f0511100834q718e5274mf7230fe95ab8323e@mail.gmail.com> Date: Thu, 10 Nov 2005 11:34:03 -0500 From: Alex Turner To: Ron Peacetree Subject: Re: Sort performance on large tables Cc: Kurt De Grave , pgsql-performance@postgresql.org In-Reply-To: <16531385.1131639803429.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <16531385.1131639803429.JavaMail.root@elwamui-hound.atl.sa.earthlink.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.092 required=5 tests=[AWL=0.092] X-Spam-Score: 0.092 X-Spam-Level: X-Archive-Number: 200511/184 X-Sequence-Number: 15441 We use this memory in all our servers (well - the 512 sticks). 0 problems to date: http://www.newegg.com/Product/Product.asp?Item=3DN82E16820145513 $163 for 1GB. This stuff is probably better than the Samsung RAM dell is selling you for 3 times the price. Alex On 11/10/05, Ron Peacetree wrote: > My original post did not take into account VAT, I apologize for that over= sight. > > However, unless you are naive, or made of gold, or have some sort of "spe= cial" relationship that requires you to, _NE VER_ buy RAM from your compute= r HW OEM. For at least two decades it's been a provable fact that OEMs lik= e DEC, Sun, HP, Compaq, Dell, etc, etc charge far more per GB for the RAM t= hey sell. Same goes for HDs. Buy your memory and HDs direct from reputabl= e manufacturers, you'll get at least the same quality and pay considerably = less. > > Your Dell example is evidence that supports my point. As of this writing= , decent RAM should cost $75-$150 pr GB (not including VAT ;-) ). Don't l= et yourself be conned into paying more. > > I'm talking about decent RAM from reputable direct suppliers like Corsair= and Kingston (_not_ their Value RAM, the actual Kingston branded stuff), O= CZ, etc. Such companies sell via multiple channels, including repuatble we= bsites like dealtime.com, pricewatch.com, newegg.com, etc, etc. > > You are quite correct that there's poor quality junk out there. I was no= t talking about it, only reasonable quality components. > > Ron > > > -----Original Message----- > From: Kurt De Grave > Sent: Nov 10, 2005 5:40 AM > To: Ron Peacetree > Cc: Charlie Savage , pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Sort performance on large tables > > > > On Wed, 9 Nov 2005, Ron Peacetree wrote: > > > At this writing, 4 1GB DIMMs (4GB) should set you back ~$300 or less. > > 4 2GB DIMMs (8GB) should cost ~$600. As of now, very few mainboards > > support 4GB DIMMs and I doubt the D3000 has such a mainboard. If you > > can use them, 4 4GB DIMMs (16GB) will currently set you back > > ~$1600-$2400. > > Sorry, but every time again I see unrealistic memory prices quoted when > the buy-more-memory argument passes by. > What kind of memory are you buying for your servers? Non-ECC no-name > memory that doesn't even pass a one-hour memtest86 for 20% of the items > you buy? > > Just checked at Dell's web page: adding 4 1GB DIMMs to a PowerEdge 2850 > sets you back _1280 EURO_ excluding VAT. And that's after they already > charged you 140 euro for replacing the obsolete standard 4 512MB DIMMs > with the same capacity in 1GB DIMMs. So the 4GB upgrade actually costs > 1420 euro plus VAT, which is quite a bit more than $300. > > Okay, few people will happily buy at those prices. You can get the > exact same goods much cheaper elsewhere, but it'll still cost you way > more than the number you gave, plus you'll have to drive to the server's > location, open up the box yourself, and risk incompatibilities and > support problems if there's ever something wrong with that memory. > > Disclaimers: > I know that you're talking about a desktop in this particular case. > I wouldn't see a need for ECC in a development box either. > I know a Dell hasn't been the smartest choice for a database box lately > (but politics...). > > kurt. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Thu Nov 10 12:39:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B1F33D9DFD for ; Thu, 10 Nov 2005 12:39:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68950-09 for ; Thu, 10 Nov 2005 16:39:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 35C00D8FC5 for ; Thu, 10 Nov 2005 12:39:36 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAAGdYFW009792; Thu, 10 Nov 2005 11:39:34 -0500 (EST) To: Scott Marlowe Cc: Michael Stone , pgsql-performance@postgresql.org Subject: Re: WAL sync behaviour In-reply-to: <1131637958.3554.75.camel@state.g2switchworks.com> References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> <1131637958.3554.75.camel@state.g2switchworks.com> Comments: In-reply-to Scott Marlowe message dated "Thu, 10 Nov 2005 09:52:38 -0600" Date: Thu, 10 Nov 2005 11:39:34 -0500 Message-ID: <9791.1131640774@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/185 X-Sequence-Number: 15442 Scott Marlowe writes: > On Thu, 2005-11-10 at 08:43, Michael Stone wrote: >> There's no reason to use a journaled filesystem for the wal. Use ext2 in >> preference to ext3. > Not from what I understood. Ext2 can't guarantee that your data will > even be there in any form after a crash. I believe only metadata > journaling is needed though. No, Mike is right: for WAL you shouldn't need any journaling. This is because we zero out *and fsync* an entire WAL file before we ever consider putting live WAL data in it. During live use of a WAL file, its metadata is not changing. As long as the filesystem follows the minimal rule of syncing metadata about a file when it fsyncs the file, all the live WAL files should survive crashes OK. We can afford to do this mainly because WAL files can normally be recycled instead of created afresh, so the zero-out overhead doesn't get paid during normal operation. You do need metadata journaling for all non-WAL PG files, since we don't fsync them every time we extend them; which means the filesystem could lose track of which disk blocks belong to such a file, if it's not journaled. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 13:11:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 98EE9DAA17 for ; Thu, 10 Nov 2005 13:11:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03886-09 for ; Thu, 10 Nov 2005 17:11:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.envyfinancial.com (unknown [206.248.142.186]) by svr1.postgresql.org (Postfix) with ESMTP id 313A5DA7BA for ; Thu, 10 Nov 2005 13:11:53 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.envyfinancial.com (Postfix) with ESMTP id BDBE21D9B9; Thu, 10 Nov 2005 11:53:13 -0500 (EST) Received: from mail.envyfinancial.com ([127.0.0.1]) by localhost (mark.mielke.cc [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14478-02; Thu, 10 Nov 2005 11:53:13 -0500 (EST) Received: by mail.envyfinancial.com (Postfix, from userid 500) id 7BC701D9D1; Thu, 10 Nov 2005 11:53:13 -0500 (EST) Date: Thu, 10 Nov 2005 11:53:13 -0500 From: mark@mark.mielke.cc To: Tom Lane Cc: Scott Marlowe , Michael Stone , pgsql-performance@postgresql.org Subject: Re: WAL sync behaviour Message-ID: <20051110165313.GA14444@mark.mielke.cc> References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> <1131637958.3554.75.camel@state.g2switchworks.com> <9791.1131640774@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9791.1131640774@sss.pgh.pa.us> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: amavisd-new at mail.envyfinancial.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.399 required=5 tests=[AWL=-0.151, NO_REAL_NAME=0.55] X-Spam-Score: 0.399 X-Spam-Level: X-Archive-Number: 200511/189 X-Sequence-Number: 15446 On Thu, Nov 10, 2005 at 11:39:34AM -0500, Tom Lane wrote: > No, Mike is right: for WAL you shouldn't need any journaling. This is > because we zero out *and fsync* an entire WAL file before we ever > consider putting live WAL data in it. During live use of a WAL file, > its metadata is not changing. As long as the filesystem follows > the minimal rule of syncing metadata about a file when it fsyncs the > file, all the live WAL files should survive crashes OK. Yes, with emphasis on the zero out... :-) > You do need metadata journaling for all non-WAL PG files, since we don't > fsync them every time we extend them; which means the filesystem could > lose track of which disk blocks belong to such a file, if it's not > journaled. I think there may be theoretical problems with regard to the ordering of the fsync operation, for files that are not pre-allocated. For example, if a new block is allocated - there are two blocks that need to be updated. The indirect reference block (or inode block, if block references fit into the inode entry), and the block itself. If the indirect reference block is written first, before the data block, the state of the disk is inconsistent. This would be a crash during the fsync() operation. The metadata journalling can ensure that the data block is allocated first, and then all the necessary references updated, allowing for the operation to be incomplete and rolled back, or committed in full. Or, that is my understanding, anyways, and this is why I would not use ext2 for the database, even if it was claimed that fsync() was used. For WAL, with pre-allocated zero blocks? Sure. Ext2... :-) mark -- mark@mielke.cc / markm@ncf.ca / markm@nortel.com __________________________ . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them... http://mark.mielke.cc/ From pgsql-performance-owner@postgresql.org Thu Nov 10 12:59:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 027EADA461 for ; Thu, 10 Nov 2005 12:59:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75412-09 for ; Thu, 10 Nov 2005 16:59:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id AD7B9D70C0 for ; Thu, 10 Nov 2005 12:59:27 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D832E31059; Thu, 10 Nov 2005 17:59:26 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Index Scan Costs versus Sort Date: Thu, 10 Nov 2005 09:59:21 -0700 Organization: Hub.Org Networking Services Lines: 324 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/187 X-Sequence-Number: 15444 This is related to my post the other day about sort performance. Part of my problem seems to be that postgresql is greatly overestimating the cost of index scans. As a result, it prefers query plans that involve seq scans and sorts versus query plans that use index scans. Here is an example query: SELECT tlid, count(tlid) FROM completechain GROUP BY tlid; Approach #1 - seq scan with sort: "GroupAggregate (cost=10177594.61..11141577.89 rows=48199164 width=4) (actual time=7439085.877..8429628.234 rows=47599910 loops=1)" " -> Sort (cost=10177594.61..10298092.52 rows=48199164 width=4) (actual time=7439085.835..8082452.721 rows=48199165 loops=1)" " Sort Key: tlid" " -> Seq Scan on completechain (cost=0.00..2229858.64 rows=48199164 width=4) (actual time=10.788..768403.874 rows=48199165 loops=1)" "Total runtime: 8596987.505 ms" Approach #2 - index scan (done by setting enable_seqscan to false and enable_sort to false): "GroupAggregate (cost=0.00..113713861.43 rows=48199164 width=4) (actual time=53.211..2652227.201 rows=47599910 loops=1)" " -> Index Scan using idx_completechain_tlid on completechain (cost=0.00..112870376.06 rows=48199164 width=4) (actual time=53.168..2312426.321 rows=48199165 loops=1)" "Total runtime: 2795420.933 ms" Approach #1 is estimated to be 10 times less costly, yet takes 3 times longer to execute. My questions: 1. Postgresql estimates the index scan will be 50 times more costly than the seq scan (112870376 vs 2229858) yet in fact it only takes 3 times longer to execute (2312426 s vs. 768403 s). My understanding is that postgresql assumes, via the random_page_cost parameter, that an index scan will take 4 times longer than a sequential scan. So why is the analyzer estimating it is 50 times slower? 2. In approach #1, the planner thinks the sort will take roughly 4 times longer [(10,298,092 - 2,229,858) / 2,229,858] than the sequential scan. Yet it really takes almost ten times longer. It seems as is the planner is greatly underestimating the sort cost? Due to these two apparent miscalculations, postgresql is choosing the wrong query plan to execute this query. I've attached my postgresql.conf file below just in case this is due to some misconfiguration on my part. Some setup notes: * All tables are vacuumed and analyzed * Running Postgresql 8.1 on Suse 10 * Low end hardware - Dell Dimension 3000, 1GB ram, 1 built-in 80 GB IDE drive, 1 SATA Seagate 400GB drive. The IDE drive has the OS and the WAL files, the SATA drive the database. From hdparm the max IO for the IDE drive is about 50Mb/s and the SATA drive is about 65Mb/s. ------------------------------- #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #--------------------------------------------------------------------------- shared_buffers = 40000 # 40000 buffers * 8192 bytes/buffer = 327,680,000 bytes #shared_buffers = 1000 # min 16 or max_connections*2, 8KB each temp_buffers = 5000 #temp_buffers = 1000 # min 100, 8KB each #max_prepared_transactions = 5 # can be 0 or more # note: increasing max_prepared_transactions costs ~600 bytes of shared memory # per transaction slot, plus lock space (see max_locks_per_transaction). work_mem = 16384 # in Kb #work_mem = 1024 # min 64, size in KB maintenance_work_mem = 262144 # in kb #maintenance_work_mem = 16384 # min 1024, size in KB #max_stack_depth = 2048 # min 100, size in KB # - Free Space Map - max_fsm_pages = 60000 #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 1000 # min 100, ~70 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' # - Cost-Based Vacuum Delay - #vacuum_cost_delay = 0 # 0-1000 milliseconds #vacuum_cost_page_hit = 1 # 0-10000 credits #vacuum_cost_page_miss = 10 # 0-10000 credits #vacuum_cost_page_dirty = 20 # 0-10000 credits #vacuum_cost_limit = 200 # 0-10000 credits # - Background writer - #bgwriter_delay = 200 # 10-10000 milliseconds between rounds #bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers scanned/round #bgwriter_lru_maxpages = 5 # 0-1000 buffers max written/round #bgwriter_all_percent = 0.333 # 0-100% of all buffers scanned/round #bgwriter_all_maxpages = 5 # 0-1000 buffers max written/round #--------------------------------------------------------------------------- # WRITE AHEAD LOG #--------------------------------------------------------------------------- # - Settings - fsync = on # turns forced synchronization on or off #wal_sync_method = fsync # the default is the first option # supported by the operating system: # open_datasync # fdatasync # fsync # fsync_writethrough # open_sync #full_page_writes = on # recover from partial page writes wal_buffers = 128 #wal_buffers = 8 # min 4, 8KB each #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 # - Checkpoints - checkpoint_segments = 256 # 256 * 16Mb = 4,294,967,296 bytes checkpoint_timeout = 1200 # 1200 seconds (20 minutes) checkpoint_warning = 30 # in seconds, 0 is off #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 300 # range 30-3600, in seconds #checkpoint_warning = 30 # in seconds, 0 is off # - Archiving - #archive_command = '' # command to use to archive a logfile # segment #--------------------------------------------------------------------------- # QUERY TUNING #--------------------------------------------------------------------------- # - Planner Method Configuration - #enable_bitmapscan = on #enable_hashagg = on #enable_hashjoin = on #enable_indexscan = on #enable_mergejoin = on #enable_nestloop = on #enable_seqscan = on #enable_sort = on #enable_tidscan = on # - Planner Cost Constants - effective_cache_size = 80000 # 80000 * 8192 = 655,360,000 bytes #effective_cache_size = 1000 # typically 8KB each random_page_cost = 2.5 # units are one sequential page fetch #random_page_cost = 4 # units are one sequential page fetch # cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) #cpu_operator_cost = 0.0025 # (same) # - Genetic Query Optimizer - #geqo = on #geqo_threshold = 12 #geqo_effort = 5 # range 1-10 #geqo_pool_size = 0 # selects default based on effort #geqo_generations = 0 # selects default based on effort #geqo_selection_bias = 2.0 # range 1.5-2.0 # - Other Planner Options - default_statistics_target = 100 # range 1-1000 #default_statistics_target = 10 # range 1-1000 #constraint_exclusion = off #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit # JOINs #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # RUNTIME STATISTICS #--------------------------------------------------------------------------- # - Statistics Monitoring - #log_parser_stats = off #log_planner_stats = off #log_executor_stats = off #log_statement_stats = off # - Query/Index Statistics Collector - stats_start_collector = on stats_command_string = on stats_block_level = on stats_row_level = on #stats_start_collector = on #stats_command_string = off #stats_block_level = off #stats_row_level = off #stats_reset_on_server_start = off #--------------------------------------------------------------------------- # AUTOVACUUM PARAMETERS #--------------------------------------------------------------------------- autovacuum = true autovacuum_naptime = 600 #autovacuum = false # enable autovacuum subprocess? #autovacuum_naptime = 60 # time between autovacuum runs, in secs #autovacuum_vacuum_threshold = 1000 # min # of tuple updates before # vacuum #autovacuum_analyze_threshold = 500 # min # of tuple updates before # analyze #autovacuum_vacuum_scale_factor = 0.4 # fraction of rel size before # vacuum #autovacuum_analyze_scale_factor = 0.2 # fraction of rel size before # analyze #autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for # autovac, -1 means use # vacuum_cost_delay #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for # autovac, -1 means use # vacuum_cost_ ---------------------- -- Table: tiger.completechain -- DROP TABLE tiger.completechain; CREATE TABLE tiger.completechain ( ogc_fid int4 NOT NULL DEFAULT nextval('completechain_ogc_fid_seq'::regclass), module varchar(8) NOT NULL, tlid int4 NOT NULL, side1 int4, source varchar(1) NOT NULL, fedirp varchar(2), fename varchar(30), fetype varchar(4), fedirs varchar(2), cfcc varchar(3) NOT NULL, fraddl varchar(11), toaddl varchar(11), fraddr varchar(11), toaddr varchar(11), friaddl varchar(1), toiaddl varchar(1), friaddr varchar(1), toiaddr varchar(1), zipl int4, zipr int4, aianhhfpl int4, aianhhfpr int4, aihhtlil varchar(1), aihhtlir varchar(1), census1 varchar(1), census2 varchar(1), statel int4, stater int4, countyl int4, countyr int4, cousubl int4, cousubr int4, submcdl int4, submcdr int4, placel int4, placer int4, tractl int4, tractr int4, blockl int4, blockr int4, wkb_geometry public.geometry NOT NULL, CONSTRAINT enforce_dims_wkb_geometry CHECK (ndims(wkb_geometry) = 2), CONSTRAINT enforce_geotype_wkb_geometry CHECK (geometrytype(wkb_geometry) = 'LINESTRING'::text OR wkb_geometry IS NULL), CONSTRAINT enforce_srid_wkb_geometry CHECK (srid(wkb_geometry) = 4269) ) WITHOUT OIDS; ALTER TABLE tiger.completechain OWNER TO postgres; -- Index: tiger.idx_completechain_tlid -- DROP INDEX tiger.idx_completechain_tlid; CREATE INDEX idx_completechain_tlid ON tiger.completechain USING btree (tlid); From pgsql-performance-owner@postgresql.org Thu Nov 10 13:00:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6EC84DB159 for ; Thu, 10 Nov 2005 13:00:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95615-06 for ; Thu, 10 Nov 2005 17:00:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 4F320DB129 for ; Thu, 10 Nov 2005 13:00:10 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 10 Nov 2005 11:00:10 -0600 Subject: Re: WAL sync behaviour From: Scott Marlowe To: Tom Lane Cc: Michael Stone , pgsql-performance@postgresql.org In-Reply-To: <9791.1131640774@sss.pgh.pa.us> References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> <1131637958.3554.75.camel@state.g2switchworks.com> <9791.1131640774@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1131642009.3554.87.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 10 Nov 2005 11:00:10 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.006, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/188 X-Sequence-Number: 15445 On Thu, 2005-11-10 at 10:39, Tom Lane wrote: > Scott Marlowe writes: > > On Thu, 2005-11-10 at 08:43, Michael Stone wrote: > >> There's no reason to use a journaled filesystem for the wal. Use ext2 in > >> preference to ext3. > > > Not from what I understood. Ext2 can't guarantee that your data will > > even be there in any form after a crash. I believe only metadata > > journaling is needed though. > > No, Mike is right: for WAL you shouldn't need any journaling. This is > because we zero out *and fsync* an entire WAL file before we ever > consider putting live WAL data in it. During live use of a WAL file, > its metadata is not changing. As long as the filesystem follows > the minimal rule of syncing metadata about a file when it fsyncs the > file, all the live WAL files should survive crashes OK. > > We can afford to do this mainly because WAL files can normally be > recycled instead of created afresh, so the zero-out overhead doesn't > get paid during normal operation. > > You do need metadata journaling for all non-WAL PG files, since we don't > fsync them every time we extend them; which means the filesystem could > lose track of which disk blocks belong to such a file, if it's not > journaled. Thanks for the clarification! Nice to know I can setup an ext2 partition for my WAL files then. Is this in the docs anywhere? From pgsql-performance-owner@postgresql.org Thu Nov 10 13:24:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBC26DAE49 for ; Thu, 10 Nov 2005 13:24:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12429-10 for ; Thu, 10 Nov 2005 17:24:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 664CCDA5B3 for ; Thu, 10 Nov 2005 13:24:36 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAAHNKhH010165; Thu, 10 Nov 2005 12:23:20 -0500 (EST) To: Mitch Skinner Cc: pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower In-reply-to: <1131630176.29496.91.camel@enzian> References: <1131630176.29496.91.camel@enzian> Comments: In-reply-to Mitch Skinner message dated "Thu, 10 Nov 2005 05:42:56 -0800" Date: Thu, 10 Nov 2005 12:23:20 -0500 Message-ID: <10164.1131643400@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/190 X-Sequence-Number: 15447 Mitch Skinner writes: > This is with Postgres 8.0.3. Any advice is appreciated. These are exactly the same plan, except for the addition of the extra filter condition ... > -> Index Scan using external_id_map_primary_key on external_id_map > eim (cost=0.00..2345747.01 rows=15560708 width=26) (actual > time=0.061..2.944 rows=2175 loops=1) > -> Index Scan using external_id_map_primary_key on external_id_map > eim (cost=0.00..2384648.78 rows=4150 width=26) (actual > time=0.020..21068.508 rows=1186 loops=1) > Filter: (source = 'SCH'::bpchar) Apparently, you are using a platform and/or locale in which strcoll() is spectacularly, god-awfully slow --- on the order of 10 msec per comparison. This is a bit hard to believe but I can't make sense of those numbers any other way. What is the platform exactly, and what database locale and encoding are you using? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 13:44:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 453BCD7BAF for ; Thu, 10 Nov 2005 13:44:19 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21804-01 for ; Thu, 10 Nov 2005 17:44:17 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7A597D7115 for ; Thu, 10 Nov 2005 13:44:17 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAAHiFer010321; Thu, 10 Nov 2005 12:44:16 -0500 (EST) To: Scott Marlowe Cc: Michael Stone , pgsql-performance@postgresql.org Subject: Re: WAL sync behaviour In-reply-to: <1131642009.3554.87.camel@state.g2switchworks.com> References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> <1131637958.3554.75.camel@state.g2switchworks.com> <9791.1131640774@sss.pgh.pa.us> <1131642009.3554.87.camel@state.g2switchworks.com> Comments: In-reply-to Scott Marlowe message dated "Thu, 10 Nov 2005 11:00:10 -0600" Date: Thu, 10 Nov 2005 12:44:15 -0500 Message-ID: <10320.1131644655@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/191 X-Sequence-Number: 15448 Scott Marlowe writes: > Thanks for the clarification! Nice to know I can setup an ext2 > partition for my WAL files then. Is this in the docs anywhere? Don't think so ... want to write something up? Hard part is to figure out where to put it ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 13:58:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 80551DB1D0 for ; Thu, 10 Nov 2005 13:58:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03722-10 for ; Thu, 10 Nov 2005 17:58:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 0C4B0DB178 for ; Thu, 10 Nov 2005 13:58:47 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EaGhB-0002Jg-Kr for pgsql-performance@postgresql.org; Thu, 10 Nov 2005 18:58:47 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EaGh9-0001dr-00 for ; Thu, 10 Nov 2005 18:58:43 +0100 Date: Thu, 10 Nov 2005 18:58:43 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: WAL sync behaviour Message-ID: <20051110175843.GA6254@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20051110133241.GA4031@uio.no> <437355C6.4030604@archonet.com> <20051110142535.GA4530@uio.no> <20051110144309.GO9905@mathom.us> <1131637958.3554.75.camel@state.g2switchworks.com> <9791.1131640774@sss.pgh.pa.us> <1131642009.3554.87.camel@state.g2switchworks.com> <10320.1131644655@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <10320.1131644655@sss.pgh.pa.us> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/192 X-Sequence-Number: 15449 On Thu, Nov 10, 2005 at 12:44:15PM -0500, Tom Lane wrote: > Don't think so ... want to write something up? Hard part is to > figure out where to put it ... To be honest, I think we could use a "newbie's guide to PostgreSQL performance tuning". I've seen rather good guides for query tuning, and guides for general performance tuning, but none that really cover both in a coherent way. (Also, many of the ones I've seen start getting rather dated; after bitmap index scans arrived, for instance, many of the rules with regard to index planning probably changed.) I'd guess http://www.powerpostgresql.com/PerfList is a rather good start for the second part (and it's AFAICS under a free license); having something like that in the docs (or some other document) would probably be a good start. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Nov 10 14:04:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 57C4ADB01E for ; Thu, 10 Nov 2005 14:04:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39828-09 for ; Thu, 10 Nov 2005 18:04:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D6DC9DAF1B for ; Thu, 10 Nov 2005 14:04:41 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAAI4fE6010462; Thu, 10 Nov 2005 13:04:41 -0500 (EST) To: Charlie Savage Cc: pgsql-performance@postgresql.org Subject: Re: Index Scan Costs versus Sort In-reply-to: References: Comments: In-reply-to Charlie Savage message dated "Thu, 10 Nov 2005 09:59:21 -0700" Date: Thu, 10 Nov 2005 13:04:41 -0500 Message-ID: <10461.1131645881@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/193 X-Sequence-Number: 15450 Charlie Savage writes: > 1. Postgresql estimates the index scan will be 50 times more costly > than the seq scan (112870376 vs 2229858) yet in fact it only takes 3 > times longer to execute (2312426 s vs. 768403 s). My understanding is > that postgresql assumes, via the random_page_cost parameter, that an > index scan will take 4 times longer than a sequential scan. So why is > the analyzer estimating it is 50 times slower? The other factors that are likely to affect this are index correlation and effective cache size. It's fairly remarkable that a full-table index scan only takes 3 times longer than a seqscan; you must have both a high correlation and a reasonably large cache. You showed us your effective_cache_size setting, but what's the pg_stats entry for completechain.tlid contain? Can you quantify what the physical ordering of tlid values is likely to be? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 14:17:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A0F64D9599 for ; Thu, 10 Nov 2005 14:17:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68883-10 for ; Thu, 10 Nov 2005 18:17:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by svr1.postgresql.org (Postfix) with ESMTP id D35CCD7CB7 for ; Thu, 10 Nov 2005 14:17:33 -0400 (AST) Received: from phys-hanwk-1 ([129.149.2.111]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id jAAIHXD7000132 for ; Thu, 10 Nov 2005 11:17:33 -0700 (MST) Received: from conversion-daemon.hanwk-mail1.sfbay.sun.com by hanwk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IPR00B013ZUPV@hanwk-mail1.sfbay.sun.com> (original mail from Ashok.Agrawal@Sun.COM) for pgsql-performance@postgresql.org; Thu, 10 Nov 2005 10:17:33 -0800 (PST) Received: from Sun.COM (sr1-unwk-09.SFBay.Sun.COM [129.149.2.159]) by hanwk-mail1.sfbay.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTP id <0IPR008TV459LG@hanwk-mail1.sfbay.sun.com>; Thu, 10 Nov 2005 10:17:33 -0800 (PST) Date: Thu, 10 Nov 2005 10:17:33 -0800 From: Ashok Agrawal Subject: Re: Outer Join performance in PostgreSQL In-reply-to: <87d5l9r1mm.fsf@hero.mallet-assembly.org> To: Michael Alan Dorman Cc: pgsql-performance@postgresql.org Reply-To: Ashok.Agrawal@Sun.COM Message-id: <43738EBD.1090507@Sun.COM> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.4) Gecko/20041214 References: <43725511.3040809@Sun.COM> <87d5l9r1mm.fsf@hero.mallet-assembly.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.053 required=5 tests=[AWL=0.052, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.053 X-Spam-Level: X-Archive-Number: 200511/194 X-Sequence-Number: 15451 Hello Michael, Here is the information : I had executed explain analyze with modified FROM clause. Oops forgot to mention the version earlier. Using postgres 8.0.0 on Solaris 9. Rows Count : cic=# select count(*) from taxpack_user; count -------- 172645 (1 row) cic=# select count(*) from ecms_certificate_types; count ------- 10 (1 row) cic=# select count(*) from ecms_cert_headers; count ------- 17913 (1 row) Table Information : Table "ecms.ecms_certificate_types" Column | Type | Modifiers ------------------------------+-----------------------------+----------- certificate_type_id | smallint | not null certificate_type_description | character varying(60) | created_by | character varying(30) | created_date | timestamp without time zone | updated_by | character varying(30) | updated_date | timestamp without time zone | Indexes: "sys_c003733" PRIMARY KEY, btree (certificate_type_id) "pk_ecms_certificate_types" UNIQUE, btree (certificate_type_id) Table "ecms.ecms_cert_headers" Column | Type | Modifiers ---------------------+-----------------------------+----------- dln_code | character varying(10) | not null sun_legal_entity | character varying(12) | not null other_entity_name | character varying(20) | company_name | character varying(80) | not null certificate_date | timestamp without time zone | not null certificate_type_id | smallint | not null description | character varying(80) | not null blanket_single | character(1) | not null notes | character varying(4000) | certificate_status | character(1) | not null approved_by | character varying(30) | approved_date | timestamp without time zone | created_by | character varying(30) | created_date | timestamp without time zone | updated_by | character varying(30) | updated_date | timestamp without time zone | Indexes: "pk_ecms_cert_headers" UNIQUE, btree (dln_code) "ecms_cert_headers_idx1" btree (certificate_type_id) "ecms_cert_headers_idx2" btree (company_name) "ecms_cert_headers_idx3" btree (description) Foreign-key constraints: "sys_c003754" FOREIGN KEY (certificate_type_id) REFERENCES ecms_certificate_types(certificate_type_id) Table "ecms.taxpack_user" Column | Type | Modifiers ------------+-----------------------+----------- emp_no | character varying(12) | not null name | character varying(60) | not null manager_id | character varying(12) | dept_no | character varying(12) | mailstop | character varying(12) | phone | character varying(60) | email | character varying(60) | active | character varying(3) | not null admin | smallint | not null super_user | smallint | not null Merge Right Join (cost=1757437.54..21072796.15 rows=643816513 width=874) (actual time=27800.250..27800.256 rows=1 loops=1) Merge Cond: ("outer"."?column3?" = "inner"."?column17?") -> Sort (cost=30776.19..31207.80 rows=172645 width=64) (actual time=12229.482..12791.468 rows=172645 loops=1) Sort Key: (e.emp_no)::text -> Seq Scan on taxpack_user e (cost=0.00..4898.45 rows=172645 width=64) (actual time=0.050..1901.218 rows=172645 loops=1) -> Sort (cost=1726661.35..1728525.92 rows=745827 width=859) (actual time=12675.899..12675.901 rows=1 loops=1) Sort Key: (a.approved_by)::text -> Merge Left Join (cost=29219.87..40411.59 rows=745827 width=859) (actual time=12675.815..12675.830 rows=1 loops=1) Merge Cond: ("outer"."?column18?" = "inner"."?column2?") -> Sort (cost=7106.77..7108.93 rows=864 width=892) (actual time=1441.644..1441.646 rows=1 loops=1) Sort Key: (a.updated_by)::text -> Nested Loop Left Join (cost=0.00..7064.62 rows=864 width=892) (actual time=435.864..1441.465 rows=1 loops=1) Join Filter: (("outer".created_by)::text = ("inner".emp_no)::text) -> Nested Loop Left Join (cost=0.00..8.11 rows=1 width=877) (actual time=0.251..0.361 rows=1 loops=1) Join Filter: ("outer".certificate_type_id = "inner".certificate_type_id) -> Index Scan using pk_ecms_cert_headers on ecms_cert_headers a (cost=0.00..6.01 rows=1 width=829) (actual time=0.113..0.136 rows=1 loops=1) Index Cond: ((dln_code)::text = '17319'::text) -> Seq Scan on ecms_certificate_types b (cost=0.00..1.49 rows=49 width=50) (actual time=0.018..0.059 rows=10 loops=1) -> Seq Scan on taxpack_user c (cost=0.00..4898.45 rows=172645 width=64) (actual time=0.014..674.881 rows=172645 loops=1) -> Sort (cost=22113.10..22544.71 rows=172645 width=16) (actual time=10689.742..10885.155 rows=71665 loops=1) Sort Key: (d.emp_no)::text -> Seq Scan on taxpack_user d (cost=0.00..4898.45 rows=172645 width=16) (actual time=0.031..1791.036 rows=172645 loops=1) Total runtime: 27802.014 ms (23 rows) Michael Alan Dorman wrote On 11/09/05 12:45,: > Ashok Agrawal writes: > >>I noticed outer join is very very slow in postgresql as compared >>to Oracle. > > > I think the three things the people best able to help you are going to > ask for are 1) what version of PostgreSQL, 2) what are the tables, and > how many rows in each, and 3) output from 'explain analyze' rather > than just 'explain'. > > That said, I'm willing to take an amateurish stab at it even without > that. > > In fact, I don't think the outer joins are the issue at all. I see > that you're forcing a right join from ecms_certificate_types to > ecms_cert_headers. This seems to be causing postgresql to think it > must (unnecessarily) consider three quarters of a billion rows, which, > if I'm reading right, seems to be producing the majority of the > estimated cost: > > >> Hash Join (cost=1666049.74..18486619.37 rows=157735046 width=874) >> Hash Cond: ("outer".certificate_type_id = "inner".certificate_type_id) >> -> Merge Right Join (cost=1666048.13..11324159.05 rows=643816513 width=826) > > > In fact, looking at the fact that you're doing a COALESCE on a column > from b, it seems to me that doing a right join from ecms_cert_headers > to ecms_certificate_types is just wrong. It seems to me that that > should be a left join as well. > > With that in mind, I would rewrite the whole FROM clause as: > > FROM ecms_cert_headers a > LEFT OUTER JOIN ecms_certificate_types b > ON (a.certificate_type_id = b.certificate_type_id) > LEFT OUTER JOIN taxpack_user c > ON (a.created_by = c.emp_no) > LEFT OUTER JOIN taxpack_user d > ON (a.updated_by = d.emp_no) > LEFT OUTER JOIN taxpack_user e > ON (a.approved_by = e.emp_no) > WHERE a.dln_code = '17319' > > It seems to me that this more reflects the intent of the data that is > being retrieved. I would also expect it to be a boatload faster. > > Assuming I've understood the intent correctly, I would guess that the > difference is the result of the Oracle planner being able to eliminate > the right join or something. > > Mike > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From pgsql-performance-owner@postgresql.org Thu Nov 10 15:01:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3AB61DAF90 for ; Thu, 10 Nov 2005 15:01:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88555-08 for ; Thu, 10 Nov 2005 19:00:59 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id CE795DAF13 for ; Thu, 10 Nov 2005 15:00:58 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D486E31059; Thu, 10 Nov 2005 20:00:58 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Re: Index Scan Costs versus Sort Date: Thu, 10 Nov 2005 12:00:51 -0700 Organization: Hub.Org Networking Services Lines: 56 Message-ID: <437398E3.2020900@interserv.com> References: <10461.1131645881@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Tom Lane User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <10461.1131645881@sss.pgh.pa.us> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/195 X-Sequence-Number: 15452 Hi Tom, From pg_stats: schema = "tiger"; tablename = "completechain"; attname = "tlid"; null_frac = 0; avg_width = 4; n_distinct = -1; most_common_vals = ; most_common_freqs = ; correlation = 0.155914; Note that I have default_statistics_target set to 100. Here is the first few values from histogram_bounds: "{102450,2202250,4571797,6365754,8444936,10541593,12485818,14545727,16745594,18421868,20300549,22498643,24114709,26301001,28280632,30370123,32253657,33943046,35898115,37499478,39469054,41868498,43992143,45907830,47826340,49843926,52051798,54409298,56447416, The tlid column is a US Census bureau ID assigned to each chain in the US - where a chain is a road segment, river segment, railroad segment, etc. The data is loaded on state-by-state basis, and then a county-by-county basis. There is no overall ordering to TLIDs, although perhaps there is some local ordering at the county level (but from a quick look at the data I don't see any, and the correlation factor indicates there isn't any if I am interpreting it correctly). Any other info that would be helpful to see? Charlie Tom Lane wrote: > Charlie Savage writes: >> 1. Postgresql estimates the index scan will be 50 times more costly >> than the seq scan (112870376 vs 2229858) yet in fact it only takes 3 >> times longer to execute (2312426 s vs. 768403 s). My understanding is >> that postgresql assumes, via the random_page_cost parameter, that an >> index scan will take 4 times longer than a sequential scan. So why is >> the analyzer estimating it is 50 times slower? > > The other factors that are likely to affect this are index correlation > and effective cache size. It's fairly remarkable that a full-table > index scan only takes 3 times longer than a seqscan; you must have both > a high correlation and a reasonably large cache. You showed us your > effective_cache_size setting, but what's the pg_stats entry for > completechain.tlid contain? Can you quantify what the physical > ordering of tlid values is likely to be? > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Thu Nov 10 16:46:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0C65FD7115 for ; Thu, 10 Nov 2005 16:46:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49664-02 for ; Thu, 10 Nov 2005 20:46:45 +0000 (GMT) X-Greylist: delayed 00:06:43.707071 by SQLgrey- Received: from tbmail.tradebot.com (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) by svr1.postgresql.org (Postfix) with ESMTP id 811C3D70C0 for ; Thu, 10 Nov 2005 16:46:46 -0400 (AST) Received: from 192.168.200.29 ([192.168.200.29]) by tbmail.tradebot.com ([192.168.1.50]) with Microsoft Exchange Server HTTP-DAV ; Thu, 10 Nov 2005 20:46:48 +0000 Received: from krb06 by TBMAIL; 10 Nov 2005 14:46:48 -0600 Subject: Re: 8.x index insert performance From: Kelly Burkhart To: Ron Peacetree Cc: pgsql-performance@postgresql.org In-Reply-To: <867256.1130859455220.JavaMail.root@elwamui-norfolk.atl.sa.earthlink.net> References: <867256.1130859455220.JavaMail.root@elwamui-norfolk.atl.sa.earthlink.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 10 Nov 2005 14:46:48 -0600 Message-Id: <1131655608.7514.51.camel@krb06.tradebot.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.019, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200511/196 X-Sequence-Number: 15453 On Tue, 2005-11-01 at 10:37 -0500, Ron Peacetree wrote: > I'm surprised that no one seems to have yet suggested the following > simple experiment: > > Increase the RAM 4GB -> 8GB, tune for best performance, and > repeat your 100M row insert experiment. > > Does overall insert performance change? Does the performance > drop rows in still occur? Does it occur in ~ the same place? > Etc. > > If the effect does seem to be sensitive to the amount of RAM in the > server, it might be worth redoing the experiment(s) with 2GB and > 16GB as well... Ron, I would like to try this, however, since I'm sitting about 1000 miles away from the server, tweaking things is not as simple as one might hope. I would also like to understand what is going on before I start changing things. If I can't get a satisfactory explanation for what I'm seeing with current hardware, I'll have memory added and see what happens. -K From pgsql-performance-owner@postgresql.org Thu Nov 10 18:01:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 487BBD7115 for ; Thu, 10 Nov 2005 18:01:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64127-06 for ; Thu, 10 Nov 2005 22:01:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tbmail.tradebot.com (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) by svr1.postgresql.org (Postfix) with ESMTP id 442C4D70C0 for ; Thu, 10 Nov 2005 18:01:54 -0400 (AST) Received: from 192.168.200.29 ([192.168.200.29]) by tbmail.tradebot.com ([192.168.1.50]) with Microsoft Exchange Server HTTP-DAV ; Thu, 10 Nov 2005 22:01:57 +0000 Received: from krb06 by TBMAIL; 10 Nov 2005 16:01:57 -0600 Subject: Re: 8.x index insert performance From: Kelly Burkhart To: pgsql-performance@postgresql.org In-Reply-To: <24845.1130852730@sss.pgh.pa.us> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 10 Nov 2005 16:01:57 -0600 Message-Id: <1131660117.7514.57.camel@krb06.tradebot.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.018 required=5 tests=[AWL=0.017, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.018 X-Spam-Level: X-Archive-Number: 200511/197 X-Sequence-Number: 15454 Second try... no attachment this time. I've finally gotten around to profiling the back end. Here is a more precise description of what I'm doing: I am copying data into two tables, order_main and order_transition (table defs at the end of this post). The order_transition table has roughly double the number of rows as the order_main table. My program is a C program using the libpq copy api which effectively simulates our real application. It reads data from two data files, and appends copy-formatted data into two in-memory buffers. After 10,000 order_transitions, it copies the order_main data, then the order_transition data, then commits. The test program is running on a different machine than the DB. After each batch it writes a record to stdout with the amount of time it took to copy and commit the data (time only includes pg time, not the time it took to build the buffers). A graph showing the performance characteristics is here: The horizontal axis is number of transitions * 10000 that have been written. The vertical axis is time in milliseconds to copy and commit the data. The commit time is very consistent up until about 60,000,000 rows, then performance drops and times become much less consistent. I profiled the backend at three points, on batches 4, 6042 and 6067. The first is right after start, the second is right before we hit the wall, and the third is one of the initial slow batches. I'm including inline the first 20 lines of gprof output for each batch. Please let me know if this is insufficient. I'll supply any necessary further info. Since this thread is stale, I'll repeat relevant hardware/software stats: server is a dual, dual-core opteron with 4GB RAM. Disk is an EMC Symmetrix connected via FC. Data, index, logs on three separate LUNS. OS is SuSE Enterprise 9. Postgres version is 8.1.b4. shared_buffers=32768, fsync=off. Thanks in advance for your help. -K --------------------------- > head -n 20 gprof.txt.4.777.47 Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 10.92 0.38 0.38 55027 0.00 0.00 XLogInsert 6.90 0.62 0.24 702994 0.00 0.00 _bt_compare 5.46 0.81 0.19 2 0.10 1.64 DoCopy 4.60 0.97 0.16 16077 0.00 0.00 CopyReadLine 3.74 1.10 0.13 484243 0.00 0.00 bttextcmp 2.87 1.20 0.10 93640 0.00 0.00 _bt_binsrch 2.59 1.29 0.09 484243 0.00 0.00 varstr_cmp 2.59 1.38 0.09 364292 0.00 0.00 LWLockRelease 2.30 1.46 0.08 703394 0.00 0.00 FunctionCall2 2.01 1.53 0.07 138025 0.00 0.00 hash_any 2.01 1.60 0.07 133176 0.00 0.00 ReadBuffer 2.01 1.67 0.07 364110 0.00 0.00 LWLockAcquire 2.01 1.74 0.07 132563 0.00 0.00 PinBuffer 1.72 1.80 0.06 38950 0.00 0.00 _bt_insertonpg 1.72 1.86 0.06 38767 0.00 0.00 _bt_mkscankey --------------------------- > head -n 20 gprof.txt.6042.1344.84 Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 9.67 0.52 0.52 50431 0.00 0.00 XLogInsert 7.71 0.94 0.42 1045427 0.00 0.00 _bt_compare 5.95 1.26 0.32 713392 0.00 0.00 bttextcmp 4.28 1.49 0.23 1045814 0.00 0.00 FunctionCall2 3.35 1.67 0.18 155756 0.00 0.00 _bt_binsrch 2.60 1.81 0.14 713392 0.00 0.00 varstr_cmp 2.60 1.95 0.14 475524 0.00 0.00 LWLockAcquire 2.60 2.09 0.14 191837 0.00 0.00 ReadBuffer 2.60 2.23 0.14 2 0.07 2.52 DoCopy 2.60 2.37 0.14 197393 0.00 0.00 hash_search 2.60 2.51 0.14 197205 0.00 0.00 hash_any 2.23 2.63 0.12 190481 0.00 0.00 PinBuffer 2.04 2.74 0.11 345866 0.00 0.00 AllocSetAlloc 1.86 2.84 0.10 475788 0.00 0.00 LWLockRelease 1.86 2.94 0.10 29620 0.00 0.00 pg_localtime --------------------------- > head -n 20 gprof.txt.6067.9883.31 Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 17.17 1.14 1.14 51231 0.00 0.00 XLogInsert 10.82 1.85 0.72 1065556 0.00 0.00 _bt_compare 4.77 2.17 0.32 158378 0.00 0.00 _bt_binsrch 3.18 2.38 0.21 202921 0.00 0.00 hash_search 3.18 2.59 0.21 742891 0.00 0.00 bttextcmp 2.87 2.78 0.19 1485787 0.00 0.00 pg_detoast_datum 2.87 2.97 0.19 1065325 0.00 0.00 FunctionCall2 2.65 3.14 0.18 490373 0.00 0.00 LWLockAcquire 2.27 3.29 0.15 2 0.08 3.08 DoCopy 2.27 3.44 0.15 490908 0.00 0.00 LWLockRelease 1.97 3.57 0.13 195049 0.00 0.00 ReadBuffer 1.97 3.70 0.13 742891 0.00 0.00 varstr_cmp 1.66 3.81 0.11 462134 0.00 0.00 LockBuffer 1.51 3.91 0.10 191345 0.00 0.00 PinBuffer 1.51 4.01 0.10 195049 0.00 0.00 UnpinBuffer --------------------------- create table order_main ( ord_id varchar(12) not null, firm_id varchar not null, firm_sub_id varchar not null, cl_ord_id varchar not null, clearing_firm varchar not null, clearing_account varchar not null, symbol varchar not null, side varchar(1) not null, size integer not null, price numeric(10,4) not null, expire_time timestamp with time zone, flags varchar(7) not null ); create unique index order_main_pk on order_main ( ord_id ) tablespace idx_space; create index order_main_ak1 on order_main ( cl_ord_id ) tablespace idx_space; create table order_transition ( collating_seq bigint not null, ord_id varchar(12) not null, cl_ord_id varchar, sending_time timestamp with time zone not null, transact_time timestamp with time zone not null, flags varchar(6) not null, exec_id varchar(12), size integer, price numeric(10,4), remainder integer, contra varchar ); create unique index order_transition_pk on order_transition ( collating_seq ) tablespace idx_space; create index order_transition_ak1 on order_transition ( ord_id ) tablespace idx_space; create index order_transition_ak2 on order_transition ( cl_ord_id ) tablespace idx_space where cl_ord_id is not null; create index order_transition_ak3 on order_transition ( exec_id ) tablespace idx_space where exec_id is not null; From pgsql-performance-owner@postgresql.org Thu Nov 10 18:18:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0ED23D7B75 for ; Thu, 10 Nov 2005 18:18:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71779-09 for ; Thu, 10 Nov 2005 22:18:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BFEFBD7115 for ; Thu, 10 Nov 2005 18:18:11 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAAMIE1T012267; Thu, 10 Nov 2005 17:18:14 -0500 (EST) To: Kelly Burkhart Cc: pgsql-performance@postgresql.org Subject: Re: 8.x index insert performance In-reply-to: <1131655202.7514.46.camel@krb06.tradebot.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131655202.7514.46.camel@krb06.tradebot.com> Comments: In-reply-to Kelly Burkhart message dated "Thu, 10 Nov 2005 14:40:02 -0600" Date: Thu, 10 Nov 2005 17:18:14 -0500 Message-ID: <12266.1131661094@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/198 X-Sequence-Number: 15455 Kelly Burkhart writes: > I've finally gotten around to profiling the back end. Thanks for following up. The sudden appearance of pg_detoast_datum() in the top ten in the third profile is suspicious. I wouldn't expect that to get called at all, really, during a normal COPY IN process. The only way I can imagine it getting called is if you have index entries that require toasting, which seems a bit unlikely to start happening only after 60 million rows. Is it possible that the index keys are getting longer and longer as your test run proceeds? Could you send me (off list) the complete gprof output files? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 19:01:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36266D7B75 for ; Thu, 10 Nov 2005 19:01:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79334-10 for ; Thu, 10 Nov 2005 23:01:34 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A7C30D70C0 for ; Thu, 10 Nov 2005 19:01:35 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAAN1ckG012583; Thu, 10 Nov 2005 18:01:38 -0500 (EST) To: Kelly Burkhart Cc: pgsql-performance@postgresql.org Subject: Re: 8.x index insert performance In-reply-to: <1131662056.7514.61.camel@krb06.tradebot.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131655202.7514.46.camel@krb06.tradebot.com> <12266.1131661094@sss.pgh.pa.us> <1131662056.7514.61.camel@krb06.tradebot.com> Comments: In-reply-to Kelly Burkhart message dated "Thu, 10 Nov 2005 16:34:16 -0600" Date: Thu, 10 Nov 2005 18:01:38 -0500 Message-ID: <12582.1131663698@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/199 X-Sequence-Number: 15456 Kelly Burkhart writes: > On Thu, 2005-11-10 at 17:18 -0500, Tom Lane wrote: >> Could you send me (off list) the complete gprof output files? > Sure, Thanks. Right offhand I can see no smoking gun here. The pg_detoast_datum entry I was worried about seems to be just measurement noise --- the gprof trace shows that it's called a proportional number of times in both cases, and it falls through without actually doing anything in all cases. The later trace involves a slightly larger amount of time spent inserting into the indexes, which is what you'd expect as the indexes get bigger, but it doesn't seem that CPU time per se is the issue. The just-before-the-cliff trace shows total CPU of 5.38 sec and the after-the-cliff one shows 6.61 sec. What I now suspect is happening is that you "hit the wall" at the point where the indexes no longer fit into main memory and it starts taking significant I/O to search and update them. Have you tried watching iostat or vmstat output to see if there's a noticeable increase in I/O at the point where things slow down? Can you check the physical size of the indexes at that point, and see if it seems related to your available RAM? If that is the correct explanation, then the only solutions I can see are (1) buy more RAM or (2) avoid doing incremental index updates; that is, drop the indexes before bulk load and rebuild them afterwards. One point to consider is that an index will be randomly accessed only if its data is being loaded in random order. If you're loading keys in sequential order then only the "right-hand edge" of the index would get touched, and it wouldn't need much RAM. So, depending on what order you're loading data in, the primary key index may not be contributing to the problem. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 20:11:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D398ADB250 for ; Thu, 10 Nov 2005 20:11:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01894-06 for ; Fri, 11 Nov 2005 00:11:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id DD7FFD7115 for ; Thu, 10 Nov 2005 20:11:53 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id CE6EC31059; Fri, 11 Nov 2005 01:11:55 +0100 (MET) From: Charlie Savage X-Newsgroups: pgsql.performance Subject: Re: Index Scan Costs versus Sort Date: Thu, 10 Nov 2005 17:11:48 -0700 Organization: Hub.Org Networking Services Lines: 33 Message-ID: References: <10461.1131645881@sss.pgh.pa.us> <437398E3.2020900@interserv.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.5 (Windows/20051025) In-Reply-To: <437398E3.2020900@interserv.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/200 X-Sequence-Number: 15457 Following up with some additional information. The machine has 1Gb physical RAM. When I run the query (with sort and seqscan enabled), top reports (numbers are fairly consistent): Mem: 1,032,972k total, 1,019,516k used, 13,412k free, 17,132k buffers Swap: 2,032,140k total, 17,592k used, 2,014,548k free, 742,636k cached The postmaster process is using 34.7% of RAM - 359m virt, 349 res, 319m. No other process is using more than 2% of the memory. From vmstat: r b swpd free buff cache 1 0 17592 13568 17056 743676 vmstat also shows no swapping going on. Note that I have part of the database, for just Colorado, on my Windows XP laptop (table size for completechain table in this case is 1Gb versus 18Gb for the whole US) for development purposes. I see the same behavior on it, which is a Dell D6100 laptop with 1Gb, running 8.1, and a default postgres.conf file with three changes (shared_buffers set to 7000, and work_mem set to 8192, effective_cache_size 2500). Out of curiosity, how much longer would an index_scan expected to be versus a seq scan? I was under the impression it would be about a facto of 4, or is that not usually the case? Thanks for the help, Charlie From pgsql-performance-owner@postgresql.org Thu Nov 10 20:13:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C076BDB259 for ; Thu, 10 Nov 2005 20:13:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07776-04 for ; Fri, 11 Nov 2005 00:13:23 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3372CDB250 for ; Thu, 10 Nov 2005 20:13:25 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAB0DSW6013168; Thu, 10 Nov 2005 19:13:28 -0500 (EST) To: Kelly Burkhart Cc: pgsql-performance@postgresql.org Subject: Re: 8.x index insert performance In-reply-to: <1131660117.7514.57.camel@krb06.tradebot.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131660117.7514.57.camel@krb06.tradebot.com> Comments: In-reply-to Kelly Burkhart message dated "Thu, 10 Nov 2005 16:01:57 -0600" Date: Thu, 10 Nov 2005 19:13:28 -0500 Message-ID: <13167.1131668008@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/201 X-Sequence-Number: 15458 Kelly Burkhart writes: > ... A graph showing the performance > characteristics is here: > I hadn't looked at this chart till just now, but it sure seems to put a crimp in my theory that you are running out of room to hold the indexes in RAM. That theory would predict that once you fall over the knee of the curve, performance would get steadily worse; instead it gets markedly worse and then improves a bit. And there's another cycle of worse-and-better around 80M rows. I have *no* idea what's up with that. Anyone? Kelly, could there be any patterns in the data that might be related? The narrow spikes look like they are probably induced by checkpoints. You could check that by seeing if their spacing changes when you alter checkpoint_segments and checkpoint_timeout. It might also be entertaining to make the bgwriter parameters more aggressive to see if you can ameliorate the spikes. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 10 20:32:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CFACADB2BB for ; Thu, 10 Nov 2005 20:32:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11431-07 for ; Fri, 11 Nov 2005 00:32:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 175FCDB2ED for ; Thu, 10 Nov 2005 20:32:43 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAB0Wkim013276; Thu, 10 Nov 2005 19:32:46 -0500 (EST) To: Charlie Savage Cc: pgsql-performance@postgresql.org Subject: Re: Index Scan Costs versus Sort In-reply-to: References: <10461.1131645881@sss.pgh.pa.us> <437398E3.2020900@interserv.com> Comments: In-reply-to Charlie Savage message dated "Thu, 10 Nov 2005 17:11:48 -0700" Date: Thu, 10 Nov 2005 19:32:46 -0500 Message-ID: <13275.1131669166@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/202 X-Sequence-Number: 15459 Charlie Savage writes: > Out of curiosity, how much longer would an index_scan expected to be > versus a seq scan? I was under the impression it would be about a facto > of 4, or is that not usually the case? No, it can easily be dozens or even hundreds of times worse, in the worst case. The factor of 4 you are thinking of is the random_page_cost which is the assumed ratio between the cost of randomly fetching a page and the cost of fetching it in a sequential scan of the whole table. Not only is the sequential scan fetch normally much cheaper (due to less seeking and the kernel probably catching on and doing read-ahead), but if there are N tuples on a page then a seqscan reads them all with one page fetch. In the worst case an indexscan might fetch the page from disk N separate times, if all its tuples are far apart in the index order. This is all on top of the extra cost to read the index itself, too. The planner's estimate of 50x higher cost is not out of line for small tuples (large N) and a badly-out-of-order table. What's puzzling is that you seem to be getting near best-case behavior in what does not seem to be a best-case scenario for an indexscan. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 05:17:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0CE17D6D4F for ; Fri, 11 Nov 2005 05:17:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30057-03 for ; Fri, 11 Nov 2005 09:17:12 +0000 (GMT) X-Greylist: delayed 19:34:22.308673 by SQLgrey- Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by svr1.postgresql.org (Postfix) with ESMTP id 50A32D6D46 for ; Fri, 11 Nov 2005 05:17:12 -0400 (AST) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Fri, 11 Nov 2005 01:17:13 -0800 Received: from 172.16.0.166 ([172.16.0.166]) by egcrc-ex01.egcrc.org ([172.16.1.4]) with Microsoft Exchange Server HTTP-DAV ; Fri, 11 Nov 2005 09:17:12 +0000 Received: from enzian by egcrc-ex01.egcrc.org; 11 Nov 2005 01:17:15 -0800 Subject: Re: same plan, add 1 condition, 1900x slower From: Mitch Skinner To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <10164.1131643400@sss.pgh.pa.us> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="=-hgMMVV2ifun8oB6Cmlku" Date: Fri, 11 Nov 2005 01:17:15 -0800 Message-Id: <1131700635.29496.136.camel@enzian> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 11 Nov 2005 09:17:13.0247 (UTC) FILETIME=[B39CA2F0:01C5E6A0] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/203 X-Sequence-Number: 15460 --=-hgMMVV2ifun8oB6Cmlku Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, 2005-11-10 at 12:23 -0500, Tom Lane wrote: > Apparently, you are using a platform and/or locale in which strcoll() is > spectacularly, god-awfully slow --- on the order of 10 msec per comparison. The version with the condition is definitely doing more I/O. The version without the condition doesn't read at all. I strace'd an explain analyze for each separately, and this is what I ended up with (the first is with the condition, the second is without): bash-2.05b$ cut '-d(' -f1 subsourcestrace | sort | uniq -c 7127 gettimeofday 75213 _llseek 1 Process 30227 attached - interrupt to quit 1 Process 30227 detached 148671 read 2 recv 4 semop 4 send bash-2.05b$ cut '-d(' -f1 subsourcestrace-nocond | sort | uniq -c 9103 gettimeofday 7 _llseek 1 Process 30227 attached - interrupt to quit 1 Process 30227 detached 2 recv 4 send For the moment, all of the rows in the view I'm selecting from satisfy the condition, so the output of both queries is the same. The relevant rows of the underlying tables are probably pretty contiguous (all of the rows satisfying the condition and the join were inserted at the same time). Could it just be the result of a weird physical distribution of data in the table/index files? For the fast query, the actual number of rows is a lot less than the planner expects. > This is a bit hard to believe but I can't make sense of those numbers > any other way. What is the platform exactly, and what database locale > and encoding are you using? It's RHEL 3 on x86: [root@rehoboam root]# uname -a Linux rehoboam 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17 17:52:23 EDT 2005 i686 i686 i386 GNU/Linux The glibc version is 2.3.2. statgen=# select current_setting('lc_collate'); current_setting ----------------- en_US.UTF-8 Not sure what's relevant, but here's some more info: The machine has 4.5GiB of RAM and a 5-disk Raid 5. It's a dual xeon 3.2ghz. relname | relpages | reltuples -----------------------------+----------+------------- external_id_map | 126883 | 1.55625e+07 external_id_map_primary_key | 64607 | 1.55625e+07 subject | 31 | 1186 subject_pkey | 19 | 1186 I've attached the output of "select name, setting from pg_settings". And, in case my original message isn't handy, the explain analyze output and table/view info is below. Thanks for taking a look, Mitch statgen=> explain analyze select * from subject_source; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Merge Join (cost=0.00..330.72 rows=1186 width=46) (actual time=0.051..8.890 rows=1186 loops=1) Merge Cond: ("outer".id = "inner".target_id) -> Index Scan using subject_pkey on subject norm (cost=0.00..63.36 rows=1186 width=28) (actual time=0.022..1.441 rows=1186 loops=1) -> Index Scan using external_id_map_primary_key on external_id_map eim (cost=0.00..2485226.70 rows=15562513 width=26) (actual time=0.016..2.532 rows=2175 loops=1) Total runtime: 9.592 ms (5 rows) statgen=> explain analyze select * from subject_source where source='SCH'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Merge Join (cost=0.00..1147.33 rows=1 width=46) (actual time=0.054..20258.161 rows=1186 loops=1) Merge Cond: ("outer".id = "inner".target_id) -> Index Scan using subject_pkey on subject norm (cost=0.00..63.36 rows=1186 width=28) (actual time=0.022..1.478 rows=1186 loops=1) -> Index Scan using external_id_map_primary_key on external_id_map eim (cost=0.00..2524132.99 rows=2335 width=26) (actual time=0.022..20252.326 rows=1186 loops=1) Filter: (source = 'SCH'::bpchar) Total runtime: 20258.922 ms (6 rows) statgen=> \d subject_source View "public.subject_source" Column | Type | Modifiers -----------+-----------------------+----------- id | bigint | sex | integer | parent1 | bigint | parent2 | bigint | source | character(3) | source_id | character varying(32) | View definition: SELECT norm.id, norm.sex, norm.parent1, norm.parent2, eim.source, eim.source_id FROM subject norm JOIN util.external_id_map eim ON norm.id = eim.target_id; statgen=> \d subject Table "public.subject" Column | Type | Modifiers ---------+---------+----------- id | bigint | not null sex | integer | parent1 | bigint | parent2 | bigint | Indexes: "subject_pkey" PRIMARY KEY, btree (id) Foreign-key constraints: "subject_parent1" FOREIGN KEY (parent1) REFERENCES subject(id) DEFERRABLE INITIALLY DEFERRED "subject_parent2" FOREIGN KEY (parent2) REFERENCES subject(id) DEFERRABLE INITIALLY DEFERRED "subject_id_map" FOREIGN KEY (id) REFERENCES util.external_id_map(target_id) DEFERRABLE INITIALLY DEFERRED statgen=> \d util.external_id_map Table "util.external_id_map" Column | Type | Modifiers -----------+-----------------------+----------- source_id | character varying(32) | not null source | character(3) | not null target_id | bigint | not null Indexes: "external_id_map_primary_key" PRIMARY KEY, btree (target_id) "external_id_map_source_source_id_unique" UNIQUE, btree (source, source_id) "external_id_map_source" btree (source) "external_id_map_source_target_id" btree (source, target_id) Foreign-key constraints: "external_id_map_source" FOREIGN KEY (source) REFERENCES util.source(id) --=-hgMMVV2ifun8oB6Cmlku Content-Disposition: attachment; filename=pg_settings Content-Type: text/plain; name=pg_settings; charset=utf-8 Content-Transfer-Encoding: base64 ICAgICAgICAgICAgICBuYW1lICAgICAgICAgICAgICB8ICAgIHNldHRpbmcgICAgIA0KLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0tLS0tLS0tLQ0KIGFkZF9taXNzaW5n X2Zyb20gICAgICAgICAgICAgICB8IG9uDQogYXJjaGl2ZV9jb21tYW5kICAgICAgICAgICAgICAg IHwgdW5zZXQNCiBhdXN0cmFsaWFuX3RpbWV6b25lcyAgICAgICAgICAgfCBvZmYNCiBhdXRoZW50 aWNhdGlvbl90aW1lb3V0ICAgICAgICAgfCA2MA0KIGJnd3JpdGVyX2RlbGF5ICAgICAgICAgICAg ICAgICB8IDIwMA0KIGJnd3JpdGVyX21heHBhZ2VzICAgICAgICAgICAgICB8IDEwMA0KIGJnd3Jp dGVyX3BlcmNlbnQgICAgICAgICAgICAgICB8IDENCiBibG9ja19zaXplICAgICAgICAgICAgICAg ICAgICAgfCA4MTkyDQogY2hlY2tfZnVuY3Rpb25fYm9kaWVzICAgICAgICAgIHwgb24NCiBjaGVj a3BvaW50X3NlZ21lbnRzICAgICAgICAgICAgfCAzMg0KIGNoZWNrcG9pbnRfdGltZW91dCAgICAg ICAgICAgICB8IDMwMA0KIGNoZWNrcG9pbnRfd2FybmluZyAgICAgICAgICAgICB8IDYwDQogY2xp ZW50X2VuY29kaW5nICAgICAgICAgICAgICAgIHwgU1FMX0FTQ0lJDQogY2xpZW50X21pbl9tZXNz YWdlcyAgICAgICAgICAgIHwgbm90aWNlDQogY29tbWl0X2RlbGF5ICAgICAgICAgICAgICAgICAg IHwgMA0KIGNvbW1pdF9zaWJsaW5ncyAgICAgICAgICAgICAgICB8IDUNCiBjcHVfaW5kZXhfdHVw bGVfY29zdCAgICAgICAgICAgfCAwLjAwMQ0KIGNwdV9vcGVyYXRvcl9jb3N0ICAgICAgICAgICAg ICB8IDAuMDAyNQ0KIGNwdV90dXBsZV9jb3N0ICAgICAgICAgICAgICAgICB8IDAuMDENCiBjdXN0 b21fdmFyaWFibGVfY2xhc3NlcyAgICAgICAgfCB1bnNldA0KIERhdGVTdHlsZSAgICAgICAgICAg ICAgICAgICAgICB8IElTTywgTURZDQogZGJfdXNlcl9uYW1lc3BhY2UgICAgICAgICAgICAgIHwg b2ZmDQogZGVhZGxvY2tfdGltZW91dCAgICAgICAgICAgICAgIHwgMTAwMA0KIGRlYnVnX3ByZXR0 eV9wcmludCAgICAgICAgICAgICB8IG9mZg0KIGRlYnVnX3ByaW50X3BhcnNlICAgICAgICAgICAg ICB8IG9mZg0KIGRlYnVnX3ByaW50X3BsYW4gICAgICAgICAgICAgICB8IG9mZg0KIGRlYnVnX3By aW50X3Jld3JpdHRlbiAgICAgICAgICB8IG9mZg0KIGRlYnVnX3NoYXJlZF9idWZmZXJzICAgICAg ICAgICB8IDANCiBkZWZhdWx0X3N0YXRpc3RpY3NfdGFyZ2V0ICAgICAgfCAxMA0KIGRlZmF1bHRf dGFibGVzcGFjZSAgICAgICAgICAgICB8IHVuc2V0DQogZGVmYXVsdF90cmFuc2FjdGlvbl9pc29s YXRpb24gIHwgcmVhZCBjb21taXR0ZWQNCiBkZWZhdWx0X3RyYW5zYWN0aW9uX3JlYWRfb25seSAg fCBvZmYNCiBkZWZhdWx0X3dpdGhfb2lkcyAgICAgICAgICAgICAgfCBvZmYNCiBlZmZlY3RpdmVf Y2FjaGVfc2l6ZSAgICAgICAgICAgfCA2NTUzNg0KIGVuYWJsZV9oYXNoYWdnICAgICAgICAgICAg ICAgICB8IG9uDQogZW5hYmxlX2hhc2hqb2luICAgICAgICAgICAgICAgIHwgb24NCiBlbmFibGVf aW5kZXhzY2FuICAgICAgICAgICAgICAgfCBvbg0KIGVuYWJsZV9tZXJnZWpvaW4gICAgICAgICAg ICAgICB8IG9uDQogZW5hYmxlX25lc3Rsb29wICAgICAgICAgICAgICAgIHwgb24NCiBlbmFibGVf c2Vxc2NhbiAgICAgICAgICAgICAgICAgfCBvbg0KIGVuYWJsZV9zb3J0ICAgICAgICAgICAgICAg ICAgICB8IG9uDQogZW5hYmxlX3RpZHNjYW4gICAgICAgICAgICAgICAgIHwgb24NCiBleHBsYWlu X3ByZXR0eV9wcmludCAgICAgICAgICAgfCBvbg0KIGV4dHJhX2Zsb2F0X2RpZ2l0cyAgICAgICAg ICAgICB8IDANCiBmcm9tX2NvbGxhcHNlX2xpbWl0ICAgICAgICAgICAgfCA4DQogZnN5bmMgICAg ICAgICAgICAgICAgICAgICAgICAgIHwgb24NCiBnZXFvICAgICAgICAgICAgICAgICAgICAgICAg ICAgfCBvbg0KIGdlcW9fZWZmb3J0ICAgICAgICAgICAgICAgICAgICB8IDUNCiBnZXFvX2dlbmVy YXRpb25zICAgICAgICAgICAgICAgfCAwDQogZ2Vxb19wb29sX3NpemUgICAgICAgICAgICAgICAg IHwgMA0KIGdlcW9fc2VsZWN0aW9uX2JpYXMgICAgICAgICAgICB8IDINCiBnZXFvX3RocmVzaG9s ZCAgICAgICAgICAgICAgICAgfCAxMg0KIGludGVnZXJfZGF0ZXRpbWVzICAgICAgICAgICAgICB8 IG9mZg0KIGpvaW5fY29sbGFwc2VfbGltaXQgICAgICAgICAgICB8IDgNCiBsY19jb2xsYXRlICAg ICAgICAgICAgICAgICAgICAgfCBlbl9VUy5VVEYtOA0KIGxjX2N0eXBlICAgICAgICAgICAgICAg ICAgICAgICB8IGVuX1VTLlVURi04DQogbGNfbWVzc2FnZXMgICAgICAgICAgICAgICAgICAgIHwg ZW5fVVMuVVRGLTgNCiBsY19tb25ldGFyeSAgICAgICAgICAgICAgICAgICAgfCBlbl9VUy5VVEYt OA0KIGxjX251bWVyaWMgICAgICAgICAgICAgICAgICAgICB8IGVuX1VTLlVURi04DQogbGNfdGlt ZSAgICAgICAgICAgICAgICAgICAgICAgIHwgZW5fVVMuVVRGLTgNCiBsaXN0ZW5fYWRkcmVzc2Vz ICAgICAgICAgICAgICAgfCAqDQogbG9nX2Nvbm5lY3Rpb25zICAgICAgICAgICAgICAgIHwgb2Zm DQogbG9nX2Rlc3RpbmF0aW9uICAgICAgICAgICAgICAgIHwgc3RkZXJyDQogbG9nX2Rpc2Nvbm5l Y3Rpb25zICAgICAgICAgICAgIHwgb2ZmDQogbG9nX2R1cmF0aW9uICAgICAgICAgICAgICAgICAg IHwgb2ZmDQogbG9nX2Vycm9yX3ZlcmJvc2l0eSAgICAgICAgICAgIHwgZGVmYXVsdA0KIGxvZ19l eGVjdXRvcl9zdGF0cyAgICAgICAgICAgICB8IG9mZg0KIGxvZ19ob3N0bmFtZSAgICAgICAgICAg ICAgICAgICB8IG9mZg0KIGxvZ19saW5lX3ByZWZpeCAgICAgICAgICAgICAgICB8IHVuc2V0DQog bG9nX21pbl9kdXJhdGlvbl9zdGF0ZW1lbnQgICAgIHwgLTENCiBsb2dfbWluX2Vycm9yX3N0YXRl bWVudCAgICAgICAgfCBwYW5pYw0KIGxvZ19taW5fbWVzc2FnZXMgICAgICAgICAgICAgICB8IG5v dGljZQ0KIGxvZ19wYXJzZXJfc3RhdHMgICAgICAgICAgICAgICB8IG9mZg0KIGxvZ19wbGFubmVy X3N0YXRzICAgICAgICAgICAgICB8IG9mZg0KIGxvZ19yb3RhdGlvbl9hZ2UgICAgICAgICAgICAg ICB8IDE0NDANCiBsb2dfcm90YXRpb25fc2l6ZSAgICAgICAgICAgICAgfCAwDQogbG9nX3N0YXRl bWVudCAgICAgICAgICAgICAgICAgIHwgbm9uZQ0KIGxvZ19zdGF0ZW1lbnRfc3RhdHMgICAgICAg ICAgICB8IG9mZg0KIGxvZ190cnVuY2F0ZV9vbl9yb3RhdGlvbiAgICAgICB8IG9uDQogbWFpbnRl bmFuY2Vfd29ya19tZW0gICAgICAgICAgIHwgNjU1MzYNCiBtYXhfY29ubmVjdGlvbnMgICAgICAg ICAgICAgICAgfCAxMDANCiBtYXhfZmlsZXNfcGVyX3Byb2Nlc3MgICAgICAgICAgfCAxMDAwDQog bWF4X2ZzbV9wYWdlcyAgICAgICAgICAgICAgICAgIHwgMjAwMDANCiBtYXhfZnNtX3JlbGF0aW9u cyAgICAgICAgICAgICAgfCAxMDAwDQogbWF4X2Z1bmN0aW9uX2FyZ3MgICAgICAgICAgICAgIHwg MzINCiBtYXhfaWRlbnRpZmllcl9sZW5ndGggICAgICAgICAgfCA2Mw0KIG1heF9pbmRleF9rZXlz ICAgICAgICAgICAgICAgICB8IDMyDQogbWF4X2xvY2tzX3Blcl90cmFuc2FjdGlvbiAgICAgIHwg NjQNCiBtYXhfc3RhY2tfZGVwdGggICAgICAgICAgICAgICAgfCAyMDQ4DQogcGFzc3dvcmRfZW5j cnlwdGlvbiAgICAgICAgICAgIHwgb24NCiBwb3J0ICAgICAgICAgICAgICAgICAgICAgICAgICAg fCA1NDMyDQogcHJlX2F1dGhfZGVsYXkgICAgICAgICAgICAgICAgIHwgMA0KIHJhbmRvbV9wYWdl X2Nvc3QgICAgICAgICAgICAgICB8IDQNCiByZWRpcmVjdF9zdGRlcnIgICAgICAgICAgICAgICAg fCBvbg0KIHJlZ2V4X2ZsYXZvciAgICAgICAgICAgICAgICAgICB8IGFkdmFuY2VkDQogcmVuZGV6 dm91c19uYW1lICAgICAgICAgICAgICAgIHwgdW5zZXQNCiBzZWFyY2hfcGF0aCAgICAgICAgICAg ICAgICAgICAgfCAkdXNlcixwdWJsaWMNCiBzZXJ2ZXJfZW5jb2RpbmcgICAgICAgICAgICAgICAg fCBTUUxfQVNDSUkNCiBzZXJ2ZXJfdmVyc2lvbiAgICAgICAgICAgICAgICAgfCA4LjAuMw0KIHNo YXJlZF9idWZmZXJzICAgICAgICAgICAgICAgICB8IDMyNzY4DQogc2lsZW50X21vZGUgICAgICAg ICAgICAgICAgICAgIHwgb2ZmDQogc3FsX2luaGVyaXRhbmNlICAgICAgICAgICAgICAgIHwgb24N CiBzc2wgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBvZmYNCiBzdGF0ZW1lbnRfdGltZW91 dCAgICAgICAgICAgICAgfCAwDQogc3RhdHNfYmxvY2tfbGV2ZWwgICAgICAgICAgICAgIHwgb2Zm DQogc3RhdHNfY29tbWFuZF9zdHJpbmcgICAgICAgICAgIHwgb24NCiBzdGF0c19yZXNldF9vbl9z ZXJ2ZXJfc3RhcnQgICAgfCBvbg0KIHN0YXRzX3Jvd19sZXZlbCAgICAgICAgICAgICAgICB8IG9m Zg0KIHN0YXRzX3N0YXJ0X2NvbGxlY3RvciAgICAgICAgICB8IG9uDQogc3VwZXJ1c2VyX3Jlc2Vy dmVkX2Nvbm5lY3Rpb25zIHwgMg0KIHN5c2xvZ19mYWNpbGl0eSAgICAgICAgICAgICAgICB8IExP Q0FMMA0KIHN5c2xvZ19pZGVudCAgICAgICAgICAgICAgICAgICB8IHBvc3RncmVzDQogVGltZVpv bmUgICAgICAgICAgICAgICAgICAgICAgIHwgUFNUOFBEVA0KIHRyYWNlX25vdGlmeSAgICAgICAg ICAgICAgICAgICB8IG9mZg0KIHRyYW5zYWN0aW9uX2lzb2xhdGlvbiAgICAgICAgICB8IHJlYWQg Y29tbWl0dGVkDQogdHJhbnNhY3Rpb25fcmVhZF9vbmx5ICAgICAgICAgIHwgb2ZmDQogdHJhbnNm b3JtX251bGxfZXF1YWxzICAgICAgICAgIHwgb2ZmDQogdW5peF9zb2NrZXRfZ3JvdXAgICAgICAg ICAgICAgIHwgdW5zZXQNCiB1bml4X3NvY2tldF9wZXJtaXNzaW9ucyAgICAgICAgfCA1MTENCiB2 YWN1dW1fY29zdF9kZWxheSAgICAgICAgICAgICAgfCAwDQogdmFjdXVtX2Nvc3RfbGltaXQgICAg ICAgICAgICAgIHwgMjAwDQogdmFjdXVtX2Nvc3RfcGFnZV9kaXJ0eSAgICAgICAgIHwgMjANCiB2 YWN1dW1fY29zdF9wYWdlX2hpdCAgICAgICAgICAgfCAxDQogdmFjdXVtX2Nvc3RfcGFnZV9taXNz ICAgICAgICAgIHwgMTANCiB3YWxfYnVmZmVycyAgICAgICAgICAgICAgICAgICAgfCA4DQogd2Fs X3N5bmNfbWV0aG9kICAgICAgICAgICAgICAgIHwgZmRhdGFzeW5jDQogd29ya19tZW0gICAgICAg ICAgICAgICAgICAgICAgIHwgNjU1MzYNCiB6ZXJvX2RhbWFnZWRfcGFnZXMgICAgICAgICAgICAg fCBvZmYNCigxMjggcm93cykNCg0K --=-hgMMVV2ifun8oB6Cmlku-- From pgsql-performance-owner@postgresql.org Fri Nov 11 07:57:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0BBECD6D17 for ; Fri, 11 Nov 2005 07:57:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85304-10 for ; Fri, 11 Nov 2005 11:56:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 3445ED6D29 for ; Fri, 11 Nov 2005 07:56:58 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id CDBD740C4ED; Fri, 11 Nov 2005 11:55:26 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id DB8A015F97; Fri, 11 Nov 2005 11:51:58 +0000 (GMT) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09495-02; Fri, 11 Nov 2005 11:51:55 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9AA8015F8F; Fri, 11 Nov 2005 11:51:55 +0000 (GMT) Message-ID: <437485DB.50005@archonet.com> Date: Fri, 11 Nov 2005 11:51:55 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mitch Skinner Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> In-Reply-To: <1131700635.29496.136.camel@enzian> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.031 required=5 tests=[AWL=0.031] X-Spam-Score: 0.031 X-Spam-Level: X-Archive-Number: 200511/204 X-Sequence-Number: 15461 Mitch Skinner wrote: > > The version with the condition is definitely doing more I/O. The > version without the condition doesn't read at all. [snip] > relname | relpages | reltuples > -----------------------------+----------+------------- > external_id_map | 126883 | 1.55625e+07 > external_id_map_primary_key | 64607 | 1.55625e+07 > subject | 31 | 1186 > subject_pkey | 19 | 1186 Does external_id_map really have 15 million rows? If not, try a VACUUM FULL on it. Be prepared to give it some time to complete. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Nov 11 10:10:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4000BDAABF for ; Fri, 11 Nov 2005 10:10:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62311-02 for ; Fri, 11 Nov 2005 14:10:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9E3B4DA481 for ; Fri, 11 Nov 2005 10:10:48 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABE9bpT018037; Fri, 11 Nov 2005 09:09:37 -0500 (EST) To: Mitch Skinner cc: pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower In-reply-to: <1131700635.29496.136.camel@enzian> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> Comments: In-reply-to Mitch Skinner message dated "Fri, 11 Nov 2005 01:17:15 -0800" Date: Fri, 11 Nov 2005 09:09:36 -0500 Message-ID: <18036.1131718176@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/205 X-Sequence-Number: 15462 Mitch Skinner writes: > On Thu, 2005-11-10 at 12:23 -0500, Tom Lane wrote: >> Apparently, you are using a platform and/or locale in which strcoll() is >> spectacularly, god-awfully slow --- on the order of 10 msec per comparison. > The version with the condition is definitely doing more I/O. The > version without the condition doesn't read at all. That's pretty interesting, but what file(s) is it reading exactly? It could still be strcoll's fault. The only plausible explanation I can think of for strcoll being so slow is if for some reason it were re-reading the locale definition file every time, instead of setting up just once. If it is hitting Postgres files, it'd be interesting to look at exactly which files and what the distribution of seek offsets is. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 10:18:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 67DB2DA423 for ; Fri, 11 Nov 2005 10:18:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58096-09 for ; Fri, 11 Nov 2005 14:18:22 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 245DED9577 for ; Fri, 11 Nov 2005 10:18:23 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABEH4G8018121; Fri, 11 Nov 2005 09:17:04 -0500 (EST) To: Richard Huxton cc: Mitch Skinner , pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower In-reply-to: <437485DB.50005@archonet.com> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> Comments: In-reply-to Richard Huxton message dated "Fri, 11 Nov 2005 11:51:55 +0000" Date: Fri, 11 Nov 2005 09:17:04 -0500 Message-ID: <18120.1131718624@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/206 X-Sequence-Number: 15463 Richard Huxton writes: > Mitch Skinner wrote: >> The version with the condition is definitely doing more I/O. The >> version without the condition doesn't read at all. > Does external_id_map really have 15 million rows? If not, try a VACUUM > FULL on it. Be prepared to give it some time to complete. Please don't, actually, until we understand what's going on. The thing is that the given plan will fetch every row indicated by the index in both cases, in order to check the row's visibility. I don't see how an additional test on a non-indexed column would cause any additional I/O. If the value were large enough to be toasted out-of-line then it could cause toast table accesses ... but we're speaking of a char(3). regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 10:20:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8A37ED6D19 for ; Fri, 11 Nov 2005 10:20:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61826-06 for ; Fri, 11 Nov 2005 14:20:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by svr1.postgresql.org (Postfix) with ESMTP id 6578DD7370 for ; Fri, 11 Nov 2005 10:20:37 -0400 (AST) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Fri, 11 Nov 2005 06:20:41 -0800 Received: from 172.16.0.166 ([172.16.0.166]) by egcrc-ex01.egcrc.org ([172.16.1.4]) with Microsoft Exchange Server HTTP-DAV ; Fri, 11 Nov 2005 14:20:40 +0000 Received: from enzian by egcrc-ex01.egcrc.org; 11 Nov 2005 06:20:43 -0800 Subject: Re: same plan, add 1 condition, 1900x slower From: Mitch Skinner To: Richard Huxton Cc: Tom Lane , pgsql-performance@postgresql.org In-Reply-To: <437485DB.50005@archonet.com> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 11 Nov 2005 06:20:43 -0800 Message-Id: <1131718843.29496.197.camel@enzian> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 11 Nov 2005 14:20:41.0479 (UTC) FILETIME=[18905970:01C5E6CB] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/207 X-Sequence-Number: 15464 On Fri, 2005-11-11 at 11:51 +0000, Richard Huxton wrote: > Does external_id_map really have 15 million rows? If not, try a VACUUM > FULL on it. Be prepared to give it some time to complete. Thanks for the reply. It does indeed have that many rows: statgen=> select count(*) from util.external_id_map ; count ---------- 15562513 (1 row) That table never gets deletions or updates, only insertions and reads. For fun and base-covering, I'm running a full vacuum now. Usually there's just a nightly lazy vacuum. If it helps, here's some background on what we're doing and why (plus some stuff at the end about how it relates to Postgres): We get very similar data from multiple sources, and I want to be able to combine it all into one schema. The data from different sources is similar enough (it's generally constrained by the underlying biology, e.g., each person has a father and a mother, two versions of each regular chromosome, etc.) that I think putting it all into one set of tables makes sense. Different people in our group use different tools (Python, R, Java), so instead of integrating at the code level (like a shared class hierarchy) we use the schema as our shared idea of the data. This helps make my analyses comparable to the analyses from my co-workers. We don't all want to have to write basic sanity checks in each of our languages, so we want to be able to have foreign keys in the schema. Having foreign keys and multiple data sources means that we have to generate our own internal identifiers (otherwise we'd expect to have ID collisions from different sources). I'd like to be able to have a stable internal-external ID mapping (this is actually something we spent a lot of time arguing about), so we have a table that does exactly that. When we import data, we do a bunch of joins against the external_id_map table to translate external IDs into internal IDs. It means that the external_id_map table gets pretty big and the joins can take a long time (it takes four hours to import one 11-million row source table into our canonical schema, because we have to do 5 ID translations per row on that one), but we don't need to import data too often so it works. The main speed concern is that exploratory data analyses are pretty interactive, and also sometimes you want to run a bunch of analyses in parallel, and if the queries are slow that can be a bottleneck. I'm looking forward to partitioning the external_id_map table with 8.1, and when Greenplum comes out with their stuff we'll probably take a look. If the main Postgres engine had parallel query execution, I'd be pretty happy. I also followed the external sort thread with interest, but I didn't get the impression that there was a very clear consensus there. Since some of our sources change over time, and I can't generally expect them to have timestamps on their data, what we do when we re-import from a source is delete everything out of the canonical tables from that source and then re-insert. It sounds like mass deletions are not such a common thing to do; I think there was a thread about this recently and Tom questioned the real-world need to worry about that workload. I was thinking that maybe the foreign key integrity checks might be better done by a join rather than a per-deleted-row trigger queue, but since all my foreign keys are indexed on both ends it doesn't look like a bottleneck. Anyway, all that probably has an effect on the data distribution in our tables and indexes. I'll report back on the effect of the full vacuum. Thanks for reading, Mitch From pgsql-performance-owner@postgresql.org Fri Nov 11 11:24:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD3EDD6D19 for ; Fri, 11 Nov 2005 11:24:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86610-03 for ; Fri, 11 Nov 2005 15:24:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by svr1.postgresql.org (Postfix) with ESMTP id DA08FDB381 for ; Fri, 11 Nov 2005 11:24:40 -0400 (AST) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Fri, 11 Nov 2005 07:24:45 -0800 Received: from 172.16.0.166 ([172.16.0.166]) by egcrc-ex01.egcrc.org ([172.16.1.4]) with Microsoft Exchange Server HTTP-DAV ; Fri, 11 Nov 2005 15:24:45 +0000 Received: from enzian by egcrc-ex01.egcrc.org; 11 Nov 2005 07:24:48 -0800 Subject: Re: same plan, add 1 condition, 1900x slower From: Mitch Skinner To: Tom Lane Cc: Richard Huxton , pgsql-performance@postgresql.org In-Reply-To: <18120.1131718624@sss.pgh.pa.us> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> <18120.1131718624@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 11 Nov 2005 07:24:41 -0800 Message-Id: <1131722682.29496.229.camel@enzian> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 11 Nov 2005 15:24:45.0718 (UTC) FILETIME=[0BE8AB60:01C5E6D4] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/208 X-Sequence-Number: 15465 On Fri, 2005-11-11 at 09:17 -0500, Tom Lane wrote: > Richard Huxton writes: > > Does external_id_map really have 15 million rows? If not, try a VACUUM > > FULL on it. Be prepared to give it some time to complete. > > Please don't, actually, until we understand what's going on. Ack, I was the middle of the vacuum full already when I got this. I still have the strace and lsof output from before the vacuum full. It's definitely reading Postgres files: bash-2.05b$ grep '^read' subsourcestrace | cut -d, -f1 | sort | uniq -c 100453 read(44 48218 read(47 bash-2.05b$ grep 'seek' subsourcestrace | cut -d, -f1 | sort | uniq -c 1 _llseek(40 1 _llseek(43 35421 _llseek(44 1 _llseek(45 1 _llseek(46 39787 _llseek(47 1 _llseek(48 File handles: 44 - external_id_map 47 - external_id_map_primary_key 40 - subject 43 - subject_pkey 45 - external_id_map_source 46 - external_id_map_source_target_id 48 - external_id_map_source_source_id_unique As far as the seek offsets go, R doesn't want to do a histogram for me without using up more RAM than I have. I put up some files at: http://arctur.us/pgsql/ They are: subsourcestrace - the strace output from "select * from subject_source where source='SCH'" subsourcestrace-nocond - the strace output from "select * from subject_source" subsourcelsof - the lsof output (for mapping from file handles to file names) relfilenode.html - for mapping from file names to table/index names (I think I've gotten all the relevant file handle-table name mappings above, though) seekoff-44 - just the beginning seek offsets for the 44 file handle (external_id_map) seekoff-47 - just the beginning seek offsets for the 47 file handle (external_id_map_primary_key) The vacuum full is still going; I'll let you know if it changes things. > The thing is that the given plan will fetch every row indicated by the > index in both cases, in order to check the row's visibility. I don't > see how an additional test on a non-indexed column would cause any > additional I/O. If the value were large enough to be toasted > out-of-line then it could cause toast table accesses ... but we're > speaking of a char(3). Pardon my ignorance, but do the visibility check and the check of the condition happen at different stages of execution? Would it end up checking the condition for all 15M rows, but only checking visibility for the 1200 rows that come back from the join? I guess I'm confused about what "every row indicated by the index" means in the context of the join. Thanks for taking an interest, Mitch From pgsql-performance-owner@postgresql.org Fri Nov 11 11:34:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C1D9BDB3D6 for ; Fri, 11 Nov 2005 11:34:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90174-05 for ; Fri, 11 Nov 2005 15:34:43 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7A181DB438 for ; Fri, 11 Nov 2005 11:34:45 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABFXUAh018884; Fri, 11 Nov 2005 10:33:30 -0500 (EST) To: Mitch Skinner cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower In-reply-to: <1131722682.29496.229.camel@enzian> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> <18120.1131718624@sss.pgh.pa.us> <1131722682.29496.229.camel@enzian> Comments: In-reply-to Mitch Skinner message dated "Fri, 11 Nov 2005 07:24:41 -0800" Date: Fri, 11 Nov 2005 10:33:30 -0500 Message-ID: <18883.1131723210@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/209 X-Sequence-Number: 15466 Mitch Skinner writes: > On Fri, 2005-11-11 at 09:17 -0500, Tom Lane wrote: >> Please don't, actually, until we understand what's going on. > Ack, I was the middle of the vacuum full already when I got this. Given what you said about no deletions or updates, the vacuum should have no effect anyway, so don't panic. > I put up some files at: http://arctur.us/pgsql/ Great, I'll take a look ... > Pardon my ignorance, but do the visibility check and the check of the > condition happen at different stages of execution? Would it end up > checking the condition for all 15M rows, but only checking visibility > for the 1200 rows that come back from the join? No, the visibility check happens first. The timing does seem consistent with the idea that the comparison is being done at all 15M rows, but your other EXPLAIN shows that only 2K rows are actually retrieved, which presumably is because the merge doesn't need the rest. (Merge will stop scanning either input when it runs out of rows on the other side; so this sort of plan is very fast if the range of keys on one side is smaller than the range on the other. The numbers from the no-comparison EXPLAIN ANALYZE indicate that that is happening for your case.) So the comparison should happen for at most 2K rows too. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 11:54:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 17B8FDB127 for ; Fri, 11 Nov 2005 11:54:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99258-02 for ; Fri, 11 Nov 2005 15:54:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 75C39DA423 for ; Fri, 11 Nov 2005 11:54:31 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABFrEL3019096; Fri, 11 Nov 2005 10:53:14 -0500 (EST) To: Mitch Skinner cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower In-reply-to: <18883.1131723210@sss.pgh.pa.us> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> <18120.1131718624@sss.pgh.pa.us> <1131722682.29496.229.camel@enzian> <18883.1131723210@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 11 Nov 2005 10:33:30 -0500" Date: Fri, 11 Nov 2005 10:53:14 -0500 Message-ID: <19095.1131724394@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/210 X-Sequence-Number: 15467 I wrote: > No, the visibility check happens first. The timing does seem consistent > with the idea that the comparison is being done at all 15M rows, but > your other EXPLAIN shows that only 2K rows are actually retrieved, which > presumably is because the merge doesn't need the rest. (Merge will stop > scanning either input when it runs out of rows on the other side; so > this sort of plan is very fast if the range of keys on one side is > smaller than the range on the other. The numbers from the no-comparison > EXPLAIN ANALYZE indicate that that is happening for your case.) So the > comparison should happen for at most 2K rows too. After re-reading your explanation of what you're doing with the data, I thought of a possible explanation. Is the "source" value exactly correlated with the external_id_map primary key? What could be happening is this: 1. We can see from the EXPLAIN ANALYZE for the no-comparison case that the merge join stops after fetching only 2175 rows from external_id_map. This implies that the subject table joins to the first couple thousand entries in external_id_map and nothing beyond that. In particular, the merge join must have observed that the join key in the 2175'th row (in index order) of external_id_map was larger than the last (largest) join key in subject. 2. Let's suppose that source = 'SCH' is false for the 2175'th row of external_id_map and every one after that. Then what will happen is that the index scan will vainly seek through the entire external_id_map, looking for a row that its filter allows it to return, not knowing that the merge join has no use for any of those rows. If this is the story, and you need to make this sort of query fast, then what you need to do is incorporate the "source" value into the external_id_map index key somehow. Then the index scan would be able to realize that there is no possibility of finding another row with source = 'SCH'. The simplest way is just to make a 2-column index, but I wonder whether the source isn't actually redundant with the external_id_map primary key already ... regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 12:56:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF1BFD77DE for ; Fri, 11 Nov 2005 12:56:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22147-09 for ; Fri, 11 Nov 2005 16:55:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail2.egcrc.net (63-193-204-9.egcrc.org [63.193.204.9]) by svr1.postgresql.org (Postfix) with ESMTP id DEB59D6D88 for ; Fri, 11 Nov 2005 12:55:55 -0400 (AST) Received: from egcrc-ex01.egcrc.org ([172.16.1.4]) by mail2.egcrc.net with Microsoft SMTPSVC(6.0.3790.211); Fri, 11 Nov 2005 08:55:53 -0800 Received: from 66.245.216.181 ([66.245.216.181]) by egcrc-ex01.egcrc.org ([172.16.1.4]) via Exchange Front-End Server mail.egcrc.net ([172.16.1.9]) with Microsoft Exchange Server HTTP-DAV ; Fri, 11 Nov 2005 16:55:53 +0000 Received: from firebolt by mail.egcrc.net; 11 Nov 2005 08:57:35 -0800 Subject: Re: same plan, add 1 condition, 1900x slower From: Mitchell Skinner To: Tom Lane Cc: Richard Huxton , pgsql-performance@postgresql.org In-Reply-To: <19095.1131724394@sss.pgh.pa.us> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> <18120.1131718624@sss.pgh.pa.us> <1131722682.29496.229.camel@enzian> <18883.1131723210@sss.pgh.pa.us> <19095.1131724394@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 11 Nov 2005 08:57:35 -0800 Message-Id: <1131728255.10481.51.camel@firebolt> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) X-OriginalArrivalTime: 11 Nov 2005 16:55:53.0863 (UTC) FILETIME=[C72D6170:01C5E6E0] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[RCVD_NUMERIC_HELO=1.253, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/211 X-Sequence-Number: 15468 On Fri, 2005-11-11 at 10:53 -0500, Tom Lane wrote: > After re-reading your explanation of what you're doing with the data, > I thought of a possible explanation. Is the "source" value exactly > correlated with the external_id_map primary key? Sort of. In this case, at the beginning of external_id_map, yes, though further down the table they're not. For example, if we got new subjects from 'SCH' at this point, they'd get assigned external_id_map.target_id (the primary key) values that are totally unrelated to what the current set are (the values in the external_id_map primary key just come off of a sequence that we use for everything). Right now though, since the 'SCH' data came in a contiguous chunk right at the beginning and hasn't changed or grown since then, the correlation is pretty exact, I think. It's true that there are no 'SCH' rows in the table after the first contiguous set (when I get back to work I'll check exactly what row that is). It's interesting that there are these correlations in the the data that didn't exist at all in my mental model. > what you need to do is incorporate the "source" value into the > external_id_map index key somehow. Then the index scan would be able to > realize that there is no possibility of finding another row with source > = 'SCH'. The simplest way is just to make a 2-column index I thought that's what I had done with the external_id_map_source_target_id index: statgen=> \d util.external_id_map Table "util.external_id_map" Column | Type | Modifiers -----------+-----------------------+----------- source_id | character varying(32) | not null source | character(3) | not null target_id | bigint | not null Indexes: "external_id_map_primary_key" PRIMARY KEY, btree (target_id) "external_id_map_source_source_id_unique" UNIQUE, btree (source, source_id) "external_id_map_source" btree (source) "external_id_map_source_target_id" btree (source, target_id) Foreign-key constraints: "external_id_map_source" FOREIGN KEY (source) REFERENCES util.source(id) So if I understand your suggestion correctly, we're back to the "why isn't this query using index foo" FAQ. For the external_id_map table, the statistics target for "source" is 200; the other two columns are at the default level because I didn't think of them as being very interesting statistics-wise. I suppose I should probably go ahead and raise the targets for every column of that table; I expect the planning time is negligible, and our queries tend to be large data-wise. Beyond that, I'm not sure how else to encourage the use of that index. If I changed that index to be (target_id, source) would it make a difference? Thanks for your help, Mitch From pgsql-performance-owner@postgresql.org Fri Nov 11 13:17:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8A128D9853 for ; Fri, 11 Nov 2005 13:17:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51693-05 for ; Fri, 11 Nov 2005 17:17:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E8853D8ED9 for ; Fri, 11 Nov 2005 13:17:52 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABHGX8I019852; Fri, 11 Nov 2005 12:16:33 -0500 (EST) To: Mitchell Skinner cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: same plan, add 1 condition, 1900x slower In-reply-to: <1131728255.10481.51.camel@firebolt> References: <1131630176.29496.91.camel@enzian> <10164.1131643400@sss.pgh.pa.us> <1131700635.29496.136.camel@enzian> <437485DB.50005@archonet.com> <18120.1131718624@sss.pgh.pa.us> <1131722682.29496.229.camel@enzian> <18883.1131723210@sss.pgh.pa.us> <19095.1131724394@sss.pgh.pa.us> <1131728255.10481.51.camel@firebolt> Comments: In-reply-to Mitchell Skinner message dated "Fri, 11 Nov 2005 08:57:35 -0800" Date: Fri, 11 Nov 2005 12:16:33 -0500 Message-ID: <19851.1131729393@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/212 X-Sequence-Number: 15469 Mitchell Skinner writes: > On Fri, 2005-11-11 at 10:53 -0500, Tom Lane wrote: >> what you need to do is incorporate the "source" value into the >> external_id_map index key somehow. Then the index scan would be able to >> realize that there is no possibility of finding another row with source >> = 'SCH'. The simplest way is just to make a 2-column index > I thought that's what I had done with the > external_id_map_source_target_id index: > "external_id_map_source_target_id" btree (source, target_id) > If I changed that index to be (target_id, source) would it make a difference? [ fools around with a test case ... ] Seems like not :-(. PG is not bright enough to realize that an index on (source, target_id) can be used with a mergejoin on target_id, because the index sort order isn't compatible. (Given the equality constraint on source, there is an effective compatibility. I had thought that 8.1 might be able to detect this, but it seems not to in a simple test case --- there may be a bug involved there. In any case 8.0 definitely won't see it.) An index on (target_id, source) would be recognized as mergejoinable, but that doesn't solve the problem because an index condition on the second column doesn't provide enough information to know that the scan can stop early. Given your comment that the correlation is accidental, it may be that there's not too much point in worrying. The planner is picking this plan only because it notices the asymmetry in key ranges, and as soon as some more rows get added with higher-numbered target_ids it will shift to something else (probably a hash join). regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 15:21:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 182A2D9853 for ; Fri, 11 Nov 2005 15:21:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04515-03 for ; Fri, 11 Nov 2005 19:21:08 +0000 (GMT) X-Greylist: delayed 00:05:01.717908 by SQLgrey- Received: from mtiwmhc13.worldnet.att.net (mtiwmhc13.worldnet.att.net [204.127.131.117]) by svr1.postgresql.org (Postfix) with ESMTP id 15A1FD91B1 for ; Fri, 11 Nov 2005 15:21:02 -0400 (AST) Received: from [10.10.100.50] (unknown[216.113.237.29]) by worldnet.att.net (mtiwmhc13) with ESMTP id <2005111119160011300sjt3ie>; Fri, 11 Nov 2005 19:16:00 +0000 Message-ID: <4374EDF1.5010709@att.net> Date: Fri, 11 Nov 2005 14:16:01 -0500 From: DW Reply-To: dwinner-lists@att.net User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: slow queries after ANALYZE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.062 required=5 tests=[AWL=0.062] X-Spam-Score: 0.062 X-Spam-Level: X-Archive-Number: 200511/213 X-Sequence-Number: 15470 Hello, I'm perplexed. I'm trying to find out why some queries are taking a long time, and have found that after running analyze, one particular query becomes slow. This query is based on a view that is based on multiple left outer joins to merge data from lots of tables. If I drop the database and reload it from a dump, the query result is instaneous (less than one second). But after I run analyze, it then takes much longer to run -- about 10 seconds, give or take a few depending on the hardware I'm testing it on. Earlier today, it was taking almost 30 seconds on the actual production server -- I restarted pgsql server and the time got knocked down to about 10 seconds -- another thing I don't understand. I've run the query a number of times before and after running analyze, and the problem reproduces everytime. I also ran with "explain", and saw that the costs go up dramatically after I run analyze. I'm fairly new to postgresql and not very experienced as a db admin to begin with, but it looks like I'm going to have to get smarter about this stuff fast, unless it's something the programmers need to deal with when constructing their code and queries or designing the databases. I've already learned that I've commited the cardinal sin of configuring my new database server with RAID 5 instead of something more sensible for databases like 0+1, but I've been testing out and replicating this problem on different hardware, so I know that this issue is not the direct cause of this. Thanks for any info. I can supply more info (like config files, schemas, etc.) if you think it might help. But I though I would just describe the problem for starters. -DW From pgsql-performance-owner@postgresql.org Fri Nov 11 15:32:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D1E04D96AD for ; Fri, 11 Nov 2005 15:32:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11333-03 for ; Fri, 11 Nov 2005 19:32:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1BEB6D6D1D for ; Fri, 11 Nov 2005 15:32:09 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABJWAM3021007; Fri, 11 Nov 2005 14:32:10 -0500 (EST) To: dwinner-lists@att.net cc: pgsql-performance@postgresql.org Subject: Re: slow queries after ANALYZE In-reply-to: <4374EDF1.5010709@att.net> References: <4374EDF1.5010709@att.net> Comments: In-reply-to DW message dated "Fri, 11 Nov 2005 14:16:01 -0500" Date: Fri, 11 Nov 2005 14:32:10 -0500 Message-ID: <21006.1131737530@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/214 X-Sequence-Number: 15471 DW writes: > I'm perplexed. I'm trying to find out why some queries are taking a long > time, and have found that after running analyze, one particular query > becomes slow. This implies that the planner's default choice of plan (without any statistics) is better than its choice when informed by statistics. This is undesirable but not unheard of :-( It would be interesting to see EXPLAIN ANALYZE results in both cases, plus the contents of the relevant pg_stats rows. (BTW, you need not dump and reload to get back to the virgin state --- just delete the relevant rows from pg_statistic.) Also we'd want to know exactly what PG version this is, and on what sort of platform. You might be able to fix things by increasing the statistics targets or tweaking planner cost parameters, but it'd be best to investigate before trying to fix. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 16:48:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 708E5DA206 for ; Fri, 11 Nov 2005 16:48:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44287-08 for ; Fri, 11 Nov 2005 20:48:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mtiwmhc12.worldnet.att.net (mtiwmhc12.worldnet.att.net [204.127.131.116]) by svr1.postgresql.org (Postfix) with ESMTP id 09315DA049 for ; Fri, 11 Nov 2005 16:48:16 -0400 (AST) Received: from [10.10.100.50] (unknown[216.113.237.29]) by worldnet.att.net (mtiwmhc12) with ESMTP id <2005111120481511200f4vq8e>; Fri, 11 Nov 2005 20:48:16 +0000 Message-ID: <43750390.3090707@att.net> Date: Fri, 11 Nov 2005 15:48:16 -0500 From: DW Reply-To: dwinner-lists@att.net User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: slow queries after ANALYZE References: <4374EDF1.5010709@att.net> <21006.1131737530@sss.pgh.pa.us> In-Reply-To: <21006.1131737530@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/215 X-Sequence-Number: 15472 Tom Lane wrote: > It would be interesting to see EXPLAIN ANALYZE results in both cases, > plus the contents of the relevant pg_stats rows. (BTW, you need not > dump and reload to get back to the virgin state --- just delete the > relevant rows from pg_statistic.) Also we'd want to know exactly what > PG version this is, and on what sort of platform. > Thanks for replying. I've got a message into to my team asking if I need to de-identify some of the table names before I go submitting output to a public mailing list. In the meantime, again I'm new to this -- I got pg_stats; which rows are the relevent ones? Also, I am running postgresql-server-7.4.9 from FreeBSD port (with optimized CFLAGS turned on during compiling) OS: FreeBSD 5.4 p8 Thanks, DW From pgsql-performance-owner@postgresql.org Fri Nov 11 17:25:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E55CD9CF0 for ; Fri, 11 Nov 2005 17:25:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63379-03 for ; Fri, 11 Nov 2005 21:25:50 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2021DD9CEC for ; Fri, 11 Nov 2005 17:25:50 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABLPqrb021670; Fri, 11 Nov 2005 16:25:52 -0500 (EST) To: dwinner-lists@att.net cc: pgsql-performance@postgresql.org Subject: Re: slow queries after ANALYZE In-reply-to: <43750390.3090707@att.net> References: <4374EDF1.5010709@att.net> <21006.1131737530@sss.pgh.pa.us> <43750390.3090707@att.net> Comments: In-reply-to DW message dated "Fri, 11 Nov 2005 15:48:16 -0500" Date: Fri, 11 Nov 2005 16:25:52 -0500 Message-ID: <21669.1131744352@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/216 X-Sequence-Number: 15473 DW writes: > In the meantime, again I'm new to this -- I got pg_stats; which rows are > the relevent ones? The ones for columns that are mentioned in the problem query. I don't think you need to worry about columns used only in the SELECT output list, but anything used in WHERE, GROUP BY, etc is interesting. > Also, I am running postgresql-server-7.4.9 from FreeBSD port (with > optimized CFLAGS turned on during compiling) > OS: FreeBSD 5.4 p8 The hardware environment (particularly disks/filesystems) is relevant too. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 11 18:48:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6D179D8FD3 for ; Fri, 11 Nov 2005 18:48:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97991-09 for ; Fri, 11 Nov 2005 22:48:22 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tbmail.tradebot.com (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) by svr1.postgresql.org (Postfix) with ESMTP id 72598D9E4D for ; Fri, 11 Nov 2005 18:48:23 -0400 (AST) Received: from 192.168.200.29 ([192.168.200.29]) by tbmail.tradebot.com ([192.168.1.50]) with Microsoft Exchange Server HTTP-DAV ; Fri, 11 Nov 2005 22:48:25 +0000 Received: from krb06 by TBMAIL; 11 Nov 2005 16:48:25 -0600 Subject: Re: 8.x index insert performance From: Kelly Burkhart To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <13167.1131668008@sss.pgh.pa.us> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131660117.7514.57.camel@krb06.tradebot.com> <13167.1131668008@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 11 Nov 2005 16:48:25 -0600 Message-Id: <1131749305.14024.32.camel@krb06.tradebot.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.017 required=5 tests=[AWL=0.016, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.017 X-Spam-Level: X-Archive-Number: 200511/217 X-Sequence-Number: 15474 On Thu, 2005-11-10 at 19:13 -0500, Tom Lane wrote: > Kelly Burkhart writes: > > ... A graph showing the performance > > characteristics is here: > > > > > I hadn't looked at this chart till just now, but it sure seems to put a > crimp in my theory that you are running out of room to hold the indexes > in RAM. That theory would predict that once you fall over the knee of > the curve, performance would get steadily worse; instead it gets > markedly worse and then improves a bit. And there's another cycle of > worse-and-better around 80M rows. I have *no* idea what's up with that. > Anyone? Kelly, could there be any patterns in the data that might be > related? I modified my original program to insert generated, sequential data. The following graph shows the results to be flat: Thus, hardware is sufficient to handle predictably sequential data. There very well could be a pattern in the data which could affect things, however, I'm not sure how to identify it in 100K rows out of 100M. If I could identify a pattern, what could I do about it? Could I do some kind of a reversible transform on the data? Is it better to insert nearly random values? Or nearly sequential? I now have an 8G and a 16G machine I'm loading the data into. I'll report back after that's done. I also want to try eliminating the order_main table, moving fields to the transition table. This will reduce the number of index updates significantly at the cost of some wasted space in the table... -K From pgsql-performance-owner@postgresql.org Fri Nov 11 18:58:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 72191D9D44 for ; Fri, 11 Nov 2005 18:58:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05141-05 for ; Fri, 11 Nov 2005 22:58:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by svr1.postgresql.org (Postfix) with ESMTP id D19E7D9CD5 for ; Fri, 11 Nov 2005 18:58:30 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Fri, 11 Nov 2005 16:58:28 -0600 Message-Id: <4374CDA90200002500000651@gwmta.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Fri, 11 Nov 2005 16:58:17 -0600 From: "Kevin Grittner" To: , Cc: Subject: Re: 8.x index insert performance Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=0.002] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200511/218 X-Sequence-Number: 15475 That sure seems to bolster the theory that performance is degrading because you exhaust the cache space and need to start reading index pages. When inserting sequential data, you don't need to randomly access pages all over the index tree. -Kevin >>> Kelly Burkhart >>> I modified my original program to insert generated, sequential data. The following graph shows the results to be flat: From pgsql-performance-owner@postgresql.org Fri Nov 11 19:02:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 738F7D9A6C for ; Fri, 11 Nov 2005 19:02:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07080-03 for ; Fri, 11 Nov 2005 23:02:08 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id F2C2ED96AD for ; Fri, 11 Nov 2005 19:02:09 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jABN2CDv022259; Fri, 11 Nov 2005 18:02:12 -0500 (EST) To: Kelly Burkhart cc: pgsql-performance@postgresql.org Subject: Re: 8.x index insert performance In-reply-to: <1131749305.14024.32.camel@krb06.tradebot.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131660117.7514.57.camel@krb06.tradebot.com> <13167.1131668008@sss.pgh.pa.us> <1131749305.14024.32.camel@krb06.tradebot.com> Comments: In-reply-to Kelly Burkhart message dated "Fri, 11 Nov 2005 16:48:25 -0600" Date: Fri, 11 Nov 2005 18:02:11 -0500 Message-ID: <22258.1131750131@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/219 X-Sequence-Number: 15476 Kelly Burkhart writes: > On Thu, 2005-11-10 at 19:13 -0500, Tom Lane wrote: >> Kelly, could there be any patterns in the data that might be >> related? > I modified my original program to insert generated, sequential data. > The following graph shows the results to be flat: > > Thus, hardware is sufficient to handle predictably sequential data. Yeah, inserting sequentially increasing data would only ever touch the right-hand edge of the btree, so memory requirements would be pretty low and constant. > There very well could be a pattern in the data which could affect > things, however, I'm not sure how to identify it in 100K rows out of > 100M. I conjecture that the problem areas represent places where the key sequence is significantly "more random" than it is elsewhere. Hard to be more specific than that though. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Nov 12 05:14:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F3D66DB49E for ; Sat, 12 Nov 2005 05:14:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01048-10 for ; Sat, 12 Nov 2005 09:14:46 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by svr1.postgresql.org (Postfix) with ESMTP id 182B3DB49B for ; Sat, 12 Nov 2005 05:14:46 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so706214wri for ; Sat, 12 Nov 2005 01:14:49 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=AbIJJQoCaTN9OwP99n3Eem5kNWrUaQOi6yq2DeL1PsYqYsEL5Wh7Z275638RkdZtnGnzj+2ulQZDeSySjsb6jSstCDpEwg65W+qm5JmNy9Sg0Vad7LneoJs8tqzhogRgB4ByNRKtIE+dNL2u2ZaDf0Sh9bIyYT+0j/2mgWHO72Y= Received: by 10.54.76.9 with SMTP id y9mr1788797wra; Sat, 12 Nov 2005 01:14:49 -0800 (PST) Received: by 10.54.117.8 with HTTP; Sat, 12 Nov 2005 01:14:49 -0800 (PST) Message-ID: <9e4684ce0511120114m32254efen2faa6563146db202@mail.gmail.com> Date: Sat, 12 Nov 2005 10:14:49 +0100 From: hubert depesz lubaczewski To: dwinner-lists@att.net Subject: Re: slow queries after ANALYZE Cc: pgsql-performance@postgresql.org In-Reply-To: <4374EDF1.5010709@att.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2159_29838048.1131786889103" References: <4374EDF1.5010709@att.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.052 required=5 tests=[AWL=0.051, HTML_MESSAGE=0.001] X-Spam-Score: 0.052 X-Spam-Level: X-Archive-Number: 200511/220 X-Sequence-Number: 15477 ------=_Part_2159_29838048.1131786889103 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 11/11/05, DW wrote: > > I'm perplexed. I'm trying to find out why some queries are taking a long > time, and have found that after running analyze, one particular query > becomes slow. > i have had exactly the same problem very recently. what helped? increasing statistics on come column. which ones? make: explain analyze ; and check in which situations you gget the biggest change of "estiamted rows" and "actual rows". then check what this particular part of your statement is touching, and increase appropriate statistics. depesz ------=_Part_2159_29838048.1131786889103 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 11/11/05, DW <dwinner-lists@att.net> wrote:
I'm perplexed. I'm trying to find out why some queries are taking a longtime, and have found that after running analyze,  one particular= query
becomes slow.

i have had exactly the same problem very recently.
what helped? increasing statistics on come column.
which ones?
make:
explain analyze <your select>;
and check in which situations you gget the biggest change of "estiamte= d rows" and "actual rows".
then check what this particular part of your statement is touching, and inc= rease appropriate statistics.

depesz
------=_Part_2159_29838048.1131786889103-- From pgsql-performance-owner@postgresql.org Sat Nov 12 10:18:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8479ED936B for ; Sat, 12 Nov 2005 10:18:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23818-02 for ; Sat, 12 Nov 2005 14:18:06 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hoboe1bl1.telenet-ops.be (hoboe1bl1.telenet-ops.be [195.130.137.72]) by svr1.postgresql.org (Postfix) with ESMTP id C9E0AD682F for ; Sat, 12 Nov 2005 10:18:07 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by hoboe1bl1.telenet-ops.be (Postfix) with SMTP id 0497D38071; Sat, 12 Nov 2005 15:18:11 +0100 (CET) Received: from [10.0.1.2] (d5152B313.access.telenet.be [81.82.179.19]) by hoboe1bl1.telenet-ops.be (Postfix) with ESMTP id 645C53818D; Sat, 12 Nov 2005 15:18:10 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v623) To: pgsql-performance@postgresql.org Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-206-1026550905 Cc: Hendrik De Hertogh Subject: IO Error From: Yves Vindevogel Date: Sat, 12 Nov 2005 15:18:09 +0100 X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/221 X-Sequence-Number: 15478 --Apple-Mail-206-1026550905 Content-Type: multipart/alternative; boundary=Apple-Mail-207-1026550905 --Apple-Mail-207-1026550905 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed ns30966:~# NOTICE: Executing SQL: update tblPrintjobs set=20 ApplicationType =3D 1 where ApplicationType is null and=20 upper(DocumentName) like '%.DOC' ns30966:~# NOTICE: Executing SQL: update tblPrintjobs set=20 ApplicationType =3D 1 where ApplicationType is null and=20 upper(DocumentName) like 'DOCUMENT%' ns30966:~# ns30966:~# ERROR: could not read block 3231 of relation=20 1663/165707259/173511769: Input/output error CONTEXT: SQL statement "update tblPrintjobs set ApplicationType =3D 1=20= where ApplicationType is null and upper(DocumentName) like=20 'DOCUMENT%'" PL/pgSQL function "fnapplicationtype" line 30 at execute statement [1]+ Exit 1 psql -d kpmg -c "select=20 fnApplicationType()" I get this error. Is this hardware related or could it be something=20 with the postgresql.conf settings. I changed them for performance reasons. (More memory, more wal=20 buffers). There are 2 databases. One got the error yesterday, I dropped it (was=20= brand new), recreated it and the error was gone. Now the error is there again on another database. Personally, I think it's a HD error. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-207-1026550905 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 ns30966:~# NOTICE: Executing SQL: update tblPrintjobs set ApplicationType =3D 1 where ApplicationType is null and upper(DocumentName) like '%.DOC' ns30966:~# NOTICE: Executing SQL: update tblPrintjobs set ApplicationType =3D 1 where ApplicationType is null and upper(DocumentName) like 'DOCUMENT%' ns30966:~# ns30966:~# ERROR: could not read block 3231 of relation 1663/165707259/173511769: Input/output error CONTEXT: SQL statement "update tblPrintjobs set ApplicationType =3D 1 where ApplicationType is null and upper(DocumentName) like 'DOCUMENT%'" PL/pgSQL function "fnapplicationtype" line 30 at execute statement [1]+ Exit 1 psql -d kpmg -c "select fnApplicationType()" I get this error. Is this hardware related or could it be something with the postgresql.conf settings. I changed them for performance reasons. (More memory, more wal buffers). There are 2 databases. One got the error yesterday, I dropped it (was brand new), recreated it and the error was gone. Now the error is there again on another database. Personally, I think it's a HD error. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-207-1026550905-- --Apple-Mail-206-1026550905 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM8LAAMjhhuR5ir4ULjigT5pn+P5co2T6pn+YBup6dp6xoh6kHie95modNOFkah0H+Qhd pyKBNmcf68r2Bo9GGtdpwIAUotM1Q4QMNzUDZhuVZbLsvy7KkqZZCnAb4AFcQY1C3LW1Wb5lOa2t ZvUt78NNjcMN83wEOMDczvuTzXNQ3QEN01WRL2b8XBYEDuugQEFUYgkpIo5FjIJTmhfZkHG8J0nm fB/sifp/EQYLBioUKsBkRKVgWPLX7stA4VnaDa+tZlZel0j+gCMpWS8MRULQNeIDY/4zTIAIyFX0 GFybZnr+rZ8p2a1s6tUNfADXXI1Yb8jLX+MNQk+1Az7zWqwVa/FaJrHpvSLeAQOhdE/l7CSJwrAb BXDXH+PkyA/gUiPGaftASWW6JeDgnGAsCmLNvcYqlz5+FchnZMrqGbeE3JoYhAMAKbEvOGeigtaE CDZwJcgxtiML0uMgQYzllKt2GhtP/EaH6cgAm+fnCtVEVXFOKNU54AC1B/tyLfBx4YJBGwhAAG5m yUoGH/TgxlZ7nGXw3YdEpYTPWOvaSq/JVEX28rEDQsGKDoGPx+QYnE1URg2paZY4dy7EHTx9cc41 upqIfwkjSgJWyW0MgBdK9I1DGAAwnS8G8+4cGYyUWWbKMg/gSiOjQG+FMQ44qqlmgBNUSYYMohKW 2ULFZaR8NdMFucoz/w/ZcAAMzgH+j/AKGV8QAZkhmWNM0AJ/I5zCiJEGYjF1qoGmxI5MqwT7JVlG buLULJhPXlbK+WMt3HwHmIbF8xaA0n6mvPgN7EJhx9Vcax+hsX6wGZuldNDnTSgQDoloGohS6BYE 62gPQqyRhlFE2gIYkCRgdD4WcAUsnxvlYklKgUCn4upi29JkkpG/pbYgtKbr86TLOnbLCF066ZLP kGsI+7NY9rRjZHB+0ew4M5S0AKT4FA8l0BaIUk4XHkj/EYLwzAtVyj/GwRYf49B8D6H+OMdw9R/j DG8vcTgx1xhpFTBoHYilRgaDygQAobXCynVVSSVdRYTLJls5CcIaqX0zpw/Kms76c2DSnTsNNPaA TbpggqOSCg4MkQwcAPiBAzimJqI4Xg3R/itX0P8bY66xD7MiYkgg5h4vAF2NgdY/xNGCH+HQVMIQ WiCNVM2L6Ap4s3ShFixMubA2HnjcUulhab3GuIbGxVjLlxXZoawMKFgsCiaSOUd6nB6XbH+PofKN LtqcH7eMf5AyimQOtegf4/TIEFvYP8dyjTm2eV1KdmNgrlIKr/cOxF+LjmRldTZY88L/U6P/YtyF +b82PDAhkOQsyNkHu8jS76NB4YXH+PvDUG7v3lIFeu8mFbuj6q8PXE2HEaXqIEUEgxnh2T2YhD/B WBZcUunVjO59yMB3PsHc3BONLemxwaP8NwsTMEPvVeMieJKvXmHZk8f48h5GHyYP8e+V3g3tvMQs VY01FLCxjgTHk8b943yBTOVoJEiXJzPgae1zr+2HwYhnIuRzrjczwP8eY8zDmKy7l8NOYcx40zKW nNswizytg+kXHc/qS48x9o7QbNMhZ0yMdvPBG7wmNz/jB6WYs436uFmbHhbFrAFgjhl4Y/g5IvH+ 0EkYFw+NuAHqmoet9bWJwPnDHEfM55E0udjTNW7uZ+y9p6L+oNe3Bxtoa4lACzgQee2kQ5Jwo1RK QPQfK8xejaJ6FG6w/wEh1NZJ+L6ydoH+zfqTUK0dK7AzsY7Yem9jaA0Fu2wVf9eJObqW+TxuwbCS K4JEYVnh2O/vWQM5K+wtCehCCAP5YABybV035xCAJIJqnrTyFqB9H8e1Lu/OumM870MTp3MGn9J8 g5Zsxhk2ZURLfGmrBAEg5m/CISIf4jRekblaCgRoyS0BjWNZVw6uZ70hnsrkND/Fbn3kWWtmz1ID a5NxyLYJ1xujdI3iZTm9dkYy4/P9yFKIcFoDQsbtKW4nT2YbLrpr450V6zTGem7N+YzXVzDZ0PSl ddIb8GQVrlD9sQjy4FKHVy0ZDDeLHCPWuuD/68Y0Vg1LX8c0bQSBiAq9JrVv2pYwZkzq6mqxDi8y XJgBkjZGftMMdUgm5PKyCBnogBI72hYgZlgrD6WWgMzPZkxGdUzfIfIzsdb66PXr/Jxp+XwRGlOL GnuJm2b0l7vo/dJeDL4N7qwWN+qn5CqedNMATuzZmObaad1s4dBMl/6wmG/Pt1+oAAYk2hToiuQc 5FxyjyRoHqH0xYKE+Q8k+UIgH0KAH+HSHqXmGwHSIuEGF0I25eWE8A96/g2akwhIk8Puf25mpi3w /IeG/M8y0O10/WgM3cpUS8l0mS+ocOYgDQS0ASDUTOB6EaJWDkXyXwFyL+GqGkPKHQHMOkxIXmIO HAHAJyyuKgvGIIHgU2H+G0GuHKH+FwF6KwEAtAH+CUEcLOAiNC2QnKcOZSZCmO9ongNep2sA3Y2W nY/KwE9hDazc8w8Sug9mh6cAZ0/UAEC0FKH+AOCOEoJQBeD8H+A2A+DYYGBuD2H+D6DmFCH+F0Fq hDB+PKGcGaaSGsGmJyGOGGg0EuEgP0CqCOEOH+BIA+DQH+AgBSDrD+CAEcH+AICwFNA+pamupfDQ /G1E2asfDksJDesNBCv012x+5WDmQSseeiAaCGEiH+BEAmC0H+A8AcCyH+A4AXGqAqAOCsLqAQCw H+BMAuDIH+CJEWPMCpFKCaCEEASEBFESA2AaC2H+AoAOCqK6AVGqA8AYCvGcAiC9HmBlHZBglBDt F80LF7BNDdBHDg2U0JGI0lGEseWsAgB6EYH+BUAkC4H+BKAuDDGcArH+BCAnH+A8AeC6K7HjG7H4 AoANHtG1G4A1GxGkAfHkBAAjJOBCAqC/FMAuDAH+BOApJ8A0BYDy2aWtGEzI1G2dKRIUwDGDF9BP DooBISnVImB9IsBRJHI2AuDHK3HHI4DFK3K6BGArI8BAAlJ8A8AhJqAlJxJBK3LDLBK9LmBNKCH+ AwBZEZIGcjGM3zKVIRL7BEH8zVKfKojrKlMCQVIk2jKuH/KzH/I5K7MjLFMpMnI5HGBIAvG/I5J9 MvMrK5M/K7LrJ9LxL1DXL5KYp1L/MM80g2wABMzWAGjVDZIc/XDrIiNjKtKxK1MtNBN7MlN9HFJ5 M3J7NDONMnNHLvLzKNKnMS5dNPMAsGpgLKLoAQNswAH8EAGAXGB0EobQAwEEJOblOa1uzJIfNvF9 MXFVMbMfOPODOBOBMxM1K3M7PfPdNFLtNLOZOcfjIOgVPIfeAaD2VGBUEY6ECyFQL+awXWH+HCHa KgW+KoAqDsPu3Mt8rxMO+fOjPTNzMZN3MhPtN/M/PlOJPrPhPvHBPzOXL3KPKhP69Mv4SmYWWs4m QyDGFUGsH+GeHEOkHW204SIED6FmaSBqeZHmQ3Fikw7iPwZWkCSs40Yg0CwTQAxpPUAhPZN5RDS1 PjOHPpRRRFOTP1RZSo5W1skw6MDa6g5omYZW94AYDkN+BOD+NKCoE6SKHy1WA8EOL2Z8cuhGTU/f SlArAu95L2cmiO1xSrQ7PXQ/S/S1RJS9RFUlNBTDRXNPRavw3St25kTXBiQsADBfUFNO/fUC6K+A N+9fTI2SkOfG6YmY9MZWDEFS+0TInFUQSfPI1NQ9MdSzRPUnS5MzRLUdRPUqD02RRaeoseDdSaQn ScQi9G/kPu+e/o+E8UQUoGv/IXMKsOfqZu8O/eV2S89E7QZ7XG8w/edGQYxiTeoSB3FKBQAlRBV9 S3LnWDUjXpN7LCBOAnJ8AyBXKKV0Z7KPKO6i764rXI9wS8DJVq6TAw+hP5MFBJDi0Ofq0i86mQPv XMDRWlBi6QVy6iAYCUEuJIBDESBGA0DNI2AxLjRCAxS4BGAvH5I5J2BLZdZVV9ZtZqDKJIA+DUH+ AiB4ES2a4pDFDE+fVIkg84ZylyTUn7RdYjIZYhQy14fipY9SDTWhSjRg6UAEC+fZGWEfEMBCDbFM AtJ9MzI9LlM8BFZjJ5ZpNBMzLCBJLKH+A+A3ZSAiByEMmcC0FO7Q7eTVSW+ectBY9HQ2oFDTNXak Ns9fIa0hPPVUfqfq5i3OjohIAEC6fYAWB6ERFUBSDxLuAtZSA7JSA/JoH/LPH+BIAtK7bZG4BGAt JCApH+A+AhJPGnJOA0AfH+AiBIDoWuBzc6AICvD8PxUAWJWWj2sfWwsPP9cXWzKc/PGE0jPQvwiE 9kWsAeB+EVI2AaCpdQAbGjGnHkA4AbJPHhI0A2AZI0A6AdI1drG+A6AfG/HhGjfVI1fLfJGpfBGq BGAZHsAvKJA+j7eZencVNSlZGBelINchalStIqbTV7J5I8BDLtdrJPfLfSAZHkA2AXfPfXENJTfl JrK0BFdjMoBOArX7UsYhUxaledgRcZgVBLMTepVU17StSxXlMrZzbgAtLDgrdoAlGiBBK1dhZZLi AxK/OFORRVNNhbhu0PhhafgTW1gXilgbgRhzUbV/OOAwDPFMAxe/ZrPriXXnWJidP3hiuZgPiphk eGA8EUJGWEc3MNhtgdUXSvi5XxS1Z3Zhe/MzbfjNRRUrieVpeejtOg0OseDeNYQexAIEE4GcX2B4 EkRKAMDsNjXSTWcVVVjvi1jzh1WHM/j8AvkAAvkFlHkLjVjdjZF4pPk0nANKLKQIBCESL2D6F6XG XgvWqwHQMqEsGIRaL6RSAgD6bcQAbyNRBkLQDCWNhdNxkPj1V5h3i7N7lLlPlTmtUpjTTHak1tUE DHDyQMDWN+ggQIByEiJOEGOcGIG8Okq7CMXay2KMG8HaU4rcMGCIE8aSBcEWL2Ci4ccggbKXhxlD j3jPPdmxbdLnm3PxNJhZkO1CseseDUNKBIEMJWB8EqhCBqEuGgH+DiFiL+GXQcINAEIhl4McIkXc IICurWWuDulCNiDW85VVi3mplHmuH/j/oZM9odRTohkNNQnjYIc6QIAILmH+BgEOLOtabCUcIPpV qiIOHMKeOQGoJ6C+FaMwAuEJT474DYTfliJQrbgjmrj5OBoXkDobrTJ/LsArX+LQDI72nBlkJQLv C2FBpAEoGOMGGhqsvKH7nlqpqlnpsKKMHgJ+tgGQPKCmFIaSAwD8LOA4EGJWBiCdEFH1G/iPp0Av rXlRrboTdXLDdrI0BSBkD4H/n8JOAkD7o0EwhCECF+PKG6HceBsQRtsPtyOuq4/+22RcFYJGBkBK Ddp4AtI8A2AdHkA/H9uPZZrVp5lNp9OFMzK7iLJ9HhHlgrJ8BSA3FSEWECe+vNsVnkXdt4MVqnvR qiHmHkKgF+F0JqEMD8fECQB4D7uPI8AyAZGjubJ8BAAqClbqAng4AbfZdsKyBTuMDiDOE2H+FmFe JGHMU1vXwrvVwrwxCKagF3pADyDiFEH+CWCAEHJ+A3G4B+BmDmH+DQC7EEFGE4NKHYHUXvwxxqIj t3xtxyIaw0ImGwGus8HgUZx1yGavxxyJyPyRySKIKQFuFibQGOGEYFyVynypymKQCaB/xIDkDOE8 IQFSFEVGE+EsQIIWGEF4L+EwEeP6IOE4EoN2DOC0ErpCDLy6DYDAEyH+FiFU6EHyq6H+DqDUFAH+ G4GwOWIWw0IIEMD68HzsE0H+DgDIE4H+DaDD0cG8G4X2FgFS6EFGE2LAIWG0GsHMH+EoEWTaIOFn uEH+DKCzzkDjzoH+DJ1aH+FuFgbRsGIIEKD2fZyCrEIOGUGMI2E8EqNLz6XmDsDXEgDUC6EwH+DW C9zx1ZzkF4FuOOHUq0D8Dnb8DeDHwd0h0kEeEKQsKQCkCLFKDv2SIQD6DkFJENg2H/ygYFxkPCBu BQDkH+CwCXIsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-206-1026550905 Content-Type: multipart/alternative; boundary=Apple-Mail-208-1026550907 --Apple-Mail-208-1026550907 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-208-1026550907 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-208-1026550907-- --Apple-Mail-206-1026550905-- From pgsql-performance-owner@postgresql.org Sat Nov 12 11:53:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9227EDB4F3 for ; Sat, 12 Nov 2005 11:53:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96420-08 for ; Sat, 12 Nov 2005 15:53:11 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 38323DB4EE for ; Sat, 12 Nov 2005 11:53:13 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jACFrE9q027807; Sat, 12 Nov 2005 10:53:14 -0500 (EST) To: Yves Vindevogel cc: pgsql-performance@postgresql.org, Hendrik De Hertogh Subject: Re: IO Error In-reply-to: References: Comments: In-reply-to Yves Vindevogel message dated "Sat, 12 Nov 2005 15:18:09 +0100" Date: Sat, 12 Nov 2005 10:53:14 -0500 Message-ID: <27806.1131810794@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/222 X-Sequence-Number: 15479 Yves Vindevogel writes: > ns30966:~# ERROR: could not read block 3231 of relation > 1663/165707259/173511769: Input/output error > I get this error. Is this hardware related or could it be something > with the postgresql.conf settings. It's a hardware failure --- bad disk block, likely. You might find more details in the kernel log (/var/log/messages or equivalent). regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 18 16:43:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9A979DB873 for ; Mon, 14 Nov 2005 15:37:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03386-03 for ; Mon, 14 Nov 2005 19:37:52 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id 5222DDB86F for ; Mon, 14 Nov 2005 15:37:53 -0400 (AST) Received: from localhost (unknown [200.46.204.144]) by hub.org (Postfix) with ESMTP id 686F7C08C01 for ; Mon, 14 Nov 2005 23:42:14 -0400 (AST) Received: from hub.org ([200.46.204.220]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05239-02 for ; Mon, 14 Nov 2005 19:37:51 +0000 (GMT) Received: from ganymede.hub.org (blk-222-82-85.eastlink.ca [24.222.82.85]) by hub.org (Postfix) with ESMTP id 80D2FC08BEC for ; Mon, 14 Nov 2005 23:42:12 -0400 (AST) Received: by ganymede.hub.org (Postfix, from userid 1000) id 520F94A91B; Mon, 14 Nov 2005 15:37:31 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 4DE7D4A88F for ; Mon, 14 Nov 2005 15:37:31 -0400 (AST) X-Return-Path: X-Received: from ganymede.hub.org ([unix socket]) by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; Mon, 14 Nov 2005 09:55:37 -0400 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 8175B5C1F9 for ; Mon, 14 Nov 2005 09:55:37 -0400 (AST) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5.2) for scrappy@localhost (single-drop); Mon, 14 Nov 2005 09:55:37 -0400 (AST) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; Mon, 14 Nov 2005 09:53:52 -0400 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B643CD6D16 for ; Mon, 14 Nov 2005 09:53:52 -0400 (AST) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63542-09 for ; Mon, 14 Nov 2005 13:53:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id EBDEFDB74E for ; Mon, 14 Nov 2005 09:25:46 -0400 (AST) X-Received: from mailserver.sandvine.com (sandvine.com [199.243.201.138]) by svr2.postgresql.org (Postfix) with ESMTP id 8B3C1F0C06 for ; Mon, 14 Nov 2005 13:25:50 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5E91E.D67CC41E" Subject: sort/limit across union all Date: Mon, 14 Nov 2005 08:25:10 -0500 Message-ID: <2BCEB9A37A4D354AA276774EE13FB8C263B0F4@mailserver.sandvine.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: sort/limit across union all Thread-Index: AcXpHuwjr78TzCkNQSSpBxjChIGO1w== From: "Marc Morin" To: X-Virus-Scanned: by amavisd-new at hub.org ReSent-Date: Mon, 14 Nov 2005 15:37:27 -0400 (AST) ReSent-From: "Marc G. Fournier" ReSent-To: pgsql-performance@postgresql.org ReSent-Subject: sort/limit across union all ReSent-Message-ID: <20051114153727.M1019@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.851 required=5 tests=[AWL=1.851, HTML_MESSAGE=0.001, UPPERCASE_25_50=0] X-Spam-Score: 1.851 X-Spam-Level: * X-Archive-Number: 200511/381 X-Sequence-Number: 15638 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5E91E.D67CC41E Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable We have a large DB with partitioned tables in postgres. We have had trouble with a ORDER/LIMIT type query. The order and limit are not pushed down to the sub-tables.... =20 CREATE TABLE base ( foo int=20 ); =20 CREATE TABLE bar_0 extra int ) INHERITS (base); ALTER TABLE bar ADD PRIMARY KEY (foo); =20 -- repeated for bar_0... bar_40 =20 SELECT foo FROM base ORDER BY foo LIMIT 10; =20 is real slow. What is required to make the query planner generate the following instead... (code change i know, but how hard would it be?) =20 SELECT foo FROM ( SELECT * FROM bar_0 ORDER BY foo LIMIT 10 UNION ALL SELECT * FROM bar_1 ORDER BY foo LIMIT 10 .... ) AS base ORDER BY foo LIMIT 10; =20 =20 ------_=_NextPart_001_01C5E91E.D67CC41E Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
We = have a large DB=20 with partitioned tables in postgres.   We have had trouble = with a=20 ORDER/LIMIT type query.  The order and limit are not pushed down to = the=20 sub-tables....
 
CREATE = TABLE base=20 (
    foo int
);
 
CREATE = TABLE=20 bar_0
    extra int
) = INHERITS=20 (base);
ALTER = TABLE bar ADD=20 PRIMARY KEY (foo);
 
-- = repeated for=20 bar_0... bar_40
 
SELECT = foo FROM base=20 ORDER BY foo LIMIT 10;
 
is = real slow. What=20 is required to make the query planner generate the following instead... = (code=20 change i know, but how hard would it be?)
 
SELECT
    foo
FROM
(
   =20 SELECT
       =20 *
    FROM = bar_0
    ORDER BY foo = LIMIT=20 10
UNION ALL
    = SELECT
       =20 *
    FROM = bar_1
    ORDER BY foo = LIMIT=20 10
....
) AS base
ORDER BY foo
LIMIT 10;
 
 
------_=_NextPart_001_01C5E91E.D67CC41E-- From pgsql-performance-owner@postgresql.org Mon Nov 14 10:43:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 05FA2DB72A for ; Mon, 14 Nov 2005 10:43:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20084-05 for ; Mon, 14 Nov 2005 14:43:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tbmail.tradebot.com (Tradebot-Systems-1096753.cust-rtr.swbell.net [68.90.170.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5AB4DDB73F for ; Mon, 14 Nov 2005 10:43:25 -0400 (AST) Received: from 192.168.200.29 ([192.168.200.29]) by tbmail.tradebot.com ([192.168.1.50]) with Microsoft Exchange Server HTTP-DAV ; Mon, 14 Nov 2005 14:43:30 +0000 Received: from krb06 by TBMAIL; 14 Nov 2005 08:43:30 -0600 Subject: Re: 8.x index insert performance From: Kelly Burkhart To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <22258.1131750131@sss.pgh.pa.us> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131660117.7514.57.camel@krb06.tradebot.com> <13167.1131668008@sss.pgh.pa.us> <1131749305.14024.32.camel@krb06.tradebot.com> <22258.1131750131@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 14 Nov 2005 08:43:30 -0600 Message-Id: <1131979410.14024.49.camel@krb06.tradebot.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.016 required=5 tests=[AWL=0.015, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.016 X-Spam-Level: X-Archive-Number: 200511/223 X-Sequence-Number: 15480 On Fri, 2005-11-11 at 18:02 -0500, Tom Lane wrote: > > There very well could be a pattern in the data which could affect > > things, however, I'm not sure how to identify it in 100K rows out of > > 100M. > > I conjecture that the problem areas represent places where the key > sequence is significantly "more random" than it is elsewhere. Hard > to be more specific than that though. > OK, I understand the pattern now. My two tables hold orders, and order state transitions. Most orders have two transitions: creation and termination. The problem happens when there is a significant number of orders where termination is happening a long time after creation, causing order_transition rows with old ord_id values to be inserted. This is valid, so I have to figure out a way to accomodate it. You mentioned playing with checkpointing and bgwriter earlier in this thread. I experimented with the bgwriter through the weekend, but I don't have a good idea what sensible parameter changes are... Re: checkpointing, currently my checkpoints are happening every 5 minutes (if I turn on fsync, the graph shows checkpoints dramatically). If I increase the checkpoint_timeout, could that be beneficial? Or would I just have more time between larger spikes? -K From pgsql-performance-owner@postgresql.org Mon Nov 14 15:28:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A9CFDA3E6 for ; Mon, 14 Nov 2005 15:28:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86623-05 for ; Mon, 14 Nov 2005 19:28:27 +0000 (GMT) X-Greylist: delayed 03:16:12.37411 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 7985ADB685 for ; Mon, 14 Nov 2005 15:28:27 -0400 (AST) Received: from tiere.net.avaya.com (tiere.net.avaya.com [198.152.12.100]) by svr2.postgresql.org (Postfix) with ESMTP id E20E9F0BB1 for ; Mon, 14 Nov 2005 16:12:13 +0000 (GMT) Received: from tiere.net.avaya.com (localhost [127.0.0.1]) by tiere.net.avaya.com (Switch-3.1.2/Switch-3.1.0) with ESMTP id jAEG9I4P027540 for ; Mon, 14 Nov 2005 11:09:18 -0500 (EST) Received: from nj7460avexu2.global.avaya.com (h198-152-6-52.avaya.com [198.152.6.52]) by tiere.net.avaya.com (Switch-3.1.2/Switch-3.1.0) with ESMTP id jAEG7R4P024792 for ; Mon, 14 Nov 2005 11:07:40 -0500 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5E930.EEB0B5EC" Subject: Postgres recovery time Date: Mon, 14 Nov 2005 10:34:42 -0500 Message-ID: <16F9BDD39536704DA7BFB3172BF191720355ED84@nj7460avexu2.global.avaya.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Postgres recovery time Thread-Index: AcXpMLjjZt0a1r37Rwm/5vwZVfAf/Q== From: "Piccarello, James (James)" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/226 X-Sequence-Number: 15483 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5E930.EEB0B5EC Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Does anyone know what factors affect the recovery time of postgres if it = does not shutdown cleanly? With the same size database I've seen times = from a few seconds to a few minutes. The longest time was 33 minutes. = The 33 minutes was after a complete system crash and reboot so there are = a lot of other things going on as well. 125 seconds was the longest time = I could reproduce by just doing a kill -9 on postmaster.=20 Is it the size of the transaction log? The dead space in files?=20 I'm running postges 7.3.4 in Red Hat 8.0. Yes, yes I know it's crazy but = for a variety of reasons upgrading is not currently feasible. Jim ------_=_NextPart_001_01C5E930.EEB0B5EC Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Postgres recovery time

Does anyone know what factors affect = the recovery time of postgres if it does not shutdown cleanly? With the = same size database I've seen  times from a few seconds to a few = minutes. The longest time was 33 minutes. The 33 minutes was after a = complete system crash and reboot so there are a lot of other things = going on as well. 125 seconds was the longest time I could reproduce by = just doing a kill -9 on postmaster.

Is it the size of the transaction log? = The dead space in files?

I'm running postges 7.3.4 in Red Hat = 8.0. Yes, yes I know it's crazy but for a variety of reasons upgrading = is not currently feasible.

Jim

------_=_NextPart_001_01C5E930.EEB0B5EC-- From pgsql-performance-owner@postgresql.org Mon Nov 14 11:57:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A1834D9BAD for ; Mon, 14 Nov 2005 11:57:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01813-01 for ; Mon, 14 Nov 2005 15:57:45 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id BF982D9443 for ; Mon, 14 Nov 2005 11:57:47 -0400 (AST) Received: from smtpauth02.mail.atl.earthlink.net (smtpauth02.mail.atl.earthlink.net [209.86.89.62]) by svr2.postgresql.org (Postfix) with ESMTP id AAEBDF0C46 for ; Mon, 14 Nov 2005 15:57:52 +0000 (GMT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=UuPDBMxSoiOxKdAWi+Oh5UpC1VnF7YhP7GL/9RBSNoi9/PfqZmzA4jPs9heWFD5w; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:Cc:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.226.16] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth02.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EbgiK-0002xb-6u; Mon, 14 Nov 2005 10:57:48 -0500 Message-Id: <6.2.5.6.0.20051114104706.01dcf728@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Mon, 14 Nov 2005 10:57:42 -0500 To: Kelly Burkhart , pgsql-performance@postgresql.org From: Ron Subject: Re: 8.x index insert performance Cc: pgsql-performance@postgresql.org In-Reply-To: <1131979410.14024.49.camel@krb06.tradebot.com> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD725@Herge.rcsinc.local> <20051031193547.GA3311@mark.mielke.cc> <18647.1130790629@sss.pgh.pa.us> <1130792391.7026.55.camel@krb06.tradebot.com> <19065.1130793527@sss.pgh.pa.us> <1130852029.7026.88.camel@krb06.tradebot.com> <24845.1130852730@sss.pgh.pa.us> <1131660117.7514.57.camel@krb06.tradebot.com> <13167.1131668008@sss.pgh.pa.us> <1131749305.14024.32.camel@krb06.tradebot.com> <22258.1131750131@sss.pgh.pa.us> <1131979410.14024.49.camel@krb06.tradebot.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc3fdc3a5e2ac505c4707c912fb9379aed350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.226.16 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200511/224 X-Sequence-Number: 15481 At 09:43 AM 11/14/2005, Kelly Burkhart wrote: >On Fri, 2005-11-11 at 18:02 -0500, Tom Lane wrote: > > > There very well could be a pattern in the data which could affect > > > things, however, I'm not sure how to identify it in 100K rows out of > > > 100M. > > > > I conjecture that the problem areas represent places where the key > > sequence is significantly "more random" than it is elsewhere. Hard > > to be more specific than that though. > > > >OK, I understand the pattern now. > >My two tables hold orders, and order state transitions. Most orders >have two transitions: creation and termination. The problem happens >when there is a significant number of orders where termination is >happening a long time after creation, causing order_transition rows with >old ord_id values to be inserted. > >This is valid, so I have to figure out a way to accomodate it. Perhaps a small schema change would help? Instead of having the order state transitions explicitly listed in the table, why not create two new tables; 1 for created orders and 1 for terminated orders. When an order is created, its ord_id goes into the CreatedOrders table. When an order is terminated, its ord_id is added to the TerminatedOrders table and then deleted from the CreatedOrders table. Downsides to this approach are some extra complexity and that you will have to make sure that system disaster recovery includes making sure that no ord_id appears in both the CreatedOrders and TerminatedOrdes tables. Upsides are that the insert problem goes away and certain kinds of accounting and inventory reports are now easier to create. Ron From pgsql-performance-owner@postgresql.org Mon Nov 14 14:53:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5A781D8CBA for ; Mon, 14 Nov 2005 14:53:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39590-07 for ; Mon, 14 Nov 2005 18:53:37 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mtiwmhc13.worldnet.att.net (mtiwmhc13.worldnet.att.net [204.127.131.117]) by svr1.postgresql.org (Postfix) with ESMTP id 0D1FDD8A5B for ; Mon, 14 Nov 2005 14:53:37 -0400 (AST) Received: from [10.10.100.50] (unknown[216.113.237.29]) by worldnet.att.net (mtiwmhc13) with ESMTP id <2005111418533811300sk7o4e>; Mon, 14 Nov 2005 18:53:38 +0000 Message-ID: <4378DD34.4080706@att.net> Date: Mon, 14 Nov 2005 13:53:40 -0500 From: DW Reply-To: dwinner-lists@att.net User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: slow queries after ANALYZE References: <4374EDF1.5010709@att.net> In-Reply-To: <4374EDF1.5010709@att.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.027 required=5 tests=[AWL=0.027] X-Spam-Score: 0.027 X-Spam-Level: X-Archive-Number: 200511/225 X-Sequence-Number: 15482 DW wrote: > Hello, > > I'm perplexed. I'm trying to find out why some queries are taking a long > time, and have found that after running analyze, one particular query > becomes slow. > > This query is based on a view that is based on multiple left outer joins > to merge data from lots of tables. > > If I drop the database and reload it from a dump, the query result is > instaneous (less than one second). > > But after I run analyze, it then takes much longer to run -- about 10 > seconds, give or take a few depending on the hardware I'm testing it on. > Earlier today, it was taking almost 30 seconds on the actual production > server -- I restarted pgsql server and the time got knocked down to > about 10 seconds -- another thing I don't understand. > > I've run the query a number of times before and after running analyze, > and the problem reproduces everytime. I also ran with "explain", and saw > that the costs go up dramatically after I run analyze. > > I'm fairly new to postgresql and not very experienced as a db admin to > begin with, but it looks like I'm going to have to get smarter about > this stuff fast, unless it's something the programmers need to deal with > when constructing their code and queries or designing the databases. > > I've already learned that I've commited the cardinal sin of configuring > my new database server with RAID 5 instead of something more sensible > for databases like 0+1, but I've been testing out and replicating this > problem on different hardware, so I know that this issue is not the > direct cause of this. > > Thanks for any info. I can supply more info (like config files, schemas, > etc.) if you think it might help. But I though I would just describe the > problem for starters. > > -DW > Well, for whatever it's worth, on my test box, I upgraded from postgreql 7.4.9 to 8.1, and that seems to make all the difference in the world. These complex queries are instantaneous, and the query planner when I run EXPLAIN ANALYZE both before and after running ANALYZE displays results more in line with what is expected (< 60ms). Whatever changes were introduced in 8.x seems to make a huge improvment in query performance. > From pgsql-performance-owner@postgresql.org Mon Nov 14 19:54:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4466FDB808 for ; Mon, 14 Nov 2005 19:54:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28683-07-6 for ; Mon, 14 Nov 2005 23:54:11 +0000 (GMT) X-Greylist: delayed 02:12:39.802749 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 4483EDB7DF for ; Mon, 14 Nov 2005 19:54:06 -0400 (AST) Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by svr2.postgresql.org (Postfix) with ESMTP id E9CB9F0B6E for ; Mon, 14 Nov 2005 21:41:27 +0000 (GMT) Received: from [69.145.82.218] (unknown [69.145.82.218]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id 45BBE1102E6; Mon, 14 Nov 2005 13:41:22 -0800 (PST) Message-ID: <43790489.4030803@boreham.org> Date: Mon, 14 Nov 2005 14:41:29 -0700 From: David Boreham Reply-To: david_list@boreham.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Piccarello, James (James)" Cc: pgsql-performance@postgresql.org Subject: Re: Postgres recovery time References: <16F9BDD39536704DA7BFB3172BF191720355ED84@nj7460avexu2.global.avaya.com> In-Reply-To: <16F9BDD39536704DA7BFB3172BF191720355ED84@nj7460avexu2.global.avaya.com> Content-Type: multipart/alternative; boundary="------------000108060204090205000808" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/233 X-Sequence-Number: 15490 This is a multi-part message in MIME format. --------------000108060204090205000808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Piccarello, James (James) wrote: > Does anyone know what factors affect the recovery time of postgres if > it does not shutdown cleanly? With the same size database I've seen > times from a few seconds to a few minutes. The longest time was 33 > minutes. The 33 minutes was after a complete system crash and reboot > so there are a lot of other things going on as well. 125 seconds was > the longest time I could reproduce by just doing a kill -9 on postmaster. > > Is it the size of the transaction log? The dead space in files? > I don't know much about postgresql, but typically WAL mechanisms will exhibit recovery times that are bounded by the amount of log record data written since the last checkpoint. The 'worst' case will be where you have continuous writes to the database and a long checkpoint interval. In that case many log records must be replayed into the data files upon recovery. The 'best' case would be zero write transactions since the last checkpoint. In that case recovery would be swift since there are no live records to recover. In your tests you are probably exercising this 'best' or near best case. --------------000108060204090205000808 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Piccarello, James (James) wrote:
Postgres recovery time

Does anyone know what factors affect the recovery time of postgres if it does not shutdown cleanly? With the same size database I've seen  times from a few seconds to a few minutes. The longest time was 33 minutes. The 33 minutes was after a complete system crash and reboot so there are a lot of other things going on as well. 125 seconds was the longest time I could reproduce by just doing a kill -9 on postmaster.

Is it the size of the transaction log? The dead space in files?

I don't know much about postgresql, but typically WAL mechanisms
will exhibit recovery times that are bounded by the amount of log record
data written since the last checkpoint. The 'worst' case will be where
you have continuous writes to the database and a long checkpoint
interval. In that case many log records must be replayed into the
data files upon recovery. The 'best' case would be zero write transactions
since the last checkpoint. In that case recovery would be swift since
there are no live records to recover. In your tests you are probably
exercising this 'best' or near best case.


--------------000108060204090205000808-- From pgsql-performance-owner@postgresql.org Mon Nov 14 19:07:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C0295DB6F4 for ; Mon, 14 Nov 2005 19:07:23 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01122-01 for ; Mon, 14 Nov 2005 23:07:20 +0000 (GMT) X-Greylist: delayed 00:59:59.888063 by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 07227DB6AA for ; Mon, 14 Nov 2005 19:07:21 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21634304; Mon, 14 Nov 2005 15:07:21 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAEM7LCo030131; Mon, 14 Nov 2005 15:07:21 -0700 Message-ID: <43790A99.9050603@noao.edu> Date: Mon, 14 Nov 2005 15:07:21 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgres-performance Subject: Help speeding up delete Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/227 X-Sequence-Number: 15484 We've got an older system in production (PG 7.2.4). Recently one of the users has wanted to implement a selective delete, but is finding that the time it appears to take exceeds her patience factor by several orders of magnitude. Here's a synopsis of her report. It appears that the "WHERE id IN ..." is resulting in a seq scan that is causing the problem, but we're not SQL expert enough to know what to do about it. Can someone point out what we're doing wrong, or how we could get a (much) faster delete? Thanks! Report: ============================================================ This command yields results in only a few seconds: # SELECT at.id FROM "tmp_table2" at, "tmp_tabl2e" a # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; However, the following command does not seen to want to ever complete (the person running this killed it after 1/2 hour). # DELETE FROM "tmp_table2" WHERE id IN # (SELECT at.id FROM "tmp_table2" at, "tmp_table2" a # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'); ============================================================== The table has four columns. There are 6175 rows satifying the condition given, and the table itself has 1539688 entries. Layout is: lab.devel.configdb=# \d tmp_table2 Table "tmp_table2" Column | Type | Modifiers --------+--------------------------+----------- id | character varying(64) | name | character varying(64) | units | character varying(32) | value | text | time | timestamp with time zone | ============================================================== lab.devel.configdb=# EXPLAIN DELETE FROM "tmp_table2" WHERE id IN lab.devel.configdb-# (SELECT at.id FROM "tmp_table2" at, "tmp_table2" a lab.devel.configdb(# WHERE at.id=a.id AND a.name='obsid' AND a.value='oid080505'); NOTICE: QUERY PLAN: Seq Scan on tmp_table2 (cost=0.00..154893452082.10 rows=769844 width=6) SubPlan -> Materialize (cost=100600.52..100600.52 rows=296330 width=100) -> Hash Join (cost=42674.42..100600.52 rows=296330 width=100) -> Seq Scan on tmp_table2 at (cost=0.00..34975.88 rows=1539688 width=50) -> Hash (cost=42674.32..42674.32 rows=38 width=50) -> Seq Scan on tmp_table2 a (cost=0.00..42674.32 rows=38 width=50) EXPLAIN lab.devel.configdb=# EXPLAIN (SELECT at.id FROM "tmp_table2" at, "tmp_table2" a lab.devel.configdb(# WHERE at.id=a.id AND a.name='obsid' AND a.value='oid080505'); NOTICE: QUERY PLAN: Hash Join (cost=42674.42..100600.52 rows=296330 width=100) -> Seq Scan on tmp_table2 at (cost=0.00..34975.88 rows=1539688 width=50) -> Hash (cost=42674.32..42674.32 rows=38 width=50) -> Seq Scan on tmp_table2 a (cost=0.00..42674.32 rows=38 width=50) EXPLAIN -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Mon Nov 14 19:20:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A107FDB77A for ; Mon, 14 Nov 2005 19:20:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11371-03 for ; Mon, 14 Nov 2005 23:20:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id 400C6DA720 for ; Mon, 14 Nov 2005 19:20:20 -0400 (AST) Received: by calvin.slamb.org (Postfix, from userid 103) id AC5436FD1F; Mon, 14 Nov 2005 17:20:23 -0600 (CST) Received: from [IPv6:::1] (localhost.slamb.org [127.0.0.1]) by calvin.slamb.org (Postfix) with ESMTP id 6FE3D6FCA2; Mon, 14 Nov 2005 17:20:22 -0600 (CST) In-Reply-To: <43790A99.9050603@noao.edu> References: <43790A99.9050603@noao.edu> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> Cc: Postgres-performance Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: Help speeding up delete Date: Mon, 14 Nov 2005 15:20:21 -0800 To: Steve Wampler X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/228 X-Sequence-Number: 15485 On Nov 14, 2005, at 2:07 PM, Steve Wampler wrote: > # SELECT at.id FROM "tmp_table2" at, "tmp_tabl2e" a > # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; Isn't this equivalent? select id from tmp_table2 where name = 'obsid' and value = 'oid080505'; > # DELETE FROM "tmp_table2" WHERE id IN > # (SELECT at.id FROM "tmp_table2" at, "tmp_table2" a > # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'); and this? delete from tmp_table2 where name = 'obsid' and value = 'oid080505'; Why are you doing a self-join using id, which I assume is a primary key? -- Scott Lamb From pgsql-performance-owner@postgresql.org Mon Nov 14 19:42:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 912A2DB758 for ; Mon, 14 Nov 2005 19:42:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26651-05 for ; Mon, 14 Nov 2005 23:42:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5816EDB715 for ; Mon, 14 Nov 2005 19:42:43 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAENghuu004163; Mon, 14 Nov 2005 18:42:43 -0500 (EST) To: Steve Wampler cc: Postgres-performance Subject: Re: Help speeding up delete In-reply-to: <43790A99.9050603@noao.edu> References: <43790A99.9050603@noao.edu> Comments: In-reply-to Steve Wampler message dated "Mon, 14 Nov 2005 15:07:21 -0700" Date: Mon, 14 Nov 2005 18:42:43 -0500 Message-ID: <4162.1132011763@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/229 X-Sequence-Number: 15486 Steve Wampler writes: > We've got an older system in production (PG 7.2.4). Recently > one of the users has wanted to implement a selective delete, > but is finding that the time it appears to take exceeds her > patience factor by several orders of magnitude. Here's > a synopsis of her report. It appears that the "WHERE > id IN ..." is resulting in a seq scan that is causing > the problem, but we're not SQL expert enough to know > what to do about it. > Can someone point out what we're doing wrong, or how we > could get a (much) faster delete? Thanks! Update to 7.4 or later ;-) Quite seriously, if you're still using 7.2.4 for production purposes you could justifiably be accused of negligence. There are three or four data-loss-grade bugs fixed in the later 7.2.x releases, not to mention security holes; and that was before we abandoned support for 7.2. You *really* need to be thinking about an update. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Nov 14 19:54:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0016ADB7B4 for ; Mon, 14 Nov 2005 19:54:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24131-04-5 for ; Mon, 14 Nov 2005 23:54:08 +0000 (GMT) X-Greylist: delayed 00:07:28.061495 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 42BB9DB7D9 for ; Mon, 14 Nov 2005 19:54:04 -0400 (AST) Received: from seiumain.SEIU.local (unknown [204.107.254.246]) by svr2.postgresql.org (Postfix) with ESMTP id DA9CFF0E1D for ; Mon, 14 Nov 2005 23:46:39 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5E975.A9925674" Subject: Hardware/OS recommendations for large databases (5TB) X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Mon, 14 Nov 2005 18:46:41 -0500 Message-ID: <1B80C974ABFB23429A403B6667FE84C71066E8@seiumain.SEIU.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Hardware/OS recommendations for large databases (5TB) Thread-Index: AcXpda8A8NHotzO6TfG+EL6U5TQ8/g== From: "Adam Weisberg" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/232 X-Sequence-Number: 15489 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5E975.A9925674 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Does anyone have recommendations for hardware and/or OS to work with around 5TB datasets?=20 =20 The data is for analysis, so there is virtually no inserting besides a big bulk load. Analysis involves full-database aggregations - mostly basic arithmetic and grouping. In addition, much smaller subsets of data would be pulled and stored to separate databases. =20 I have been working with datasets no bigger than around 30GB, and that (I'm afraid to admit) has been in MSSQL. =20 Thanks, =20 Adam ------_=_NextPart_001_01C5E975.A9925674 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Does = anyone have=20 recommendations for hardware and/or OS to work with around 5TB datasets? =
 
The = data is for=20 analysis, so there is virtually no inserting besides a big bulk=20 load.=20 Analysis involves full-database aggregations - mostly basic = arithmetic and=20 grouping. In addition, much smaller subsets of data would be pulled = and=20 stored to separate databases.
 
I = have been=20 working with datasets no bigger than around 30GB, and that (I'm=20 afraid to admit) has been in MSSQL.
 
Thanks,
 
Adam
------_=_NextPart_001_01C5E975.A9925674-- From pgsql-performance-owner@postgresql.org Mon Nov 14 19:51:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F190ED9FD6 for ; Mon, 14 Nov 2005 19:51:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18163-09 for ; Mon, 14 Nov 2005 23:51:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 6C762D9D64 for ; Mon, 14 Nov 2005 19:51:11 -0400 (AST) Received: (qmail 8504 invoked from network); 14 Nov 2005 23:51:11 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 14 Nov 2005 23:51:11 -0000 In-Reply-To: <1131283854.15471.4.camel@Panoramix> References: <1131283854.15471.4.camel@Panoramix> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Pgsql-Performance Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware Raid5 / Debian?? Date: Mon, 14 Nov 2005 18:51:09 -0500 To: Joost Kraaijeveld X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.022 required=5 tests=[AWL=0.022] X-Spam-Score: 0.022 X-Spam-Level: X-Archive-Number: 200511/230 X-Sequence-Number: 15487 Joost, I've got experience with these controllers and which version do you have. I'd expect to see higher than 50MB/s although I've never tried RAID 5 I routinely see closer to 100MB/s with RAID 1+0 on their 9000 series I would also suggest that shared buffers should be higher than 7500, closer to 30000, and effective cache should be up around 200k work_mem is awfully high, remember that this will be given to each and every connection and can be more than 1x this number per connection depending on the number of sorts done in the query. fsync=false ? I'm not even sure why we have this option, but I'd never set it to false. Dave On 6-Nov-05, at 8:30 AM, Joost Kraaijeveld wrote: > Hi, > > I am experiencing very long update queries and I want to know if it > reasonable to expect them to perform better. > > The query below is running for more than 1.5 hours (5500 seconds) now, > while the rest of the system does nothing (I don't even type or move a > mouse...). > > - Is that to be expected? > - Is 180-200 tps with ~ 9000 KB (see output iostat below) not low, > given > the fact that fsync is off? (Note: with bonnie++ I get write > performance > 50 MB/sec and read performace > 70 MB/sec with > 2000 > read/write ops /sec? > - Does anyone else have any experience with the 3Ware RAID controller > (which is my suspect)? > - Any good idea how to determine the real botleneck if this is not the > performance I can expect? > > My hard- and software: > > - PostgreSQL 8.0.3 > - Debian 3.1 (Sarge) AMD64 > - Dual Opteron > - 4GB RAM > - 3ware Raid5 with 5 disks > > Pieces of my postgresql.conf (All other is default): > shared_buffers = 7500 > work_mem = 260096 > fsync=false > effective_cache_size = 32768 > > > > The query with explain (amount and orderbedrag_valuta are float8, > ordernummer and ordernumber int4): > > explain update prototype.orders set amount = > odbc.orders.orderbedrag_valuta from odbc.orders where ordernumber = > odbc.orders.ordernummer; > QUERY PLAN > ---------------------------------------------------------------------- > ------- > Hash Join (cost=50994.74..230038.17 rows=1104379 width=466) > Hash Cond: ("outer".ordernumber = "inner".ordernummer) > -> Seq Scan on orders (cost=0.00..105360.68 rows=3991868 > width=455) > -> Hash (cost=48233.79..48233.79 rows=1104379 width=15) > -> Seq Scan on orders (cost=0.00..48233.79 rows=1104379 > width=15) > > > Sample output from iostat during query (about avarage): > Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn > hdc 0.00 0.00 0.00 0 0 > sda 0.00 0.00 0.00 0 0 > sdb 187.13 23.76 8764.36 24 8852 > > > -- > Groeten, > > Joost Kraaijeveld > Askesis B.V. > Molukkenstraat 14 > 6524NB Nijmegen > tel: 024-3888063 / 06-51855277 > fax: 024-3608416 > e-mail: J.Kraaijeveld@Askesis.nl > web: www.askesis.nl > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that > your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Mon Nov 14 19:52:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD41DDB685 for ; Mon, 14 Nov 2005 19:52:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29819-05 for ; Mon, 14 Nov 2005 23:52:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 3D34EDAA96 for ; Mon, 14 Nov 2005 19:52:53 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21636207; Mon, 14 Nov 2005 16:52:55 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAENqrpv000541; Mon, 14 Nov 2005 16:52:54 -0700 Message-ID: <43792355.1020501@noao.edu> Date: Mon, 14 Nov 2005 16:52:53 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Lamb CC: Postgres-performance Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> In-Reply-To: <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/231 X-Sequence-Number: 15488 Scott Lamb wrote: > On Nov 14, 2005, at 2:07 PM, Steve Wampler wrote: > >> # SELECT at.id FROM "tmp_table2" at, "tmp_tabl2e" a >> # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; > > > Isn't this equivalent? > > select id from tmp_table2 where name = 'obsid' and value = 'oid080505'; Probably, the user based the above on a query designed to find all rows with the same id as those rows that have a.name='obsid' and a.value='oid080505'. However, I think the above would work to locate all the ids, which is all we need for the delete (see below) >> # DELETE FROM "tmp_table2" WHERE id IN >> # (SELECT at.id FROM "tmp_table2" at, "tmp_table2" a >> # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'); > > > and this? > > delete from tmp_table2 where name = 'obsid' and value = 'oid080505'; > > Why are you doing a self-join using id, which I assume is a primary key? Because I think we need to. The above would only delete rows that have name = 'obsid' and value = 'oid080505'. We need to delete all rows that have the same ids as those rows. However, from what you note, I bet we could do: DELETE FROM "tmp_table2" WHERE id IN (SELECT id FROM "temp_table2" WHERE name = 'obsid' and value= 'oid080505'); However, even that seems to have a much higher cost than I'd expect: lab.devel.configdb=# explain delete from "tmp_table2" where id in (select id from tmp_table2 where name='obsid' and value = 'oid080505'); NOTICE: QUERY PLAN: Seq Scan on tmp_table2 (cost=0.00..65705177237.26 rows=769844 width=6) SubPlan -> Materialize (cost=42674.32..42674.32 rows=38 width=50) -> Seq Scan on tmp_table2 (cost=0.00..42674.32 rows=38 width=50) EXPLAIN And, sure enough, is taking an extrordinarily long time to run (more than 10 minutes so far, compared to < 10seconds for the select). Is this really typical of deletes? It appears (to me) to be the Seq Scan on tmp_table2 that is the killer here. If we put an index on, would it help? (The user claims she tried that and it's EXPLAIN cost went even higher, but I haven't checked that...) Thanks! -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Mon Nov 14 20:02:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DC810DA3DF for ; Mon, 14 Nov 2005 20:00:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44024-01 for ; Tue, 15 Nov 2005 00:00:35 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 4BF26DA3E6 for ; Mon, 14 Nov 2005 20:00:37 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21636357; Mon, 14 Nov 2005 17:00:36 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAF00Zva000706; Mon, 14 Nov 2005 17:00:36 -0700 Message-ID: <43792523.5090003@noao.edu> Date: Mon, 14 Nov 2005 17:00:35 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane CC: Postgres-performance Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> In-Reply-To: <4162.1132011763@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/234 X-Sequence-Number: 15491 Tom Lane wrote: > Steve Wampler writes: > >>We've got an older system in production (PG 7.2.4). Recently >>one of the users has wanted to implement a selective delete, >>but is finding that the time it appears to take exceeds her >>patience factor by several orders of magnitude. Here's >>a synopsis of her report. It appears that the "WHERE >>id IN ..." is resulting in a seq scan that is causing >>the problem, but we're not SQL expert enough to know >>what to do about it. > > >>Can someone point out what we're doing wrong, or how we >>could get a (much) faster delete? Thanks! > > > Update to 7.4 or later ;-) I was afraid you'd say that :-) I'm not officially involved in this project anymore and was hoping for a fix that wouldn't drag me back in. The security issues aren't a concern because this DB is *well* hidden from the outside world (it's part of a telescope control system behind several firewalls with no outside access). However, the data-loss-grade bugs issue *is* important. We'll try to do the upgrade as soon as we get some cloudy days to actually do it! Is the performance behavior that we're experiencing a known problem with 7.2 that has been addressed in 7.4? Or will the upgrade fix other problems while leaving this one? > Quite seriously, if you're still using 7.2.4 for production purposes > you could justifiably be accused of negligence. There are three or four > data-loss-grade bugs fixed in the later 7.2.x releases, not to mention > security holes; and that was before we abandoned support for 7.2. > You *really* need to be thinking about an update. Thanks! Steve -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Mon Nov 14 20:10:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E461DB7A9 for ; Mon, 14 Nov 2005 20:10:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41912-07 for ; Tue, 15 Nov 2005 00:10:09 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 3AA00DB7A6 for ; Mon, 14 Nov 2005 20:10:11 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 36so1382023wra for ; Mon, 14 Nov 2005 16:10:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=ikg1ACjRybQ6Ts8HvcLonNbaKm+Hb3S/37Ou9evBl36fHuFsgDd/ESRcLaDC6jGqNt8QXPjuBMGNtZ4kltI6+FkRpxUv2yZqh+s2xm39CzrS9Dyv+Nr0aTjdpDfjKVPiKSBkNN2abGEBNumL+qCaKpbtGjbNOkqSRM6BECs97EA= Received: by 10.65.153.12 with SMTP id f12mr6428102qbo; Mon, 14 Nov 2005 16:10:14 -0800 (PST) Received: by 10.64.243.11 with HTTP; Mon, 14 Nov 2005 16:10:14 -0800 (PST) Message-ID: <38242de90511141610j621d9a02r52a1d6f4fc55cb55@mail.gmail.com> Date: Mon, 14 Nov 2005 17:10:14 -0700 From: Joshua Marsh To: Postgres-performance Subject: Re: Help speeding up delete In-Reply-To: <43792355.1020501@noao.edu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7809_18807905.1132013414563" References: <43790A99.9050603@noao.edu> <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> <43792355.1020501@noao.edu> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/235 X-Sequence-Number: 15492 ------=_Part_7809_18807905.1132013414563 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 11/14/05, Steve Wampler wrote: > However, even that seems to have a much higher cost than I'd expect: > > lab.devel.configdb=3D# explain delete from "tmp_table2" where id in > (select id from tmp_table2 where name=3D'obsid' and value =3D 'oid080505'= ); > NOTICE: QUERY PLAN: > > Seq Scan on tmp_table2 (cost=3D0.00..65705177237.26 rows=3D769844 width= =3D6) > SubPlan > -> Materialize (cost=3D42674.32..42674.32 rows=3D38 width=3D50) > -> Seq Scan on tmp_table2 (cost=3D0.00..42674.32 rows=3D38 width=3D50) > For one reason or the other, the planner things a sequential scan is the best solution. Try turning off seq_scan before the query and see if it changes the plan (set enable_seqscan off;). I've seen this problem with sub queries and that usually solves it. -- This E-mail is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521 and is legally privileged. This information is confidential information and is intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. ------=_Part_7809_18807905.1132013414563 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

On 11/14/05, Steve Wampler <swample= r@noao.edu> wrote:
However, even that seems to have a much higher cost than I'd expect:
   lab.devel.configdb=3D# explain delete from "tmp_table2&q= uot; where id in
        (select= id from tmp_table2 where name=3D'obsid' and value =3D 'oid080505');
   NOTICE:  QUERY PLAN:

   Seq Sca= n on tmp_table2  (cost=3D0.00..65705177237.26 rows=3D769844 width= =3D6)
     SubPlan
     =   ->  Materialize  (cost=3D42674.32..42674.32 r= ows=3D38 width=3D50)
        &nb= sp;    ->  Seq Scan on tmp_table2  (cost=3D0.00..42674.32 rows=3D38 width=3D50)

For one reason or the other, the planner things a sequential scan is the best solution. Try turning off seq_scan before the query and see if it changes the plan (set enable_seqscan off;). 

I've seen this problem with sub queries and that usually solves it.

--
This E-mail is covered by the Electronic Communications Privacy = Act, 18 U.S.C. 2510-2521 and is legally privileged.

This information is confidential information and is intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. ------=_Part_7809_18807905.1132013414563-- From pgsql-performance-owner@postgresql.org Mon Nov 14 20:28:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BC6C8DB78D for ; Mon, 14 Nov 2005 20:28:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56452-05 for ; Tue, 15 Nov 2005 00:28:17 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id E40F2DB774 for ; Mon, 14 Nov 2005 20:28:18 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21636820; Mon, 14 Nov 2005 17:28:19 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAF0SJc5001260; Mon, 14 Nov 2005 17:28:19 -0700 Message-ID: <43792BA3.3060702@noao.edu> Date: Mon, 14 Nov 2005 17:28:19 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgres-performance Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> <43792355.1020501@noao.edu> <38242de90511141610j621d9a02r52a1d6f4fc55cb55@mail.gmail.com> In-Reply-To: <38242de90511141610j621d9a02r52a1d6f4fc55cb55@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/236 X-Sequence-Number: 15493 Joshua Marsh wrote: > > > On 11/14/05, *Steve Wampler* > wrote: > > However, even that seems to have a much higher cost than I'd expect: > > lab.devel.configdb=# explain delete from "tmp_table2" where id in > (select id from tmp_table2 where name='obsid' and value = > 'oid080505'); > NOTICE: QUERY PLAN: > > Seq Scan on tmp_table2 (cost=0.00..65705177237.26 rows=769844 > width=6) > SubPlan > -> Materialize (cost=42674.32..42674.32 rows=38 width=50) > -> Seq Scan on tmp_table2 (cost=0.00..42674.32 > rows=38 width=50) > > > For one reason or the other, the planner things a sequential scan is the > best solution. Try turning off seq_scan before the query and see if it > changes the plan (set enable_seqscan off;). > > I've seen this problem with sub queries and that usually solves it. > Hmmm, not only does it still use sequential scans, it thinks it'll take even longer: set enable_seqscan to off; SET VARIABLE explain delete from "tmp_table2" where id in (select id from tmp_table2 where name='obsid' and value = 'oid080505'); NOTICE: QUERY PLAN: Seq Scan on tmp_table2 (cost=100000000.00..160237039405992.50 rows=800836 width=6) SubPlan -> Materialize (cost=100043604.06..100043604.06 rows=45 width=26) -> Seq Scan on tmp_table2 (cost=100000000.00..100043604.06 rows=45 width=26) EXPLAIN But the advice sounds like it *should* have helped... -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Mon Nov 14 21:08:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DC6C9D6D8C for ; Mon, 14 Nov 2005 21:08:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12476-01 for ; Tue, 15 Nov 2005 01:08:02 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by svr1.postgresql.org (Postfix) with ESMTP id 535C9DB77F for ; Mon, 14 Nov 2005 21:08:03 -0400 (AST) Received: by calvin.slamb.org (Postfix, from userid 103) id 616AB6FD21; Mon, 14 Nov 2005 19:08:07 -0600 (CST) Received: from [IPv6:::1] (localhost.slamb.org [127.0.0.1]) by calvin.slamb.org (Postfix) with ESMTP id C4AC16FCD7; Mon, 14 Nov 2005 19:08:05 -0600 (CST) In-Reply-To: <43792355.1020501@noao.edu> References: <43790A99.9050603@noao.edu> <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> <43792355.1020501@noao.edu> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Postgres-performance Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: Help speeding up delete Date: Mon, 14 Nov 2005 17:08:03 -0800 To: Steve Wampler X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/237 X-Sequence-Number: 15494 On Nov 14, 2005, at 3:52 PM, Steve Wampler wrote: > Scott Lamb wrote: >> On Nov 14, 2005, at 2:07 PM, Steve Wampler wrote: >> >>> # SELECT at.id FROM "tmp_table2" at, "tmp_tabl2e" a >>> # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; >> >> >> Isn't this equivalent? >> >> select id from tmp_table2 where name = 'obsid' and value = >> 'oid080505'; > > Probably, the user based the above on a query designed to find > all rows with the same id as those rows that have a.name='obsid' and > a.value='oid080505'. Well, this indirection is only significant if those two sets can differ. If (A) you meant "tmp_table2" when you wrote "tmp_tabl2e", so this is a self-join, and (B) there is a primary key on "id", I don't think that can ever happen. > It appears (to me) to be the Seq Scan on tmp_table2 > that is the killer here. If we put an index on, would it help? On...tmp_table2.id? If it is a primary key, there already is one. If not, yeah, I expect it would help. -- Scott Lamb From pgsql-performance-owner@postgresql.org Fri Nov 18 16:43:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91915DB7AD for ; Mon, 14 Nov 2005 21:29:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25298-01 for ; Tue, 15 Nov 2005 01:29:22 +0000 (GMT) X-Greylist: delayed 00:10:32.702321 by SQLgrey- Received: from mail-ihug.icp-qv1-irony3.iinet.net.au (ihug-mail.icp-qv1-irony3.iinet.net.au [203.59.1.197]) by svr1.postgresql.org (Postfix) with ESMTP id 9212BDB77F for ; Mon, 14 Nov 2005 21:29:23 -0400 (AST) Received: from 203-214-116-121.dyn.iinet.net.au (HELO [192.168.1.21]) ([203.214.116.121]) by mail-ihug.icp-qv1-irony3.iinet.net.au with ESMTP; 15 Nov 2005 09:18:49 +0800 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAQAAA+k= Message-ID: <43793778.7040006@linuxgamers.net> Date: Tue, 15 Nov 2005 12:18:48 +1100 From: Leigh Dyer User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Postgres-performance Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <43792523.5090003@noao.edu> In-Reply-To: <43792523.5090003@noao.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/382 X-Sequence-Number: 15639 Steve Wampler wrote: > > Is the performance behavior that we're experiencing a known > problem with 7.2 that has been addressed in 7.4? Or will the > upgrade fix other problems while leaving this one? I'm pretty sure that in versions earlier than 7.4, IN clauses that use a subquery will always use a seqscan, regardless of what indexes are available. If you try an IN using explicit values though, it should use the index. Thanks Leigh From pgsql-performance-owner@postgresql.org Tue Nov 15 00:04:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BC9A3DB7D1 for ; Tue, 15 Nov 2005 00:04:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51677-04 for ; Tue, 15 Nov 2005 04:04:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id E8BF4DB77B for ; Tue, 15 Nov 2005 00:04:00 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21639674; Mon, 14 Nov 2005 21:03:58 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAF43uGO005497; Mon, 14 Nov 2005 21:03:57 -0700 Message-ID: <43795E2C.4040502@noao.edu> Date: Mon, 14 Nov 2005 21:03:56 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Lamb CC: Postgres-performance Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <5E90D296-FA4A-4E48-92B4-396AADE35EF2@slamb.org> <43792355.1020501@noao.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/238 X-Sequence-Number: 15495 Scott Lamb wrote: > On Nov 14, 2005, at 3:52 PM, Steve Wampler wrote: > >> Scott Lamb wrote: >> >>> On Nov 14, 2005, at 2:07 PM, Steve Wampler wrote: >>> >>>> # SELECT at.id FROM "tmp_table2" at, "tmp_tabl2e" a >>>> # WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; >>> >>> >>> >>> Isn't this equivalent? >>> >>> select id from tmp_table2 where name = 'obsid' and value = 'oid080505'; >> >> >> Probably, the user based the above on a query designed to find >> all rows with the same id as those rows that have a.name='obsid' and >> a.value='oid080505'. > > > Well, this indirection is only significant if those two sets can > differ. If (A) you meant "tmp_table2" when you wrote "tmp_tabl2e", so > this is a self-join, and (B) there is a primary key on "id", I don't > think that can ever happen. I wasn't clear. The original query was: SELECT at.* FROM "tmp_table2" at, "tmp_table2" a WHERE at.id=a.id and a.name='obsid' and a.value='oid080505'; which is significantly different than: SELECT * FROM "tmp_table2" WHERE name='obsid' and value='oid080505'; The user had adapted that query for her needs, but it would have been better to just use the query that you suggested (as the subselect in the DELETE FROM...). Unfortunately, that only improves performance slightly - it is still way too slow on deletes. -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Tue Nov 15 04:28:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 71271D7E67 for ; Tue, 15 Nov 2005 04:28:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93211-02 for ; Tue, 15 Nov 2005 08:28:34 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) by svr1.postgresql.org (Postfix) with ESMTP id 9EE35D6D8C for ; Tue, 15 Nov 2005 04:28:29 -0400 (AST) Received: by zproxy.gmail.com with SMTP id m7so1901779nzf for ; Tue, 15 Nov 2005 00:28:30 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UIKFEHWvVTKobTTlHA+0tXlOXSDmey1yoVjTjabopG3xDNXSJMB/ieRpw7X/IgepSIgVWXohYMA/ixFQ6/g82/OOs0i4f99OyXjy52yJYz2sXqyCCFkBaJ4jlPfdjVu+QHAbhagAfkL4yWnddWt5u4yi7HHdnYMMr4BfWFIAQnA= Received: by 10.64.179.4 with SMTP id b4mr6457895qbf; Tue, 15 Nov 2005 00:28:30 -0800 (PST) Received: by 10.65.192.16 with HTTP; Tue, 15 Nov 2005 00:28:30 -0800 (PST) Message-ID: Date: Tue, 15 Nov 2005 09:28:30 +0100 From: Claus Guttesen To: Adam Weisberg Subject: Re: Hardware/OS recommendations for large databases (5TB) Cc: pgsql-performance@postgresql.org In-Reply-To: <1B80C974ABFB23429A403B6667FE84C71066E8@seiumain.SEIU.local> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1B80C974ABFB23429A403B6667FE84C71066E8@seiumain.SEIU.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/239 X-Sequence-Number: 15496 > Does anyone have recommendations for hardware and/or OS to work with arou= nd > 5TB datasets? Hardware-wise I'd say dual core opterons. One dual-core-opteron performs better than two single-core at the same speed. Tyan makes some boards that have four sockets, thereby giving you 8 cpu's (if you need that many). Sun and HP also makes nice hardware although the Tyan board is more competetive priced. OS wise I would choose the FreeBSD amd64 port but partititions larger than 2 TB needs some special care, using gpt rather than disklabel etc., tools like fsck may not be able to completely check partitions larger than 2 TB. Linux or Solaris with either LVM or Veritas FS sounds like candidates. > I have been working with datasets no bigger than around 30GB, and that (I= 'm > afraid to admit) has been in MSSQL. Well, our data are just below 30 GB so I can't help you there :-) regards Claus From pgsql-performance-owner@postgresql.org Tue Nov 15 04:47:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30770DB7E6 for ; Tue, 15 Nov 2005 04:47:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94644-02 for ; Tue, 15 Nov 2005 08:47:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 4E448DB7C2 for ; Tue, 15 Nov 2005 04:47:36 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id F21348F286; Tue, 15 Nov 2005 09:47:37 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: Help speeding up delete Date: Tue, 15 Nov 2005 09:47:37 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE6C7BC4@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Help speeding up delete thread-index: AcXpdueiGEYNxDEkTyGP+2rfwNG0fgASfQVA From: "Magnus Hagander" To: "Steve Wampler" , "Scott Lamb" Cc: "Postgres-performance" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/240 X-Sequence-Number: 15497 > Because I think we need to. The above would only delete rows=20 > that have name =3D 'obsid' and value =3D 'oid080505'. We need to=20 > delete all rows that have the same ids as those rows. =20 > However, from what you note, I bet we could do: >=20 > DELETE FROM "tmp_table2" WHERE id IN > (SELECT id FROM "temp_table2" WHERE name =3D 'obsid' and=20 > value=3D 'oid080505'); >=20 > However, even that seems to have a much higher cost than I'd expect: >=20 > lab.devel.configdb=3D# explain delete from "tmp_table2" where id in > (select id from tmp_table2 where name=3D'obsid' and=20 > value =3D 'oid080505'); > NOTICE: QUERY PLAN: >=20 > Seq Scan on tmp_table2 (cost=3D0.00..65705177237.26=20 > rows=3D769844 width=3D6) > SubPlan > -> Materialize (cost=3D42674.32..42674.32 rows=3D38 = width=3D50) > -> Seq Scan on tmp_table2 (cost=3D0.00..42674.32=20 > rows=3D38 width=3D50) >=20 > EXPLAIN >=20 > And, sure enough, is taking an extrordinarily long time to=20 > run (more than 10 minutes so far, compared to < 10seconds for=20 > the select). Is this really typical of deletes? It appears=20 > (to me) to be the Seq Scan on tmp_table2 that is the killer=20 > here. If we put an index on, would it help? (The user=20 > claims she tried that and it's EXPLAIN cost went even higher,=20 > but I haven't checked that...) Earlier pg versions have always been bad at dealing with IN subqueries. Try rewriting it as (with fixing any broken syntax, I'm not actually testing this :P) DELETE FROM tmp_table2 WHERE EXISTS=20 (SELECT * FROM tmp_table2 t2 WHERE t2.id=3Dtmp_table2.id AND t2.name=3D'obsid' AND t2.value=3D'oid080505') I assume you do have an index on tmp_table2.id :-) And that it's non-unique? (If it was unique, the previous simplification of the query really should've worked..) Do you also have an index on "name,value" or something like that, so you get an index scan from it? //Magnus From pgsql-performance-owner@postgresql.org Fri Nov 18 16:43:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BAE07DA2EF for ; Tue, 15 Nov 2005 06:06:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10049-08 for ; Tue, 15 Nov 2005 10:06:38 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id EDDC4D6D8C for ; Tue, 15 Nov 2005 06:06:33 -0400 (AST) Received: from hotmail.com (bay103-f11.bay103.hotmail.com [65.54.174.21]) by svr2.postgresql.org (Postfix) with ESMTP id 15931F10B2 for ; Tue, 15 Nov 2005 10:06:35 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 15 Nov 2005 02:06:33 -0800 Message-ID: Received: from 65.54.174.200 by by103fd.bay103.hotmail.msn.com with HTTP; Tue, 15 Nov 2005 10:06:33 GMT X-Originating-IP: [64.60.124.12] X-Originating-Email: [v_saks@hotmail.com] X-Sender: v_saks@hotmail.com From: "Virag Saksena" To: pgsql-performance@postgresql.org Subject: ERROR: no value found for parameter 1 with JDBC and Explain Analyze Date: Tue, 15 Nov 2005 10:06:33 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 15 Nov 2005 10:06:33.0362 (UTC) FILETIME=[41A15720:01C5E9CC] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200511/383 X-Sequence-Number: 15640 Hi, I am trying to use Explain Analyze to trace a slow SQL statement called from JDBC. The SQL statement with the parameters taked 11 seconds. When I run a explain analyze from psql, it takes < 50 ms with a reasonable explain plan. However when I try to run an explain analyze from JDBC with the parameters, I get error : ERROR: no value found for parameter 1 Here is sample code which causes this exception ... pst=prodconn.prepareStatement("explain analyze select count(*) from jam_heaprel r where heap_id = ? and parentaddr = ?"); pst.setInt(1,1); pst.setInt(2,0); rs=pst.executeQuery(); java.sql.SQLException: ERROR: no value found for parameter 1 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1471) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1256) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240) at jsp._testexplain_2ejsp._jspService(_testexplain_2ejsp.java:82) at org.gjt.jsp.HttpJspPageImpl.service(HttpJspPageImpl.java:75) Regards, Virag From pgsql-performance-owner@postgresql.org Tue Nov 15 08:10:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C28BCDB811 for ; Tue, 15 Nov 2005 08:10:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23088-02 for ; Tue, 15 Nov 2005 12:10:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id 6047CDB82F for ; Tue, 15 Nov 2005 08:10:44 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Tue, 15 Nov 2005 07:10:37 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 07:10:19 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Tue, 15 Nov 2005 07:09:56 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpwCbNgx8G/OwDQbe+GZ855Fd0GQAHJV/A From: "Luke Lonergan" To: "Adam Weisberg" cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 15 Nov 2005 12:10:19.0047 (UTC) FILETIME=[8BAEF370:01C5E9DD] X-WSS-ID: 6F670FB72BW8755554-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/241 X-Sequence-Number: 15498 Adam, > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Claus Guttesen > Sent: Tuesday, November 15, 2005 12:29 AM > To: Adam Weisberg > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Hardware/OS recommendations for large=20 > databases ( 5TB) >=20 > > Does anyone have recommendations for hardware and/or OS to=20 > work with=20 > > around 5TB datasets? >=20 > Hardware-wise I'd say dual core opterons. One=20 > dual-core-opteron performs better than two single-core at the=20 > same speed. Tyan makes some boards that have four sockets,=20 > thereby giving you 8 cpu's (if you need that many). Sun and=20 > HP also makes nice hardware although the Tyan board is more=20 > competetive priced. >=20 > OS wise I would choose the FreeBSD amd64 port but=20 > partititions larger than 2 TB needs some special care, using=20 > gpt rather than disklabel etc., tools like fsck may not be=20 > able to completely check partitions larger than 2 TB. Linux=20 > or Solaris with either LVM or Veritas FS sounds like candidates. I agree - you can get a very good one from www.acmemicro.com or www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read performance on these (with tuning) on Linux using the xfs filesystem, which is one of the most critical factors for large databases. =20 Note that you want to have your DBMS use all of the CPU and disk channel bandwidth you have on each query, which takes a parallel database like Bizgres MPP to achieve. Regards, - Luke From pgsql-performance-owner@postgresql.org Tue Nov 15 10:09:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2C35EDB847 for ; Tue, 15 Nov 2005 10:09:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33686-06 for ; Tue, 15 Nov 2005 14:09:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (c-24-11-237-16.hsd1.mi.comcast.net [24.11.237.16]) by svr1.postgresql.org (Postfix) with ESMTP id 7F332DB7EB for ; Tue, 15 Nov 2005 10:09:17 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Hardware/OS recommendations for large databases (5TB) Date: Tue, 15 Nov 2005 09:09:21 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD892@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases (5TB) Thread-Index: AcXpvzV5hVFHPWZkSgW5F5EVOZa9hQALkdOw From: "Merlin Moncure" To: "Claus Guttesen" Cc: , "Adam Weisberg" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.988 required=5 tests=[RCVD_IN_SORBS_DUL=1.988] X-Spam-Score: 1.988 X-Spam-Level: * X-Archive-Number: 200511/242 X-Sequence-Number: 15499 > Hardware-wise I'd say dual core opterons. One dual-core-opteron > performs better than two single-core at the same speed. Tyan makes > some boards that have four sockets, thereby giving you 8 cpu's (if you > need that many). Sun and HP also makes nice hardware although the Tyan > board is more competetive priced. just FYI: tyan makes a 8 socket motherboard (up to 16 cores!): http://www.swt.com/vx50.html It can be loaded with up to 128 gb memory if all the sockets are filled :). Merlin From pgsql-performance-owner@postgresql.org Tue Nov 15 10:18:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5E995DB807 for ; Tue, 15 Nov 2005 10:18:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36252-04 for ; Tue, 15 Nov 2005 14:18:26 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 74324DB7EB for ; Tue, 15 Nov 2005 10:18:20 -0400 (AST) Received: (qmail 12139 invoked from network); 15 Nov 2005 14:18:24 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 15 Nov 2005 14:18:24 -0000 In-Reply-To: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/alternative; boundary=Apple-Mail-26--861917900 Message-Id: Cc: "Adam Weisberg" , pgsql-performance@postgresql.org From: Dave Cramer Subject: Re: Hardware/OS recommendations for large databases ( Date: Tue, 15 Nov 2005 09:15:04 -0500 To: Luke Lonergan X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/244 X-Sequence-Number: 15501 --Apple-Mail-26--861917900 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Luke, Have you tried the areca cards, they are slightly faster yet. Dave On 15-Nov-05, at 7:09 AM, Luke Lonergan wrote: > > I agree - you can get a very good one from www.acmemicro.com or > www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX > SATA > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read > performance on these (with tuning) on Linux using the xfs filesystem, > which is one of the most critical factors for large databases. > > Note that you want to have your DBMS use all of the CPU and disk > channel > bandwidth you have on each query, which takes a parallel database like > Bizgres MPP to achieve. > > Regards, --Apple-Mail-26--861917900 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Luke,

Have you tried the areca = cards, they are slightly faster yet.

Dave
On = 15-Nov-05, at 7:09 AM, Luke Lonergan wrote:


I agree - you can get a very good one from www.acmemicro.com or

www.rackable.com with 8x 400GB SATA = disks and the new 3Ware 9550SX SATA

RAID controller for about $6K with two Opteron 272 = CPUs and 8GB of RAM

on a Tyan 2882 motherboard.=A0 We get about 400MB/s = sustained disk read

performance on these (with tuning) on Linux using the xfs = filesystem,

which is one of the most critical factors for large = databases. =A0

=


Note that you want to have your DBMS use all of the CPU and = disk channel

bandwidth you have on each query, which takes a parallel = database like

Bizgres MPP to achieve.


=

Regards,

=

= --Apple-Mail-26--861917900-- From pgsql-performance-owner@postgresql.org Tue Nov 15 10:18:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 86BD0DB73B for ; Tue, 15 Nov 2005 10:18:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36540-02 for ; Tue, 15 Nov 2005 14:18:20 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 1FACBDACDE for ; Tue, 15 Nov 2005 10:18:14 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21646979; Tue, 15 Nov 2005 07:18:13 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAFEICVY022915; Tue, 15 Nov 2005 07:18:12 -0700 Message-ID: <4379EE24.8000504@noao.edu> Date: Tue, 15 Nov 2005 07:18:12 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Magnus Hagander CC: Postgres-performance Subject: Re: Help speeding up delete References: <6BCB9D8A16AC4241919521715F4D8BCE6C7BC4@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE6C7BC4@algol.sollentuna.se> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/243 X-Sequence-Number: 15500 Magnus Hagander wrote: >>Because I think we need to. The above would only delete rows >>that have name = 'obsid' and value = 'oid080505'. We need to >>delete all rows that have the same ids as those rows. >>However, from what you note, I bet we could do: >> >> DELETE FROM "tmp_table2" WHERE id IN >> (SELECT id FROM "temp_table2" WHERE name = 'obsid' and >>value= 'oid080505'); >> >>However, even that seems to have a much higher cost than I'd expect: >> >> lab.devel.configdb=# explain delete from "tmp_table2" where id in >> (select id from tmp_table2 where name='obsid' and >>value = 'oid080505'); >> NOTICE: QUERY PLAN: >> >> Seq Scan on tmp_table2 (cost=0.00..65705177237.26 >>rows=769844 width=6) >> SubPlan >> -> Materialize (cost=42674.32..42674.32 rows=38 width=50) >> -> Seq Scan on tmp_table2 (cost=0.00..42674.32 >>rows=38 width=50) >> >> EXPLAIN ... > > Earlier pg versions have always been bad at dealing with IN subqueries. > Try rewriting it as (with fixing any broken syntax, I'm not actually > testing this :P) > > DELETE FROM tmp_table2 WHERE EXISTS > (SELECT * FROM tmp_table2 t2 WHERE t2.id=tmp_table2.id AND > t2.name='obsid' AND t2.value='oid080505') Thanks - that looks *significantly* better: lab.devel.configdb=# explain delete from tmp_table2 where exists (select 1 from tmp_table2 t2 where t2.id=tmp_table2.id and t2.name='obsid' and t2.value='oid080505'); NOTICE: QUERY PLAN: Seq Scan on tmp_table2 (cost=0.00..9297614.80 rows=769844 width=6) SubPlan -> Index Scan using inv_index_2 on tmp_table2 t2 (cost=0.00..6.02 rows=1 width=0) EXPLAIN (This is after putting an index on the (id,name,value) tuple.) That outer seq scan is still annoying, but maybe this will be fast enough. I've passed this on, along with the (strong) recommendation that they upgrade PG. Thanks!! -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Tue Nov 15 10:34:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA28CD6D8C for ; Tue, 15 Nov 2005 10:34:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37600-03 for ; Tue, 15 Nov 2005 14:34:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id C9F7BDB82E for ; Tue, 15 Nov 2005 10:34:11 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Tue, 15 Nov 2005 09:34:00 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 09:33:48 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Tue, 15 Nov 2005 09:33:25 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01995FD4@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXp8MdsVv42c8bqS3ONBiM5ZKGehwAADrlg From: "Luke Lonergan" To: "Dave Cramer" cc: "Adam Weisberg" , pgsql-performance@postgresql.org X-OriginalArrivalTime: 15 Nov 2005 14:33:48.0648 (UTC) FILETIME=[9767CE80:01C5E9F1] X-WSS-ID: 6F672E5C31S11414546-23-01 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5E9F1.9708CA4B" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=-0.001, HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/245 X-Sequence-Number: 15502 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5E9F1.9708CA4B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Dave, ________________________________ From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Dave Cramer Sent: Tuesday, November 15, 2005 6:15 AM To: Luke Lonergan Cc: Adam Weisberg; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Hardware/OS recommendations for large databases ( =09 =09 Luke,=20 =09 =09 Have you tried the areca cards, they are slightly faster yet.=20 No, I've been curious since I read an earlier posting here. I've had a lot more experience with the 3Ware cards, mostly good, and they've been doing a lot of volume with Rackable/Yahoo which gives me some more confidence. =20 The new 3Ware 9550SX cards use a PowerPC for checksumming, so their write performance is now up to par with the best cards I believe. We find that you still need to set Linux readahead to at least 8MB (blockdev --setra) to get maximum read performance on them, is that your experience with the Arecas? We get about 260MB/s read on 8 drives in RAID5 without the readahead tuning and about 400MB/s with it. =20 - Luke ------_=_NextPart_001_01C5E9F1.9708CA4B Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable
Dave,


From: = pgsql-performance-owner@postgresql.org=20 [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of = Dave=20 Cramer
Sent: Tuesday, November 15, 2005 6:15 = AM
To: Luke=20 Lonergan
Cc: Adam Weisberg;=20 pgsql-performance@postgresql.org
Subject: Re: [PERFORM] = Hardware/OS=20 recommendations for large databases (

Luke,
Have you tried the areca cards, they are slightly faster = yet. 
No, I've been curious since I read an earlier posting = here.  I've=20 had a lot more experience with the 3Ware cards, mostly good, and they've = been=20 doing a lot of volume with Rackable/Yahoo which gives=20 me some more confidence.
 
The new 3Ware 9550SX cards use a PowerPC for checksumming, so = their write=20 performance is now up to par with the best cards I believe.  We = find that=20 you still need to set Linux readahead to at least 8MB (blockdev --setra) = to get=20 maximum read performance on them, is that your experience with the = Arecas? =20 We get about 260MB/s read on 8 drives in RAID5 without the readahead = tuning and=20 about 400MB/s with it.
 
- Luke
------_=_NextPart_001_01C5E9F1.9708CA4B-- From pgsql-performance-owner@postgresql.org Tue Nov 15 10:37:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18312DB807 for ; Tue, 15 Nov 2005 10:37:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38296-04 for ; Tue, 15 Nov 2005 14:37:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id ED20CDB802 for ; Tue, 15 Nov 2005 10:37:41 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Tue, 15 Nov 2005 09:37:33 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 09:36:44 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Tue, 15 Nov 2005 09:36:21 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01995FDD@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpvzV5hVFHPWZkSgW5F5EVOZa9hQALkdOwAAEU6wA= From: "Luke Lonergan" To: "Merlin Moncure" , "Claus Guttesen" cc: pgsql-performance@postgresql.org, "Adam Weisberg" X-OriginalArrivalTime: 15 Nov 2005 14:36:44.0382 (UTC) FILETIME=[0026AFE0:01C5E9F2] X-WSS-ID: 6F672D272BW8850313-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/246 X-Sequence-Number: 15503 Merlin,=20 > just FYI: tyan makes a 8 socket motherboard (up to 16 cores!): > http://www.swt.com/vx50.html >=20 > It can be loaded with up to 128 gb memory if all the sockets=20 > are filled :). Cool! Just remember that you can't get more than 1 CPU working on a query at a time without a parallel database. - Luke From pgsql-performance-owner@postgresql.org Tue Nov 15 10:50:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 28ECBDB7EB for ; Tue, 15 Nov 2005 10:50:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38135-08 for ; Tue, 15 Nov 2005 14:50:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 6BD90DB7B3 for ; Tue, 15 Nov 2005 10:50:30 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 15 Nov 2005 09:50:26 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 09:49:48 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Tue, 15 Nov 2005 09:49:26 -0500 Message-ID: <3E37B936B592014B978C4415F90D662D01995FF5@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpvzV5hVFHPWZkSgW5F5EVOZa9hQALkdOwAAEU6wAAACrUAA== From: "Luke Lonergan" To: "Merlin Moncure" , "Claus Guttesen" cc: pgsql-performance@postgresql.org, "Adam Weisberg" X-OriginalArrivalTime: 15 Nov 2005 14:49:48.0871 (UTC) FILETIME=[D3BE3570:01C5E9F3] X-WSS-ID: 6F672A3B2RS6765630-06-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/247 X-Sequence-Number: 15504 Merlin, > > just FYI: tyan makes a 8 socket motherboard (up to 16 cores!): > > http://www.swt.com/vx50.html > >=20 > > It can be loaded with up to 128 gb memory if all the sockets are=20 > > filled :). Another thought - I priced out a maxed out machine with 16 cores and 128GB of RAM and 1.5TB of usable disk - $71,000. You could instead buy 8 machines that total 16 cores, 128GB RAM and 28TB of disk for $48,000, and it would be 16 times faster in scan rate, which is the most important factor for large databases. The size would be 16 rack units instead of 5, and you'd have to add a GigE switch for $1500. Scan rate for above SMP: 200MB/s Scan rate for above cluster: 3,200Mb/s You could even go dual core and double the memory on the cluster and you'd about match the price of the "god box". - Luke From pgsql-performance-owner@postgresql.org Tue Nov 15 10:55:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 26280DB7B3 for ; Tue, 15 Nov 2005 10:55:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38857-10 for ; Tue, 15 Nov 2005 14:55:48 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by svr1.postgresql.org (Postfix) with ESMTP id BE4E1DB6AA for ; Tue, 15 Nov 2005 10:55:42 -0400 (AST) Received: from osgiliath.mathom.us ([70.108.64.202]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQ000CK444YHVND@vms040.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 15 Nov 2005 08:55:46 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id D038C607898; Tue, 15 Nov 2005 09:55:45 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04523-02-5; Tue, 15 Nov 2005 09:55:45 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id B20576063FF; Tue, 15 Nov 2005 09:55:45 -0500 (EST) Date: Tue, 15 Nov 2005 09:55:45 -0500 From: Michael Stone Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <3E37B936B592014B978C4415F90D662D01995FD4@MI8NYCMAIL06.Mi8.com> To: Luke Lonergan Cc: pgsql-performance@postgresql.org Mail-followup-to: Luke Lonergan , pgsql-performance@postgresql.org Message-id: <20051115145545.GQ9905@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <3E37B936B592014B978C4415F90D662D01995FD4@MI8NYCMAIL06.Mi8.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/248 X-Sequence-Number: 15505 On Tue, Nov 15, 2005 at 09:33:25AM -0500, Luke Lonergan wrote: >write performance is now up to par with the best cards I believe. We >find that you still need to set Linux readahead to at least 8MB >(blockdev --setra) to get maximum read performance on them, is that your What on earth does that do to your seek performance? Mike Stone From pgsql-performance-owner@postgresql.org Tue Nov 15 11:20:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E18BDB83A for ; Tue, 15 Nov 2005 11:20:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43545-01 for ; Tue, 15 Nov 2005 15:20:08 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (c-24-11-237-16.hsd1.mi.comcast.net [24.11.237.16]) by svr1.postgresql.org (Postfix) with ESMTP id 2CD18DB817 for ; Tue, 15 Nov 2005 11:20:01 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Hardware/OS recommendations for large databases ( 5TB) Date: Tue, 15 Nov 2005 10:20:05 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD898@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpvzV5hVFHPWZkSgW5F5EVOZa9hQALkdOwAAEU6wAAACrUAAABI4TA From: "Merlin Moncure" To: "Luke Lonergan" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.657 required=5 tests=[AWL=-0.331, RCVD_IN_SORBS_DUL=1.988] X-Spam-Score: 1.657 X-Spam-Level: * X-Archive-Number: 200511/249 X-Sequence-Number: 15506 > Merlin, >=20 > > > just FYI: tyan makes a 8 socket motherboard (up to 16 cores!): > > > http://www.swt.com/vx50.html > > > > > > It can be loaded with up to 128 gb memory if all the sockets are > > > filled :). >=20 > Another thought - I priced out a maxed out machine with 16 cores and > 128GB of RAM and 1.5TB of usable disk - $71,000. >=20 > You could instead buy 8 machines that total 16 cores, 128GB RAM and 28TB > of disk for $48,000, and it would be 16 times faster in scan rate, which > is the most important factor for large databases. The size would be 16 > rack units instead of 5, and you'd have to add a GigE switch for $1500. =20 It's hard to say what would be better. My gut says the 5u box would be a lot better at handling high cpu/high concurrency problems...like your typical business erp backend. This is pure speculation of course...I'll defer to the experts here. Merlin From pgsql-performance-owner@postgresql.org Tue Nov 15 11:40:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ADF35DB7C2 for ; Tue, 15 Nov 2005 11:40:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44429-06 for ; Tue, 15 Nov 2005 15:40:47 +0000 (GMT) X-Greylist: delayed 15:54:07.940321 by SQLgrey- Received: from seiumain.SEIU.local (unknown [204.107.254.246]) by svr1.postgresql.org (Postfix) with ESMTP id E8744DB7B3 for ; Tue, 15 Nov 2005 11:40:40 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Hardware/OS recommendations for large databases ( 5TB) X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Tue, 15 Nov 2005 10:40:53 -0500 Message-ID: <1B80C974ABFB23429A403B6667FE84C71066E9@seiumain.SEIU.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpwCbNgx8G/OwDQbe+GZ855Fd0GQAHJV/AAAcvS2A= From: "Adam Weisberg" To: "Luke Lonergan" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/250 X-Sequence-Number: 15507 Luke, -----Original Message----- From: Luke Lonergan [mailto:LLonergan@greenplum.com]=20 Sent: Tuesday, November 15, 2005 7:10 AM To: Adam Weisberg Cc: pgsql-performance@postgresql.org Subject: RE: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Adam, > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Claus=20 > Guttesen > Sent: Tuesday, November 15, 2005 12:29 AM > To: Adam Weisberg > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Hardware/OS recommendations for large databases > ( 5TB) >=20 > > Does anyone have recommendations for hardware and/or OS to > work with > > around 5TB datasets? >=20 > Hardware-wise I'd say dual core opterons. One dual-core-opteron=20 > performs better than two single-core at the same speed. Tyan makes=20 > some boards that have four sockets, thereby giving you 8 cpu's (if you > need that many). Sun and HP also makes nice hardware although the Tyan > board is more competetive priced. >=20 > OS wise I would choose the FreeBSD amd64 port but partititions larger=20 > than 2 TB needs some special care, using gpt rather than disklabel=20 > etc., tools like fsck may not be able to completely check partitions=20 > larger than 2 TB. Linux or Solaris with either LVM or Veritas FS=20 > sounds like candidates. I agree - you can get a very good one from www.acmemicro.com or www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read performance on these (with tuning) on Linux using the xfs filesystem, which is one of the most critical factors for large databases. =20 Note that you want to have your DBMS use all of the CPU and disk channel bandwidth you have on each query, which takes a parallel database like Bizgres MPP to achieve. Regards, - Luke The What's New FAQ for PostgreSQL 8.1 says "the buffer manager for 8.1 has been enhanced to scale almost linearly with the number of processors, leading to significant performance gains on 8-way, 16-way, dual-core, and multi-core CPU servers." Why not just use it as-is? Cheers, Adam From pgsql-performance-owner@postgresql.org Tue Nov 15 11:51:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A01BBDAAAA for ; Tue, 15 Nov 2005 11:51:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45563-07 for ; Tue, 15 Nov 2005 15:51:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id AE415DA361 for ; Tue, 15 Nov 2005 11:51:02 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Tue, 15 Nov 2005 10:51:02 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 10:50:51 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Tue, 15 Nov 2005 10:50:49 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE11DD7@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpwCbNgx8G/OwDQbe+GZ855Fd0GQAHJV/AAAcvS2AAALfzHg== From: "Luke Lonergan" To: Aweisberg@seiu1199.org cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 15 Nov 2005 15:50:51.0215 (UTC) FILETIME=[5AAB8DF0:01C5E9FC] X-WSS-ID: 6F64DC6E31S11480215-12-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/251 X-Sequence-Number: 15508 QmVjYXVzZSBvbmx5IDEgY3B1IGlzIHVzZWQgb24gZWFjaCBxdWVyeS4NCi0gTHVrZQ0KLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0NClNlbnQgZnJvbSBteSBCbGFja0JlcnJ5IFdpcmVsZXNzIERl dmljZQ0KDQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBBZGFtIFdlaXNiZXJn IDxBd2Vpc2JlcmdAc2VpdTExOTkub3JnPg0KVG86IEx1a2UgTG9uZXJnYW4gPExMb25lcmdhbkBn cmVlbnBsdW0uY29tPg0KQ0M6IHBnc3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnIDxwZ3Nx bC1wZXJmb3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZz4NClNlbnQ6IFR1ZSBOb3YgMTUgMTA6NDA6NTMg MjAwNQ0KU3ViamVjdDogUkU6IFtQRVJGT1JNXSBIYXJkd2FyZS9PUyByZWNvbW1lbmRhdGlvbnMg Zm9yIGxhcmdlIGRhdGFiYXNlcyAoIDVUQikNCg0KTHVrZSwNCg0KLS0tLS1PcmlnaW5hbCBNZXNz YWdlLS0tLS0NCkZyb206IEx1a2UgTG9uZXJnYW4gW21haWx0bzpMTG9uZXJnYW5AZ3JlZW5wbHVt LmNvbV0gDQpTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNSwgMjAwNSA3OjEwIEFNDQpUbzogQWRh bSBXZWlzYmVyZw0KQ2M6IHBnc3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnDQpTdWJqZWN0 OiBSRTogW1BFUkZPUk1dIEhhcmR3YXJlL09TIHJlY29tbWVuZGF0aW9ucyBmb3IgbGFyZ2UgZGF0 YWJhc2VzICgNCjVUQikNCg0KQWRhbSwNCg0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0K PiBGcm9tOiBwZ3NxbC1wZXJmb3JtYW5jZS1vd25lckBwb3N0Z3Jlc3FsLm9yZw0KPiBbbWFpbHRv OnBnc3FsLXBlcmZvcm1hbmNlLW93bmVyQHBvc3RncmVzcWwub3JnXSBPbiBCZWhhbGYgT2YgQ2xh dXMgDQo+IEd1dHRlc2VuDQo+IFNlbnQ6IFR1ZXNkYXksIE5vdmVtYmVyIDE1LCAyMDA1IDEyOjI5 IEFNDQo+IFRvOiBBZGFtIFdlaXNiZXJnDQo+IENjOiBwZ3NxbC1wZXJmb3JtYW5jZUBwb3N0Z3Jl c3FsLm9yZw0KPiBTdWJqZWN0OiBSZTogW1BFUkZPUk1dIEhhcmR3YXJlL09TIHJlY29tbWVuZGF0 aW9ucyBmb3IgbGFyZ2UgZGF0YWJhc2VzDQoNCj4gKCA1VEIpDQo+IA0KPiA+IERvZXMgYW55b25l IGhhdmUgcmVjb21tZW5kYXRpb25zIGZvciBoYXJkd2FyZSBhbmQvb3IgT1MgdG8NCj4gd29yayB3 aXRoDQo+ID4gYXJvdW5kIDVUQiBkYXRhc2V0cz8NCj4gDQo+IEhhcmR3YXJlLXdpc2UgSSdkIHNh eSBkdWFsIGNvcmUgb3B0ZXJvbnMuIE9uZSBkdWFsLWNvcmUtb3B0ZXJvbiANCj4gcGVyZm9ybXMg YmV0dGVyIHRoYW4gdHdvIHNpbmdsZS1jb3JlIGF0IHRoZSBzYW1lIHNwZWVkLiBUeWFuIG1ha2Vz IA0KPiBzb21lIGJvYXJkcyB0aGF0IGhhdmUgZm91ciBzb2NrZXRzLCB0aGVyZWJ5IGdpdmluZyB5 b3UgOCBjcHUncyAoaWYgeW91DQoNCj4gbmVlZCB0aGF0IG1hbnkpLiBTdW4gYW5kIEhQIGFsc28g bWFrZXMgbmljZSBoYXJkd2FyZSBhbHRob3VnaCB0aGUgVHlhbg0KDQo+IGJvYXJkIGlzIG1vcmUg Y29tcGV0ZXRpdmUgcHJpY2VkLg0KPiANCj4gT1Mgd2lzZSBJIHdvdWxkIGNob29zZSB0aGUgRnJl ZUJTRCBhbWQ2NCBwb3J0IGJ1dCBwYXJ0aXRpdGlvbnMgbGFyZ2VyIA0KPiB0aGFuIDIgVEIgbmVl ZHMgc29tZSBzcGVjaWFsIGNhcmUsIHVzaW5nIGdwdCByYXRoZXIgdGhhbiBkaXNrbGFiZWwgDQo+ IGV0Yy4sIHRvb2xzIGxpa2UgZnNjayBtYXkgbm90IGJlIGFibGUgdG8gY29tcGxldGVseSBjaGVj ayBwYXJ0aXRpb25zIA0KPiBsYXJnZXIgdGhhbiAyIFRCLiBMaW51eCBvciBTb2xhcmlzIHdpdGgg ZWl0aGVyIExWTSBvciBWZXJpdGFzIEZTIA0KPiBzb3VuZHMgbGlrZSBjYW5kaWRhdGVzLg0KDQpJ IGFncmVlIC0geW91IGNhbiBnZXQgYSB2ZXJ5IGdvb2Qgb25lIGZyb20gd3d3LmFjbWVtaWNyby5j b20gb3INCnd3dy5yYWNrYWJsZS5jb20gd2l0aCA4eCA0MDBHQiBTQVRBIGRpc2tzIGFuZCB0aGUg bmV3IDNXYXJlIDk1NTBTWCBTQVRBDQpSQUlEIGNvbnRyb2xsZXIgZm9yIGFib3V0ICQ2SyB3aXRo IHR3byBPcHRlcm9uIDI3MiBDUFVzIGFuZCA4R0Igb2YgUkFNDQpvbiBhIFR5YW4gMjg4MiBtb3Ro ZXJib2FyZC4gIFdlIGdldCBhYm91dCA0MDBNQi9zIHN1c3RhaW5lZCBkaXNrIHJlYWQNCnBlcmZv cm1hbmNlIG9uIHRoZXNlICh3aXRoIHR1bmluZykgb24gTGludXggdXNpbmcgdGhlIHhmcyBmaWxl c3lzdGVtLA0Kd2hpY2ggaXMgb25lIG9mIHRoZSBtb3N0IGNyaXRpY2FsIGZhY3RvcnMgZm9yIGxh cmdlIGRhdGFiYXNlcy4gIA0KDQpOb3RlIHRoYXQgeW91IHdhbnQgdG8gaGF2ZSB5b3VyIERCTVMg dXNlIGFsbCBvZiB0aGUgQ1BVIGFuZCBkaXNrIGNoYW5uZWwNCmJhbmR3aWR0aCB5b3UgaGF2ZSBv biBlYWNoIHF1ZXJ5LCB3aGljaCB0YWtlcyBhIHBhcmFsbGVsIGRhdGFiYXNlIGxpa2UNCkJpemdy ZXMgTVBQIHRvIGFjaGlldmUuDQoNClJlZ2FyZHMsDQoNCi0gTHVrZQ0KDQoNClRoZSBXaGF0J3Mg TmV3IEZBUSBmb3IgUG9zdGdyZVNRTCA4LjEgc2F5cyAidGhlIGJ1ZmZlciBtYW5hZ2VyIGZvciA4 LjENCmhhcyBiZWVuIGVuaGFuY2VkIHRvIHNjYWxlIGFsbW9zdCBsaW5lYXJseSB3aXRoIHRoZSBu dW1iZXIgb2YNCnByb2Nlc3NvcnMsIGxlYWRpbmcgdG8gc2lnbmlmaWNhbnQgcGVyZm9ybWFuY2Ug Z2FpbnMgb24gOC13YXksIDE2LXdheSwNCmR1YWwtY29yZSwgYW5kIG11bHRpLWNvcmUgQ1BVIHNl cnZlcnMuIg0KDQpXaHkgbm90IGp1c3QgdXNlIGl0IGFzLWlzPw0KDQpDaGVlcnMsDQoNCkFkYW0N Cg0K From pgsql-performance-owner@postgresql.org Tue Nov 15 12:35:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DEAA0DB82F for ; Tue, 15 Nov 2005 12:35:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50572-04 for ; Tue, 15 Nov 2005 16:35:48 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 276FBDB831 for ; Tue, 15 Nov 2005 12:35:44 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 15 Nov 2005 17:35:42 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Dave Cramer Cc: Pgsql-Performance In-Reply-To: References: <1131283854.15471.4.camel@Panoramix> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 15 Nov 2005 17:35:42 +0100 Message-Id: <1132072542.3250.16.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/252 X-Sequence-Number: 15509 Hi Dave, On Mon, 2005-11-14 at 18:51 -0500, Dave Cramer wrote: > Joost, > > I've got experience with these controllers and which version do you > have. I'd expect to see higher than 50MB/s although I've never tried > RAID 5 > > I routinely see closer to 100MB/s with RAID 1+0 on their 9000 series OK, than there must be hope. > I would also suggest that shared buffers should be higher than 7500, > closer to 30000, and effective cache should be up around 200k In my current 8.1 situation I use shared_buffers = 40000, effective_cache_size = 131072 . > work_mem is awfully high, remember that this will be given to each > and every connection and can be more than 1x this number per > connection depending on the number of sorts > done in the query. I use such a high number because I am the only user querying and my queries do sorted joins etc. > fsync=false ? I'm not even sure why we have this option, but I'd > never set it to false. I want as much speed as possible for a database conversion that MUST be handled in 1 weekend (it lasts now, with the current speed almost 7 centuries. I may be off a millenium). If it fails because of hardware problem (the only reason we want and need fsync?) we will try next weekend until it finally goes right. What I can see is that only the *write* performance of *long updates* (and not inserts) are slow and they get slower in time: the first few thousand go relatively fast, after that PostgreSQL crawls to a halt (other "benchmarks" like bonnie++ or just dd'ing a big file don't have this behavior). I did notice that changing the I/O scheduler's nr_request from the default 128 to 1024 or even 4096 made a remarkable performance improvement. I suspect that experimenting with other I/O schedululers could improve performance. But it is hard to find any useful documentation about I/O schedulers. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Nov 15 14:42:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE2BBDB831 for ; Tue, 15 Nov 2005 14:42:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74148-02 for ; Tue, 15 Nov 2005 18:42:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id B8556DB86B for ; Tue, 15 Nov 2005 14:42:53 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Tue, 15 Nov 2005 13:42:46 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 13:42:23 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Tue, 15 Nov 2005 13:42:22 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 15 Nov 2005 10:42:22 -0800 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: "Luke Lonergan" To: "Joost Kraaijeveld" , "Dave Cramer" cc: "Pgsql-Performance" Message-ID: Thread-Topic: [PERFORM] Performance PG 8.0 on dual opteron / 4GB / 3ware Thread-Index: AcXqBJN/YAdpHf0pTdG90SDRQNurAQAD7z3D In-Reply-To: <1132072542.3250.16.camel@Panoramix> MIME-Version: 1.0 X-OriginalArrivalTime: 15 Nov 2005 18:42:23.0641 (UTC) FILETIME=[516F2090:01C5EA14] X-WSS-ID: 6F64F3AF31S11621008-09-01 Content-Type: multipart/alternative; boundary=B_3214896142_20825174 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/253 X-Sequence-Number: 15510 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214896142_20825174 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joost, On 11/15/05 8:35 AM, "Joost Kraaijeveld" wrote: > thousand go relatively fast, after that PostgreSQL crawls to a halt > (other "benchmarks" like bonnie++ or just dd'ing a big file don't have > this behavior). With RAID5, it could matter a lot what block size you run your =B3dd bigfile=B2 test with. You should run =B3dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D500000=B2 for a 2GB main memory machine, multiply the count by (/2GB). It is very important with the 3Ware cards to match the driver to the firmware revision. =20 > I did notice that changing the I/O scheduler's nr_request from the > default 128 to 1024 or even 4096 made a remarkable performance > improvement. I suspect that experimenting with other I/O schedululers > could improve performance. But it is hard to find any useful > documentation about I/O schedulers. >=20 You could try deadline, there=B9s no harm, but I=B9ve found that when you reach the point of experimenting with schedulers, you are probably not addressing the real problem. >=20 On a 3Ware 9500 with HW RAID5 and 4 or more disks I think you should get 100MB/s write rate, which is double what Postgres can use. We find that Postgres, even with fsync=3Dfalse, will only run at a net COPY speed of about 8-12 MB/s, where 12 is the Bizgres number. 8.1 might do 10. But to get th= e 10 or 12, the WAL writing and other writing is about 4-5X more than the net write speed, or the speed at which the input file is parsed and read into the database. So, if you can get your =B3dd bigfile=B2 test to write data at 50MB/s+ with a blocksize of 8KB, you should be doing well enough. Incidentally, we also find that using the XFS filesystem and setting the readahead to 8MB or more is extremely beneficial for performance with the 3Ware cards (and with others, but especially for the older 3Ware cards). =20 Regards, - Luke --B_3214896142_20825174 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Re: [PERFORM] Performance PG 8.0 on dual opteron / 4GB / 3ware</TITL= E> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Joost= ,<BR> <BR> On 11/15/05 8:35 AM, "Joost Kraaijeveld" <J.Kraaijeveld@Askesi= s.nl> wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>thousand go relatively fast, after that PostgreSQL craw= ls to a halt<BR> (other "benchmarks" like bonnie++ or just dd'ing a big file don't= have<BR> this behavior).<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> With RAID5, it could matter a lot what block size you run your “dd bi= gfile” test with.  You should run “dd if=3D/dev/zero of=3Dbigfi= le bs=3D8k count=3D500000” for a 2GB main memory machine, multiply the cou= nt by (<your mem>/2GB).<BR> <BR> It is very important with the 3Ware cards to match the driver to the firmwa= re revision.<BR>    <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>I did notice that changing the I/O scheduler's nr_reque= st from the<BR> default 128 to 1024 or even 4096 made a remarkable performance<BR> improvement. I suspect that experimenting with other I/O schedululers<BR> could improve performance. But it is hard to find any useful<BR> documentation about I/O schedulers.<BR> <BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'>You could try deadline, there’s no harm, but I&#= 8217;ve found that when you reach the point of experimenting with schedulers= , you are probably not addressing the real problem.<BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'><BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'>On a 3Ware 9500 with HW RAID5 and 4 or more disks I th= ink you should get 100MB/s write rate, which is double what Postgres can use= .  We find that Postgres, even with fsync=3Dfalse, will only run at a <B>= net</B> COPY speed of about 8-12 MB/s, where 12 is the Bizgres number.  = ;8.1 might do 10.  But to get the 10 or 12, the WAL writing and other w= riting is about 4-5X more than the <B>net</B> write speed, or the speed at w= hich the input file is parsed and read into the database.<BR> <BR> So, if you can get your “dd bigfile” test to write data at 50MB= /s+ with a blocksize of 8KB, you should be doing well enough.<BR> <BR> Incidentally, we also find that using the XFS filesystem and setting the re= adahead to 8MB or more is extremely beneficial for performance with the 3War= e cards (and with others, but especially for the older 3Ware cards).<BR>  <BR> Regards,<BR> <BR> - Luke</SPAN></FONT> </BODY> </HTML> --B_3214896142_20825174-- From pgsql-performance-owner@postgresql.org Tue Nov 15 14:46:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 89408DB847 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 14:46:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74838-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 18:46:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id D34BCDB82E for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 14:46:40 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Tue, 15 Nov 2005 13:46:28 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 13:46:13 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Tue, 15 Nov 2005 13:46:12 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 15 Nov 2005 10:46:12 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Merlin Moncure" <merlin.moncure@rcsonline.com> cc: pgsql-performance@postgresql.org Message-ID: <BF9F6CF4.13B4D%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXpvzV5hVFHPWZkSgW5F5EVOZa9hQALkdOwAAEU6wAAACrUAAABI4TAAAdz7qk= In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD898@Herge.rcsinc.local> MIME-Version: 1.0 X-OriginalArrivalTime: 15 Nov 2005 18:46:13.0183 (UTC) FILETIME=[DA4074F0:01C5EA14] X-WSS-ID: 6F64F28B21G11158571-04-01 Content-Type: multipart/alternative; boundary=B_3214896372_20825418 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/254 X-Sequence-Number: 15511 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214896372_20825418 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Merlin, On 11/15/05 7:20 AM, "Merlin Moncure" <merlin.moncure@rcsonline.com> wrote: >=20 > It's hard to say what would be better. My gut says the 5u box would be > a lot better at handling high cpu/high concurrency problems...like your > typical business erp backend. This is pure speculation of course...I'll > defer to the experts here. With Oracle RAC, which is optimized for OLTP and uses a shared memory caching model, maybe or maybe not. I=B9d put my money on the SMP in that cas= e as you suggest, but what happens when the OS dies? For data warehousing, OLAP and decision support applications, RAC and other shared memory/disk architectures don=B9t do you any good and the SMP machine is better by a bit. However, if you have an MPP database, where disk and memory are not shared, then the SMP machine is tens or hundreds of times slower than the cluster o= f the same price. - Luke=20 --B_3214896372_20825418 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases ( 5TB)= Merli= n,

On 11/15/05 7:20 AM, "Merlin Moncure" <merlin.moncure@rcsonlin= e.com> wrote:

It's hard to say what would be better.  My gut says the 5u box would b= e
a lot better at handling high cpu/high concurrency problems...like your
typical business erp backend.  This is pure speculation of course...I'= ll
defer to the experts here.

With Oracle RAC, which is optimized for OLTP and uses a shared memory cachi= ng model, maybe or maybe not.  I’d put my money on the SMP in tha= t case as you suggest, but what happens when the OS dies?

For data warehousing, OLAP and decision support applications, RAC and other= shared memory/disk architectures don’t do you any good and the SMP ma= chine is better by a bit.

However, if you have an MPP database, where disk and memory are not shared,= then the SMP machine is tens or hundreds of times slower than the cluster o= f the same price.

- Luke
--B_3214896372_20825418-- From pgsql-performance-owner@postgresql.org Tue Nov 15 14:48:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 779FDDB8BA for ; Tue, 15 Nov 2005 14:48:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74252-04 for ; Tue, 15 Nov 2005 18:48:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 12DB1DB8AE for ; Tue, 15 Nov 2005 14:48:16 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 15 Nov 2005 13:48:09 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 15 Nov 2005 13:48:00 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Tue, 15 Nov 2005 13:47:59 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 15 Nov 2005 10:47:59 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" To: "Michael Stone" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXp9Rz/g4t+KwF1QzeAxs8MLl6yOQAH/xTB In-Reply-To: <20051115145545.GQ9905@mathom.us> MIME-Version: 1.0 X-OriginalArrivalTime: 15 Nov 2005 18:48:00.0510 (UTC) FILETIME=[1A3941E0:01C5EA15] X-WSS-ID: 6F64F2ED2RS6959392-17-01 Content-Type: multipart/alternative; boundary=B_3214896479_20817725 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/255 X-Sequence-Number: 15512 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214896479_20817725 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Mike,=20 On 11/15/05 6:55 AM, "Michael Stone" wrote: > On Tue, Nov 15, 2005 at 09:33:25AM -0500, Luke Lonergan wrote: >> >write performance is now up to par with the best cards I believe. We >> >find that you still need to set Linux readahead to at least 8MB >> >(blockdev --setra) to get maximum read performance on them, is that you= r >=20 > What on earth does that do to your seek performance? We=B9re in decision support, as is our poster here, so seek isn=B9t the issue, it=B9s sustained sequential transfer rate that we need. At 8MB, I=B9d not expect too much damage though =AD the default is 1.5MB. - Luke >=20 --B_3214896479_20817725 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Mike,= <BR> <BR> On 11/15/05 6:55 AM, "Michael Stone" <mstone+postgres@mathom.u= s> wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>On Tue, Nov 15, 2005 at 09:33:25AM -0500, Luke Lonergan= wrote:<BR> >write performance is now up to par with the best cards I believe.  = ;We<BR> >find that you still need to set Linux readahead to at least 8MB<BR> >(blockdev --setra) to get maximum read performance on them, is that you= r<BR> <BR> What on earth does that do to your seek performance?<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> We’re in decision support, as is our poster here, so seek isn’t= the issue, it’s sustained sequential transfer rate that we need. &nbs= p;At 8MB, I’d not expect too much damage though – the default is= 1.5MB.<BR> <BR> - Luke<BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'><BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> </SPAN></FONT> </BODY> </HTML> --B_3214896479_20817725-- From pgsql-performance-owner@postgresql.org Tue Nov 15 15:00:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DDE15DB7F0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 14:57:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75881-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 18:57:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id EDD90D71C1 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 14:57:09 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0322F31059; Tue, 15 Nov 2005 19:57:10 +0100 (MET) From: William Yu <wyu@talisys.com> X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( 5TB) Date: Tue, 15 Nov 2005 10:57:05 -0800 Organization: Hub.Org Networking Services Lines: 15 Message-ID: <dldb20$2lau$1@news.hub.org> References: <6EE64EF3AB31D5448D0007DD34EEB3417DD898@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD898@Herge.rcsinc.local> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/256 X-Sequence-Number: 15513 Merlin Moncure wrote: >>You could instead buy 8 machines that total 16 cores, 128GB RAM and > > It's hard to say what would be better. My gut says the 5u box would be > a lot better at handling high cpu/high concurrency problems...like your > typical business erp backend. This is pure speculation of course...I'll > defer to the experts here. In this specific case (data warehouse app), multiple machines is the better bet. Load data on 1 machine, copy to other servers and then use a middleman to spread out SQL statements to each machine. I was going to suggest pgpool as the middleman but I believe it's limited to 2 machines max at this time. I suppose you could daisy chain pgpools running on every machine. From pgsql-performance-owner@postgresql.org Tue Nov 15 18:08:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 78896D7C5C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 18:08:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18909-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 22:08:30 +0000 (GMT) X-Greylist: delayed 03:00:40.837875 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 520FDD6837 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 18:08:25 -0400 (AST) Received: from jupiter.ad.haydrian.com (nat.haydrian.com [70.98.72.98]) by svr2.postgresql.org (Postfix) with ESMTP id 62F96F139B for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 19:07:43 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Hardware/OS recommendations for large databases ( 5TB) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Tue, 15 Nov 2005 11:07:40 -0800 Message-ID: <775F825B46B551499DC75DC4E92F80AB0E3623@jupiter.ad.haydrian.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) thread-index: AcXqF1J+4GMu4DJdRoSAkms/8lt9bwAADWww From: "James Mello" <james@haydrian.com> To: "William Yu" <wyu@talisys.com>, <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/262 X-Sequence-Number: 15519 Unless there was a way to guarantee consistency, it would be hard at best to make this work. Convergence on large data sets across boxes is non-trivial, and diffing databases is difficult at best. Unless there was some form of automated way to ensure consistency, going 8 ways into separate boxes is *very* hard. I do suppose that if you have fancy storage (EMC, Hitachi) you could do BCV or Shadow copies. But in terms of commodity stuff, I'd have to agree with Merlin.=20 -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of William Yu Sent: Tuesday, November 15, 2005 10:57 AM To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Merlin Moncure wrote: >>You could instead buy 8 machines that total 16 cores, 128GB RAM and > =20 > It's hard to say what would be better. My gut says the 5u box would=20 > be a lot better at handling high cpu/high concurrency problems...like=20 > your typical business erp backend. This is pure speculation of=20 > course...I'll defer to the experts here. In this specific case (data warehouse app), multiple machines is the better bet. Load data on 1 machine, copy to other servers and then use a middleman to spread out SQL statements to each machine. I was going to suggest pgpool as the middleman but I believe it's limited to 2 machines max at this time. I suppose you could daisy chain pgpools running on every machine. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Tue Nov 15 15:38:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B5B2FDB831 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 15:38:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79202-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 19:38:48 +0000 (GMT) X-Greylist: delayed 00:26:17.566921 by SQLgrey- Received: from bfccomputing.com (bfccomputing.com [217.160.248.65]) by svr1.postgresql.org (Postfix) with ESMTP id A49C9DB876 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 15:38:45 -0400 (AST) Received: from [10.0.0.202] (68-169-200-61.sbtnvt.adelphia.net [68.169.200.61]) by bfccomputing.com (Postfix) with ESMTP id 00D81E8038 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 14:12:13 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v623) Content-Transfer-Encoding: 7bit Message-Id: <e11403f0198a3591a66d8c28f0cd9b61@bfccomputing.com> Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-performance@postgresql.org From: Bill McGonigle <bill@bfccomputing.com> Subject: Too Many OR's? Date: Tue, 15 Nov 2005 14:12:23 -0500 X-Mailer: Apple Mail (2.623) X-bfccomputing-MailScanner-Information: Please contact the ISP for more information X-bfccomputing-MailScanner: Found to be clean X-bfccomputing-MailScanner-SpamCheck: X-MailScanner-From: bill@bfccomputing.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/258 X-Sequence-Number: 15515 I have a query that's making the planner do the wrong thing (for my definition of wrong) and I'm looking for advice on what to tune to make it do what I want. The query consists or SELECT'ing a few fields from a table for a large number of rows. The table has about seventy thousand rows and the user is selecting some subset of them. I first do a SELECT...WHERE to determine the unique identifiers I want (works fine) and then I do a SELECT WHERE IN giving the list of id's I need additional data on (which I see from EXPLAIN just gets translated into a very long list of OR's). Everything works perfectly until I get to 65301 rows. At 65300 rows, it does an index scan and takes 2197.193 ms. At 65301 rows it switches to a sequential scan and takes 778951.556 ms. Values known not to affect this are: work_mem, effective_cache_size. Setting random_page_cost from 4 to 1 helps (79543.214 ms) but I'm not really sure what '1' means, except it's relative. Of course, setting 'enable_seqscan false' helps immensely (2337.289 ms) but that's as inelegant of a solution as I've found - if there were other databases on this install that wouldn't be the right approach. Now I can break this down into multiple SELECT's in code, capping each query at 65300 rows, and that's a usable workaround, but academically I'd like to know how to convince the planner to do it my way. It's making a bad guess about something but I'm not sure what. I didn't see any hard-coded limits grepping through the source (though it is close to the 16-bit unsigned boundry - probably coincidental) so if anyone has ideas or pointers to how I might figure out what's going wrong that would be helpful. Thanks, -Bill ----- Bill McGonigle, Owner Work: 603.448.4440 BFC Computing, LLC Home: 603.448.1668 bill@bfccomputing.com Mobile: 603.252.2606 http://www.bfccomputing.com/ Pager: 603.442.1833 Jabber: flowerpt@gmail.com Text: bill+text@bfccomputing.com Blog: http://blog.bfccomputing.com/ From pgsql-performance-owner@postgresql.org Tue Nov 15 15:32:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ABA1CDACDE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 15:32:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79102-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 19:32:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 1CAE5D9443 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 15:31:57 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 15 Nov 2005 20:31:56 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl> To: Luke Lonergan <llonergan@greenplum.com> Cc: Dave Cramer <pg@fastcrypt.com>, Pgsql-Performance <pgsql-performance@postgresql.org> In-Reply-To: <BF9F6C0E.13B4A%llonergan@greenplum.com> References: <BF9F6C0E.13B4A%llonergan@greenplum.com> Content-Type: text/plain; charset=iso-8859-13 Content-Transfer-Encoding: quoted-printable Date: Tue, 15 Nov 2005 20:31:56 +0100 Message-Id: <1132083116.3250.38.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/257 X-Sequence-Number: 15514 Hi Luke, On Tue, 2005-11-15 at 10:42 -0800, Luke Lonergan wrote: > With RAID5, it could matter a lot what block size you run your =B4dd > bigfile=A1 test with. You should run =B4dd if=3D/dev/zero of=3Dbigfile b= s=3D8k > count=3D500000=A1 for a 2GB main memory machine, multiply the count by > (<your mem>/2GB). If I understand correctly (I have 4GB ram): jkr@Panoramix:~/tmp$ dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D1000000 1000000+0 records in 1000000+0 records out 8192000000 bytes transferred in 304.085269 seconds (26939812 bytes/sec) Which looks suspicious: 26308 MB/sec??? > It is very important with the 3Ware cards to match the driver to the > firmware revision. OK, I am running 1 driver behind the firmware. =20 > I did notice that changing the I/O scheduler's nr_request from > the > default 128 to 1024 or even 4096 made a remarkable performance > improvement. I suspect that experimenting with other I/O > schedululers > could improve performance. But it is hard to find any useful > documentation about I/O schedulers. > =20 > You could try deadline, there=FFs no harm, but I=FFve found that when you > reach the point of experimenting with schedulers, you are probably not > addressing the real problem. It depends. I/O Schedulers (I assume) have a purpose: some schedulers should be more appropriate for some circumstances. And maybe my specific circumstances (converting a database with *many updates*) is a specific circumstance. I really don't know.... > On a 3Ware 9500 with HW RAID5 and 4 or more disks I think you should > get 100MB/s write rate, which is double what Postgres can use. We > find that Postgres, even with fsync=3Dfalse, will only run at a net COPY > speed of about 8-12 MB/s, where 12 is the Bizgres number. 8.1 might > do 10. But to get the 10 or 12, the WAL writing and other writing is > about 4-5X more than the net write speed, or the speed at which the > input file is parsed and read into the database. As I have an (almost) seperate WAL disk: iostat does not show any significant writing on the WAL disk.... > So, if you can get your =B4dd bigfile=A1 test to write data at 50MB/s+ > with a blocksize of 8KB, you should be doing well enough. See above. > Incidentally, we also find that using the XFS filesystem and setting > the readahead to 8MB or more is extremely beneficial for performance > with the 3Ware cards (and with others, but especially for the older > 3Ware cards). I don't have problems with my read performance but *only* with my *update* performance (and not even insert performance). But than again I am not the only one with these problems: http://www.issociate.de/board/goto/894541/3ware_+_RAID5_ +_xfs_performance.html#msg_894541 http://lkml.org/lkml/2005/4/20/110 http://seclists.org/lists/linux-kernel/2005/Oct/1171.html I am happy to share the tables against which I am running my checks.... --=20 Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl=20 From pgsql-performance-owner@postgresql.org Tue Nov 15 15:41:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 703FADB863 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 15:41:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94531-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 19:41:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id AEEBADB81F for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 15:41:25 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21653526; Tue, 15 Nov 2005 12:41:24 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAFJfNhp000509; Tue, 15 Nov 2005 12:41:23 -0700 Message-ID: <437A39E3.6030707@noao.edu> Date: Tue, 15 Nov 2005 12:41:23 -0700 From: Steve Wampler <swampler@noao.edu> User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl> CC: Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132083116.3250.38.camel@Panoramix> In-Reply-To: <1132083116.3250.38.camel@Panoramix> Content-Type: text/plain; charset=ISO-8859-13 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/259 X-Sequence-Number: 15516 Joost Kraaijeveld wrote: > If I understand correctly (I have 4GB ram): > > jkr@Panoramix:~/tmp$ dd if=/dev/zero of=bigfile bs=8k count=1000000 > 1000000+0 records in > 1000000+0 records out > 8192000000 bytes transferred in 304.085269 seconds (26939812 bytes/sec) > > Which looks suspicious: 26308 MB/sec??? Eh? That looks more like ~25.7 MB/sec, assuming 1MB = 1024*1024 bytes. -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Tue Nov 15 15:51:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 673C3DB82F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 15:51:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96461-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 19:51:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 4920EDB7C7 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 15:51:27 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 15 Nov 2005 20:51:28 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl> To: Steve Wampler <swampler@noao.edu> Cc: Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Pgsql-Performance <pgsql-performance@postgresql.org> In-Reply-To: <437A39E3.6030707@noao.edu> References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132083116.3250.38.camel@Panoramix> <437A39E3.6030707@noao.edu> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 15 Nov 2005 20:51:27 +0100 Message-Id: <1132084287.3250.41.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/260 X-Sequence-Number: 15517 On Tue, 2005-11-15 at 12:41 -0700, Steve Wampler wrote: > Joost Kraaijeveld wrote: > > If I understand correctly (I have 4GB ram): > > > > jkr@Panoramix:~/tmp$ dd if=/dev/zero of=bigfile bs=8k count=1000000 > > 1000000+0 records in > > 1000000+0 records out > > 8192000000 bytes transferred in 304.085269 seconds (26939812 bytes/sec) > > > > Which looks suspicious: 26308 MB/sec??? > > Eh? That looks more like ~25.7 MB/sec, assuming 1MB = 1024*1024 bytes. Oooops. This calculation error is not typical for my testing (I think ;-)). -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Tue Nov 15 16:01:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18F01DACDE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 16:01:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95644-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 15 Nov 2005 20:01:50 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id D1775D9443 for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 16:01:47 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 15 Nov 2005 14:01:48 -0600 Subject: Re: Too Many OR's? From: Scott Marlowe <smarlowe@g2switchworks.com> To: Bill McGonigle <bill@bfccomputing.com> Cc: pgsql-performance@postgresql.org In-Reply-To: <e11403f0198a3591a66d8c28f0cd9b61@bfccomputing.com> References: <e11403f0198a3591a66d8c28f0cd9b61@bfccomputing.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132084908.3582.46.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 15 Nov 2005 14:01:48 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/261 X-Sequence-Number: 15518 On Tue, 2005-11-15 at 13:12, Bill McGonigle wrote: > I have a query that's making the planner do the wrong thing (for my > definition of wrong) and I'm looking for advice on what to tune to make > it do what I want. > > The query consists or SELECT'ing a few fields from a table for a large > number of rows. The table has about seventy thousand rows and the user > is selecting some subset of them. I first do a SELECT...WHERE to > determine the unique identifiers I want (works fine) and then I do a > SELECT WHERE IN giving the list of id's I need additional data on > (which I see from EXPLAIN just gets translated into a very long list of > OR's). > > Everything works perfectly until I get to 65301 rows. At 65300 rows, > it does an index scan and takes 2197.193 ms. At 65301 rows it switches > to a sequential scan and takes 778951.556 ms. Values known not to > affect this are: work_mem, effective_cache_size. Setting > random_page_cost from 4 to 1 helps (79543.214 ms) but I'm not really > sure what '1' means, except it's relative. Of course, setting > 'enable_seqscan false' helps immensely (2337.289 ms) but that's as > inelegant of a solution as I've found - if there were other databases > on this install that wouldn't be the right approach. > > Now I can break this down into multiple SELECT's in code, capping each > query at 65300 rows, and that's a usable workaround, but academically > I'd like to know how to convince the planner to do it my way. It's > making a bad guess about something but I'm not sure what. I didn't see > any hard-coded limits grepping through the source (though it is close > to the 16-bit unsigned boundry - probably coincidental) so if anyone > has ideas or pointers to how I might figure out what's going wrong that > would be helpful. OK, there IS a point at which switching to a sequential scan will be fast. I.e. when you're getting everything in the table. But the database is picking a number where to switch that is too low. First, we need to know if the statistics are giving the query planner a good enough idea of how many rows it's really gonna get versus how many it expects. Do an explain <your query here> and see how many it thinks it's gonna get. Since you've actually run it, you know how many it really is going to get, so there's no need for an explain analyze <your query here> just yet. Now, as long as the approximation is pretty close, fine. But if it's off by factors, then we need to increase the statistics target on that column, with: ALTER TABLE name ALTER columnname SET STATISTICS xxx where xxx is the new number. The default is set in your postgresql.conf file, and is usually pretty low, say 10. You can go up to 1000, but that makes query planning take longer. Try some incremental increase to say 20 or 40 or even 100, and run analyze on that table then do an explain on it again until the estimate is close. Once the estimate is close, you use change random_page_cost to get the query planner to switch at the "right" time. Change the number of in() numbers and play with random_page_cost and see where that sweet spot is. note that what seems right on a single table for a single user may not be best as you increase load or access other tables. random_page_cost represents the increase in a random access versus a sequential access. As long as your data fit into ram, the difference is pretty much none (i.e. random_page_cost=1) so don't set it too low, or accessing REALLY large data sets could become REALLY slow, as it uses indexes when it should have been sequentially scanning. Also, check what you've got effective_cache set to. This tells postgresql how much memory your kernel is using for cache, and so lets it know about how likely it is that your current data set under your query is to be in there. Also, read this: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html From pgsql-performance-owner@postgresql.org Wed Nov 16 01:15:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 31112DB81F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 01:15:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81679-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 05:15:37 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 31FAADB84A for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 01:15:35 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so1371384wri for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 21:15:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oCGFowuiDAtXKrByESLCdY3Lv+hWXSlny+rvTS+n7ylmjDTruSde9XhlC8CUASI7/xzLLWPGAUlA9ILEzM/M5HNkS2jgEEZ51b4qbcNopjMiOwwQb4T2qkmJEpNpNMVbkOlTxMi+bUS9gXPbg7RzZezyj6SZImcUf00G6wXrw4w= Received: by 10.54.66.3 with SMTP id o3mr3246183wra; Tue, 15 Nov 2005 21:15:36 -0800 (PST) Received: by 10.54.82.5 with HTTP; Tue, 15 Nov 2005 21:15:36 -0800 (PST) Message-ID: <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> Date: Wed, 16 Nov 2005 00:15:36 -0500 From: Alex Turner <armtuk@gmail.com> To: Luke Lonergan <LLonergan@greenplum.com> Subject: Re: Hardware/OS recommendations for large databases ( Cc: Adam Weisberg <Aweisberg@seiu1199.org>, pgsql-performance@postgresql.org In-Reply-To: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/263 X-Sequence-Number: 15520 On 11/15/05, Luke Lonergan <LLonergan@greenplum.com> wrote: > Adam, > > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of > > Claus Guttesen > > Sent: Tuesday, November 15, 2005 12:29 AM > > To: Adam Weisberg > > Cc: pgsql-performance@postgresql.org > > Subject: Re: [PERFORM] Hardware/OS recommendations for large > > databases ( 5TB) > > > > > Does anyone have recommendations for hardware and/or OS to > > work with > > > around 5TB datasets? > > > > Hardware-wise I'd say dual core opterons. One > > dual-core-opteron performs better than two single-core at the > > same speed. Tyan makes some boards that have four sockets, > > thereby giving you 8 cpu's (if you need that many). Sun and > > HP also makes nice hardware although the Tyan board is more > > competetive priced. > > > > OS wise I would choose the FreeBSD amd64 port but > > partititions larger than 2 TB needs some special care, using > > gpt rather than disklabel etc., tools like fsck may not be > > able to completely check partitions larger than 2 TB. Linux > > or Solaris with either LVM or Veritas FS sounds like candidates. > > I agree - you can get a very good one from www.acmemicro.com or > www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read > performance on these (with tuning) on Linux using the xfs filesystem, > which is one of the most critical factors for large databases. > Spend a fortune on dual core CPUs and then buy crappy disks... I bet for most applications this system will be IO bound, and you will see a nice lot of drive failures in the first year of operation with consumer grade drives. Spend your money on better Disks, and don't bother with Dual Core IMHO unless you can prove the need for it. Alex From pgsql-performance-owner@postgresql.org Wed Nov 16 01:17:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9AFC8D98C9 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 01:17:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81862-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 05:17:00 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by svr1.postgresql.org (Postfix) with ESMTP id 088DDD6D8C for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 01:16:57 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so1371511wri for <pgsql-performance@postgresql.org>; Tue, 15 Nov 2005 21:16:58 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=XaYXW3ZUpTMVJdW+unj/oK01MIfa71QAf1+nMLWCCdnm2PBfLWXjhFf6tbfd5V596ox8UUnUvdvnMK8D5g7y96qc02p1y0utx2rKyLqjbirFD+VPxtScl3HBzEERRO74JeQWAOoZvmwFzKTG1wjAgR5B1d9fo4EzGmxr8o9rTFI= Received: by 10.54.114.5 with SMTP id m5mr3159000wrc; Tue, 15 Nov 2005 21:16:58 -0800 (PST) Received: by 10.54.82.5 with HTTP; Tue, 15 Nov 2005 21:16:58 -0800 (PST) Message-ID: <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> Date: Wed, 16 Nov 2005 00:16:58 -0500 From: Alex Turner <armtuk@gmail.com> To: Dave Cramer <pg@fastcrypt.com> Subject: Re: Hardware/OS recommendations for large databases ( Cc: Luke Lonergan <LLonergan@greenplum.com>, Adam Weisberg <Aweisberg@seiu1199.org>, pgsql-performance@postgresql.org In-Reply-To: <B41A9E46-AC4F-4A3A-B383-AB70091745CF@fastcrypt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <B41A9E46-AC4F-4A3A-B383-AB70091745CF@fastcrypt.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/264 X-Sequence-Number: 15521 Not at random access in RAID 10 they aren't, and anyone with their head screwed on right is using RAID 10. The 9500S will still beat the Areca cards at RAID 10 database access patern. Alex. On 11/15/05, Dave Cramer <pg@fastcrypt.com> wrote: > Luke, > > Have you tried the areca cards, they are slightly faster yet. > > Dave > > On 15-Nov-05, at 7:09 AM, Luke Lonergan wrote: > > > > > > I agree - you can get a very good one from www.acmemicro.com or > > www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA > > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM > > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read > > performance on these (with tuning) on Linux using the xfs filesystem, > > which is one of the most critical factors for large databases. > > > > > Note that you want to have your DBMS use all of the CPU and disk channel > > bandwidth you have on each query, which takes a parallel database like > > Bizgres MPP to achieve. > > > > > Regards, > From pgsql-performance-owner@postgresql.org Wed Nov 16 02:08:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 998B2DB8A8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 02:08:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86531-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 06:08:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id BF10FDB86C for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 02:08:26 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Wed, 16 Nov 2005 01:07:55 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 16 Nov 2005 01:07:55 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Wed, 16 Nov 2005 01:07:54 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 15 Nov 2005 22:07:53 -0800 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: "Luke Lonergan" <llonergan@greenplum.com> To: "Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>, "Steve Wampler" <swampler@noao.edu> cc: "Dave Cramer" <pg@fastcrypt.com>, "Pgsql-Performance" <pgsql-performance@postgresql.org> Message-ID: <BFA00CB9.13C63%llonergan@greenplum.com> Thread-Topic: [PERFORM] Performance PG 8.0 on dual opteron / 4GB / 3ware Thread-Index: AcXqHf6+BJAUyQ2hSW+ZhaRz2DqctQAVhWwm In-Reply-To: <1132084287.3250.41.camel@Panoramix> MIME-Version: 1.0 X-OriginalArrivalTime: 16 Nov 2005 06:07:55.0203 (UTC) FILETIME=[15C16930:01C5EA74] X-WSS-ID: 6F64133131S12016986-01-01 Content-Type: multipart/alternative; boundary=B_3214937273_22952610 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/265 X-Sequence-Number: 15522 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214937273_22952610 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Joost, On 11/15/05 11:51 AM, "Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl> wrote: > On Tue, 2005-11-15 at 12:41 -0700, Steve Wampler wrote: >> > Joost Kraaijeveld wrote: >>> > > If I understand correctly (I have 4GB ram): >>> > > >>> > > jkr@Panoramix:~/tmp$ dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D1000000 >>> > > 1000000+0 records in >>> > > 1000000+0 records out >>> > > 8192000000 bytes transferred in 304.085269 seconds (26939812 bytes/= sec) >>> > > >>> > > Which looks suspicious: 26308 MB/sec??? >> > >> > Eh? That looks more like ~25.7 MB/sec, assuming 1MB =3D 1024*1024 bytes= . > Oooops. This calculation error is not typical for my testing (I think ;-)= ). Summarizing the two facts of note: the write result is 1/4 of what you should be getting, and you are running 1 driver behind the firmware. You might update your driver, rerun the test, and if you still have the slo= w result, verify that your filesystem isn=B9t fragmented (multiple undiscipline= d apps on the same filesystem will do that). WAL on a separate disk, on a separate controller? What is the write performance there? Regards, - Luke --B_3214937273_22952610 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Performance PG 8.0 on dual opteron / 4GB / 3ware</TITL= E> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Joost= ,<BR> <BR> On 11/15/05 11:51 AM, "Joost Kraaijeveld" <J.Kraaijeveld@Askes= is.nl> wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>On Tue, 2005-11-15 at 12:41 -0700, Steve Wampler wrote:= <BR> > Joost Kraaijeveld wrote:<BR> > > If I understand correctly (I have 4GB ram):<BR> > ><BR> > > jkr@Panoramix:~/tmp$ dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D10000= 00<BR> > > 1000000+0 records in<BR> > > 1000000+0 records out<BR> > > 8192000000 bytes transferred in 304.085269 seconds (26939812 byte= s/sec)<BR> > ><BR> > > Which looks suspicious: 26308 MB/sec???<BR> ><BR> > Eh?  That looks more like ~25.7 MB/sec, assuming 1MB =3D 1024*1024 = bytes.<BR> Oooops. This calculation error is not typical for my testing (I think ;-)).= <BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> Summarizing the two facts of note: the write result is 1/4 of what you shou= ld be getting, and you are running 1 driver behind the firmware.<BR> <BR> You might update your driver, rerun the test, and if you still have the slo= w result, verify that your filesystem isn’t fragmented (multiple undis= ciplined apps on the same filesystem will do that).<BR> <BR> WAL on a separate disk, on a separate controller?  What is the write p= erformance there?<BR> <BR> Regards,<BR> <BR> - Luke</SPAN></FONT> </BODY> </HTML> --B_3214937273_22952610-- From pgsql-performance-owner@postgresql.org Wed Nov 16 02:12:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 57DE7DAD2C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 02:12:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87854-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 06:12:48 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 557D6D6837 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 02:12:45 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Wed, 16 Nov 2005 01:12:11 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 16 Nov 2005 01:11:42 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Wed, 16 Nov 2005 01:11:41 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Tue, 15 Nov 2005 22:11:39 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "James Mello" <james@haydrian.com>, "William Yu" <wyu@talisys.com>, pgsql-performance@postgresql.org Message-ID: <BFA00D9B.13C69%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( 5TB) Thread-Index: AcXqF1J+4GMu4DJdRoSAkms/8lt9bwAADWwwABdEvjs= In-Reply-To: <775F825B46B551499DC75DC4E92F80AB0E3623@jupiter.ad.haydrian.com> MIME-Version: 1.0 X-OriginalArrivalTime: 16 Nov 2005 06:11:42.0485 (UTC) FILETIME=[9D39E450:01C5EA74] X-WSS-ID: 6F64123131S12018823-01-01 Content-Type: multipart/alternative; boundary=B_3214937500_22997028 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/266 X-Sequence-Number: 15523 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214937500_22997028 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable James, On 11/15/05 11:07 AM, "James Mello" <james@haydrian.com> wrote: > Unless there was a way to guarantee consistency, it would be hard at > best to make this work. Convergence on large data sets across boxes is > non-trivial, and diffing databases is difficult at best. Unless there > was some form of automated way to ensure consistency, going 8 ways into > separate boxes is *very* hard. I do suppose that if you have fancy > storage (EMC, Hitachi) you could do BCV or Shadow copies. But in terms > of commodity stuff, I'd have to agree with Merlin. It=B9s a matter of good software that handles the distribution / parallel query optimization / distributed transactions and management features. Combine that with a gigabit ethernet switch and it works =AD we routinely get 50x speedup over SMP on OLAP / Decision Support workloads. Regards, - Luke --B_3214937500_22997028 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases ( 5TB)= James= ,


On 11/15/05 11:07 AM, "James Mello" <james@haydrian.com> wr= ote:

Unless there was a way to guarantee consistency, it wou= ld be hard at
best to make this work. Convergence on large data sets across boxes is
non-trivial, and diffing databases is difficult at best. Unless there
was some form of automated way to ensure consistency, going 8 ways into
separate boxes is *very* hard. I do suppose that if you have fancy
storage (EMC, Hitachi) you could do BCV or Shadow copies. But in terms
of commodity stuff, I'd have to agree with Merlin.

It’s a matter of good software that handles the distribution / parall= el query optimization / distributed transactions and management features. &n= bsp;Combine that with a gigabit ethernet switch and it works – we rout= inely get 50x speedup over SMP on OLAP / Decision Support workloads.

Regards,

- Luke
--B_3214937500_22997028-- From pgsql-performance-owner@postgresql.org Wed Nov 16 02:57:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9499CDB4E7 for ; Wed, 16 Nov 2005 02:57:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39475-02 for ; Wed, 16 Nov 2005 06:57:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 96766DB3C4 for ; Wed, 16 Nov 2005 02:57:49 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 16 Nov 2005 07:57:49 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Luke Lonergan Cc: Steve Wampler , Dave Cramer , Pgsql-Performance In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Wed, 16 Nov 2005 07:57:48 +0100 Message-Id: <1132124268.25582.7.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/267 X-Sequence-Number: 15524 Hi Luke, On Tue, 2005-11-15 at 22:07 -0800, Luke Lonergan wrote: > You might update your driver, I will do that (but I admit that I am not looking forward to it. When I was young and did not make money with my computer, I liked challenges like compiling kernels and not being able to boot the computer. Not any more :-)). > > WAL on a separate disk, on a separate controller? What is the write > performance there? WAL is on a separate disk and a separate controller, write performance: jkr@Panoramix:/tmp$ dd if=/dev/zero of=bigfile bs=8k count=1000000 1000000+0 records in 1000000+0 records out 8192000000 bytes transferred in 166.499230 seconds (49201429 bytes/sec) The quest continues... -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Wed Nov 16 06:17:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1EEB0DB8B5 for ; Wed, 16 Nov 2005 06:17:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58197-08 for ; Wed, 16 Nov 2005 10:17:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 1BA38DB73B for ; Wed, 16 Nov 2005 06:17:04 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 16 Nov 2005 11:17:06 +0100 Subject: Re: Performance PG 8.0 on dual opteron / 4GB / 3ware From: Joost Kraaijeveld To: Luke Lonergan Cc: Dave Cramer , Pgsql-Performance In-Reply-To: References: Content-Type: text/plain; charset=iso-8859-13 Content-Transfer-Encoding: quoted-printable Date: Wed, 16 Nov 2005 11:17:05 +0100 Message-Id: <1132136225.5711.4.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/268 X-Sequence-Number: 15525 Hi Luke, > It is very important with the 3Ware cards to match the driver to the > firmware revision. > So, if you can get your =B4dd bigfile=A1 test to write data at 50MB/s+ > with a blocksize of 8KB, you should be doing well enough. I recompiled my kernel, added the driver and: jkr@Panoramix:~$ dmesg | grep 3w 3ware 9000 Storage Controller device driver for Linux v2.26.03.019fw. scsi4 : 3ware 9000 Storage Controller 3w-9xxx: scsi4: Found a 3ware 9000 Storage Controller at 0xfd8ffc00, IRQ: 28. 3w-9xxx: scsi4: Firmware FE9X 2.08.00.005, BIOS BE9X 2.03.01.052, Ports: 8. jkr@Panoramix:~/tmp$ dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D1000000 1000000+0 records in 1000000+0 records out 8192000000 bytes transferred in 200.982055 seconds (40759858 bytes/sec) Which is an remarkable increase in speed (38.9 MB/sec vs 25.7 MB/sec). Thanks for your suggestions. --=20 Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl=20 From pgsql-performance-owner@postgresql.org Wed Nov 16 08:51:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AFD90DB84A for ; Wed, 16 Nov 2005 08:51:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99991-05 for ; Wed, 16 Nov 2005 12:51:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id A10DADAB5A for ; Wed, 16 Nov 2005 08:51:50 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A1D6531058; Wed, 16 Nov 2005 13:51:53 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 04:51:49 -0800 Organization: Hub.Org Networking Services Lines: 20 Message-ID: References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/269 X-Sequence-Number: 15526 Alex Turner wrote: > Not at random access in RAID 10 they aren't, and anyone with their > head screwed on right is using RAID 10. The 9500S will still beat the > Areca cards at RAID 10 database access patern. The max 256MB onboard for 3ware cards is disappointing though. While good enough for 95% of cases, there's that 5% that could use a gig or two of onboard ram for ultrafast updates. For example, I'm specing out an upgrade to our current data processing server. Instead of the traditional 6xFast-Server-HDs, we're gonna go for broke and do 32xConsumer-HDs. This will give us mega I/O bandwidth but we're vulnerable to random access since consumer-grade HDs don't have the RPMs or the queueing-smarts. This means we're very dependent on the controller using onboard RAM to do I/O scheduling. 256MB divided over 4/6/8 drives -- OK. 256MB divided over 32 drives -- ugh, the HD's buffers are bigger than the RAM alotted to it. At least this is how it seems it would work from thinking through all the factors. Unfortunately, I haven't found anybody else who has gone this route and reported their results so I guess we're the guinea pig. From pgsql-performance-owner@postgresql.org Wed Nov 16 09:09:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5CF1EDB8D3 for ; Wed, 16 Nov 2005 09:08:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02619-09 for ; Wed, 16 Nov 2005 13:08:57 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 445BEDA387 for ; Wed, 16 Nov 2005 09:08:52 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D404831058; Wed, 16 Nov 2005 14:08:55 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( 5TB) Date: Wed, 16 Nov 2005 05:08:50 -0800 Organization: Hub.Org Networking Services Lines: 31 Message-ID: References: <775F825B46B551499DC75DC4E92F80AB0E3623@jupiter.ad.haydrian.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <775F825B46B551499DC75DC4E92F80AB0E3623@jupiter.ad.haydrian.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/270 X-Sequence-Number: 15527 James Mello wrote: > Unless there was a way to guarantee consistency, it would be hard at > best to make this work. Convergence on large data sets across boxes is > non-trivial, and diffing databases is difficult at best. Unless there > was some form of automated way to ensure consistency, going 8 ways into > separate boxes is *very* hard. I do suppose that if you have fancy > storage (EMC, Hitachi) you could do BCV or Shadow copies. But in terms > of commodity stuff, I'd have to agree with Merlin. If you're talking about data consistency, I don't see why that's an issue in a bulk-load/read-only setup. Either bulk load on 1 server and then do a file copy to all the others -- or simultaneously bulk load on all servers. If you're talking about consistency in directly queries to the appropriate servers, I agree that's a more complicated issue but not unsurmountable. If you don't use persistent connections, you can probably get pretty good routing using DNS -- monitor servers by looking at top/iostat/memory info/etc and continually change the DNS zonemaps to direct traffic to less busy servers. (I use this method for our global load balancers -- pretty easy to script via Perl/Python/etc.) Mind you since you need a Dual Processor motherboard anyways to get PCI-X, that means every machine would be a 2xDual Core so there's enough CPU power to handle the cases where 2 or 3 queries get sent to the same server back-to-back. Of course, I/O would take a hit in this case -- but I/O would take a hit in every case on a single 16-core mega system. If use persistent connections, it'll definitely require extra programming beyond simple scripting. Take one of the opensource projects like PgPool or SQLRelay and alter it so it monitors all servers to see what server is least busy before passing a query on. From pgsql-performance-owner@postgresql.org Wed Nov 16 09:57:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F4BDDB849 for ; Wed, 16 Nov 2005 09:57:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10778-06 for ; Wed, 16 Nov 2005 13:57:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 7F518DB889 for ; Wed, 16 Nov 2005 09:57:22 -0400 (AST) Received: from nmd.esds.den.wayport.net (nmd.esds.den.wayport.net [64.134.13.30]) by svr2.postgresql.org (Postfix) with ESMTP id 4DFF0F0BBF for ; Wed, 16 Nov 2005 13:57:25 +0000 (GMT) Received: from nmd.esds.den.wayport.net (localhost [[UNIX: localhost]]) by nmd.esds.den.wayport.net (8.12.10/8.12.10) with ESMTP id jAGDvCNZ024054; Wed, 16 Nov 2005 06:57:13 -0700 Message-ID: <437B3B18.1040509@commandprompt.com> Date: Wed, 16 Nov 2005 05:58:48 -0800 From: "Joshua D. Drake" User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: Alex Turner Cc: Luke Lonergan , Adam Weisberg , pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> In-Reply-To: <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/271 X-Sequence-Number: 15528 >> I agree - you can get a very good one from www.acmemicro.com or >> www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA >> RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM >> on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read >> performance on these (with tuning) on Linux using the xfs filesystem, >> which is one of the most critical factors for large databases. >> >> > > Spend a fortune on dual core CPUs and then buy crappy disks... I bet > for most applications this system will be IO bound, and you will see a > nice lot of drive failures in the first year of operation with > consumer grade drives. > There is nothing wrong with using SATA disks and they perform very well. The catch is, make sure you have a battery back up on the raid controller. > Spend your money on better Disks, and don't bother with Dual Core IMHO > unless you can prove the need for it. > The reason you want the dual core cpus is that PostgreSQL can only execute 1 query per cpu at a time, so the application will see a big boost in overall transactional velocity if you push two dual-core cpus into the machine. Joshua D. Drake > Alex > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Wed Nov 16 09:59:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7AD8FDB8FB for ; Wed, 16 Nov 2005 09:59:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11189-08 for ; Wed, 16 Nov 2005 13:59:09 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 2BE32DB8EA for ; Wed, 16 Nov 2005 09:59:04 -0400 (AST) Received: from smtpauth10.mail.atl.earthlink.net (smtpauth10.mail.atl.earthlink.net [209.86.89.70]) by svr2.postgresql.org (Postfix) with ESMTP id 2AB82F0BBD for ; Wed, 16 Nov 2005 13:59:07 +0000 (GMT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=itG9/+4GQowvpvtI8SHLjpOvaSPHM3hbgFztei1AQRc7WNYB50VzARLGwVaKuHKt; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.226.16] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth10.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EcNoV-0005aE-RD; Wed, 16 Nov 2005 08:59:04 -0500 Message-Id: <6.2.5.6.0.20051116083943.01be0b98@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Wed, 16 Nov 2005 08:58:56 -0500 To: Alex Turner , pgsql-performance@postgresql.org From: Ron Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.co m> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc0a86edbe321ae9a36470654d9361db80350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.226.16 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200511/272 X-Sequence-Number: 15529 Got some hard numbers to back your statement up? IME, the Areca 1160's with >= 1GB of cache beat any other commodity RAID controller. This seems to be in agreement with at least one independent testing source: http://print.tweakers.net/?reviews/557 RAID HW from Xyratex, Engino, or Dot Hill will _destroy_ any commodity HW solution, but their price point is considerably higher. ...on another note, I completely agree with the poster who says we need more cache on RAID controllers. We should all be beating on the RAID HW manufacturers to use standard DIMMs for their caches and to provide 2 standard DIMM slots in their full height cards (allowing for up to 8GB of cache using 2 4GB DIMMs as of this writing). It should also be noted that 64 drive chassis' are going to become possible once 2.5" 10Krpm SATA II and FC HDs become the standard next year (48's are the TOTL now). We need controller technology to keep up. Ron At 12:16 AM 11/16/2005, Alex Turner wrote: >Not at random access in RAID 10 they aren't, and anyone with their >head screwed on right is using RAID 10. The 9500S will still beat the >Areca cards at RAID 10 database access patern. > >Alex. > >On 11/15/05, Dave Cramer wrote: > > Luke, > > > > Have you tried the areca cards, they are slightly faster yet. > > > > Dave > > > > On 15-Nov-05, at 7:09 AM, Luke Lonergan wrote: > > > > > > > > > > > > I agree - you can get a very good one from www.acmemicro.com or > > > > www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA > > > > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM > > > > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read > > > > performance on these (with tuning) on Linux using the xfs filesystem, > > > > which is one of the most critical factors for large databases. > > > > > > > > > > Note that you want to have your DBMS use all of the CPU and disk channel > > > > bandwidth you have on each query, which takes a parallel database like > > > > Bizgres MPP to achieve. > > > > > > > > > > Regards, > > > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Wed Nov 16 10:13:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 51EAFDB878 for ; Wed, 16 Nov 2005 10:13:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13861-04 for ; Wed, 16 Nov 2005 14:13:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.advfn.com (mail.advfn.com [212.161.99.149]) by svr1.postgresql.org (Postfix) with ESMTP id 9CA1ADB851 for ; Wed, 16 Nov 2005 10:13:27 -0400 (AST) Received: from [192.168.0.155] (gw.advfn.com [213.86.19.101]) by mail.advfn.com (Postfix) with ESMTP id 864B79E840; Wed, 16 Nov 2005 14:13:28 +0000 (GMT) In-Reply-To: References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v734) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <41AD9695-69AC-4677-AEBD-9D9E21BD8DCF@advfn.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 14:13:26 +0000 To: William Yu X-Mailer: Apple Mail (2.734) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-4.3 required=5 tests=[RCVD_IN_BSP_TRUSTED=-4.3] X-Spam-Score: -4.3 X-Spam-Level: X-Archive-Number: 200511/273 X-Sequence-Number: 15530 On 16 Nov 2005, at 12:51, William Yu wrote: > Alex Turner wrote: > >> Not at random access in RAID 10 they aren't, and anyone with their >> head screwed on right is using RAID 10. The 9500S will still beat >> the >> Areca cards at RAID 10 database access patern. >> > > The max 256MB onboard for 3ware cards is disappointing though. > While good enough for 95% of cases, there's that 5% that could use > a gig or two of onboard ram for ultrafast updates. For example, I'm > specing out an upgrade to our current data processing server. > Instead of the traditional 6xFast-Server-HDs, we're gonna go for > broke and do 32xConsumer-HDs. This will give us mega I/O bandwidth > but we're vulnerable to random access since consumer-grade HDs > don't have the RPMs or the queueing-smarts. This means we're very > dependent on the controller using onboard RAM to do I/O scheduling. > 256MB divided over 4/6/8 drives -- OK. 256MB divided over 32 drives > -- ugh, the HD's buffers are bigger than the RAM alotted to it. > > At least this is how it seems it would work from thinking through > all the factors. Unfortunately, I haven't found anybody else who > has gone this route and reported their results so I guess we're the > guinea pig. > Your going to have to factor in the increased failure rate in your cost measurements, including any downtime or performance degradation whilst rebuilding parts of your RAID array. It depends on how long your planning for this system to be operational as well of course. Pick two: Fast, cheap, reliable. From pgsql-performance-owner@postgresql.org Wed Nov 16 10:29:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 14419DB892 for ; Wed, 16 Nov 2005 10:29:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14867-09 for ; Wed, 16 Nov 2005 14:29:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id C64B5DB851 for ; Wed, 16 Nov 2005 10:29:47 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21669031; Wed, 16 Nov 2005 07:29:46 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAGETi6O028973; Wed, 16 Nov 2005 07:29:45 -0700 Message-ID: <437B4258.8050507@noao.edu> Date: Wed, 16 Nov 2005 07:29:44 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Joshua D. Drake" CC: Alex Turner , Luke Lonergan , Adam Weisberg , pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> In-Reply-To: <437B3B18.1040509@commandprompt.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/274 X-Sequence-Number: 15531 Joshua D. Drake wrote: > The reason you want the dual core cpus is that PostgreSQL can only > execute 1 query per cpu at a time,... Is that true? I knew that PG only used one cpu per query, but how does PG know how many CPUs there are to limit the number of queries? -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Wed Nov 16 10:35:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 14806DB892 for ; Wed, 16 Nov 2005 10:35:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17051-05 for ; Wed, 16 Nov 2005 14:35:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 166CFD6D16 for ; Wed, 16 Nov 2005 10:35:18 -0400 (AST) Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by svr2.postgresql.org (Postfix) with ESMTP id 534BCF0C44 for ; Wed, 16 Nov 2005 14:35:22 +0000 (GMT) Received: from [69.145.82.253] (unknown [69.145.82.253]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id 263A11102E6; Wed, 16 Nov 2005 06:35:20 -0800 (PST) Message-ID: <437B43AB.7050104@boreham.org> Date: Wed, 16 Nov 2005 07:35:23 -0700 From: David Boreham User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Wampler Cc: "Joshua D. Drake" , Alex Turner , Luke Lonergan , Adam Weisberg , pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4258.8050507@noao.edu> In-Reply-To: <437B4258.8050507@noao.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/275 X-Sequence-Number: 15532 Steve Wampler wrote: >Joshua D. Drake wrote: > > >>The reason you want the dual core cpus is that PostgreSQL can only >>execute 1 query per cpu at a time,... >> >> > >Is that true? I knew that PG only used one cpu per query, but how >does PG know how many CPUs there are to limit the number of queries? > > > He means only one query can be executing on each cpu at any particular instant. From pgsql-performance-owner@postgresql.org Wed Nov 16 10:38:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81988DB84A for ; Wed, 16 Nov 2005 10:38:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17620-03 for ; Wed, 16 Nov 2005 14:38:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3C31EDB28E for ; Wed, 16 Nov 2005 10:37:58 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 63F5831058; Wed, 16 Nov 2005 15:38:02 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 06:37:48 -0800 Organization: Hub.Org Networking Services Lines: 11 Message-ID: References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> <41AD9695-69AC-4677-AEBD-9D9E21BD8DCF@advfn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <41AD9695-69AC-4677-AEBD-9D9E21BD8DCF@advfn.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/276 X-Sequence-Number: 15533 Alex Stapleton wrote: > Your going to have to factor in the increased failure rate in your cost > measurements, including any downtime or performance degradation whilst > rebuilding parts of your RAID array. It depends on how long your > planning for this system to be operational as well of course. If we go 32xRAID10, rebuild time should be the same as rebuild time in a 4xRAID10 system. Only the hard drive that was replaced needs rebuild -- not the entire array. And yes, definitely need a bunch of drives lying around as spares. From pgsql-performance-owner@postgresql.org Wed Nov 16 10:40:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 480D2DB887 for ; Wed, 16 Nov 2005 10:38:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17307-05 for ; Wed, 16 Nov 2005 14:38:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 9CDB5DB84A for ; Wed, 16 Nov 2005 10:38:49 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21669179; Wed, 16 Nov 2005 07:38:53 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAGEcquE029170; Wed, 16 Nov 2005 07:38:52 -0700 Message-ID: <437B447C.7050508@noao.edu> Date: Wed, 16 Nov 2005 07:38:52 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Boreham CC: "Joshua D. Drake" , Alex Turner , Luke Lonergan , Adam Weisberg , pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4258.8050507@noao.edu> <437B43AB.7050104@boreham.org> In-Reply-To: <437B43AB.7050104@boreham.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/277 X-Sequence-Number: 15534 David Boreham wrote: > Steve Wampler wrote: > >> Joshua D. Drake wrote: >> >> >>> The reason you want the dual core cpus is that PostgreSQL can only >>> execute 1 query per cpu at a time,... >>> >> >> >> Is that true? I knew that PG only used one cpu per query, but how >> does PG know how many CPUs there are to limit the number of queries? >> >> >> > He means only one query can be executing on each cpu at any particular > instant. Got it - the cpu is only acting on one query in any instant but may be switching between many 'simultaneous' queries. PG isn't really involved in the decision. That makes sense. -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Wed Nov 16 10:51:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24D98DB9B7 for ; Wed, 16 Nov 2005 10:51:25 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18837-05 for ; Wed, 16 Nov 2005 14:51:28 +0000 (GMT) X-Greylist: delayed 00:16:05.685679 by SQLgrey- Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by svr1.postgresql.org (Postfix) with ESMTP id 9007EDB9B5 for ; Wed, 16 Nov 2005 10:51:22 -0400 (AST) Received: from [69.145.82.253] (unknown [69.145.82.253]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id 6775611027B for ; Wed, 16 Nov 2005 06:51:27 -0800 (PST) Message-ID: <437B4773.1040404@boreham.org> Date: Wed, 16 Nov 2005 07:51:31 -0700 From: David Boreham User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> In-Reply-To: <437B3B18.1040509@commandprompt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/278 X-Sequence-Number: 15535 >Spend a fortune on dual core CPUs and then buy crappy disks... I bet >for most applications this system will be IO bound, and you will see a >nice lot of drive failures in the first year of operation with >consumer grade drives. I guess I've never bought into the vendor story that there are two reliability grades. Why would they bother making two different kinds of bearing, motor etc ? Seems like it's more likely an excuse to justify higher prices. In my experience the expensive SCSI drives I own break frequently while the cheapo desktop drives just keep chunking along (modulo certain products that have a specific known reliability problem). I'd expect that a larger number of hotter drives will give a less reliable system than a smaller number of cooler ones. From pgsql-performance-owner@postgresql.org Wed Nov 16 11:33:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A49A9DBB05 for ; Wed, 16 Nov 2005 11:33:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23959-07 for ; Wed, 16 Nov 2005 15:33:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 78009DBA50 for ; Wed, 16 Nov 2005 11:33:40 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0916531058; Wed, 16 Nov 2005 16:33:45 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 07:33:39 -0800 Organization: Hub.Org Networking Services Lines: 42 Message-ID: References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/279 X-Sequence-Number: 15536 Alex Turner wrote: > Spend a fortune on dual core CPUs and then buy crappy disks... I bet > for most applications this system will be IO bound, and you will see a > nice lot of drive failures in the first year of operation with > consumer grade drives. > > Spend your money on better Disks, and don't bother with Dual Core IMHO > unless you can prove the need for it. I would say the opposite -- you always want Dual Core nowadays. DC Opterons simply give you better bang for the buck than single core Opterons. Price out a 1xDC system against a 2x1P system -- the 1xDC will be cheaper. Do the same for 2xDC versus 4x1P, 4xDC versus 8x1P, 8xDC versus 16x1P, etc. -- DC gets cheaper by wider and wider margins because those mega-CPU motherboards are astronomically expensive. DC also gives you a better upgrade path. Let's say you do testing and figure 2x246 is the right setup to handle the load. Well instead of getting 2x1P, use the same 2P motherboard but only populate 1 CPU w/ a DC/270. Now you have a server that can be upgraded to +80% more CPU by popping in another DC/270 versus throwing out the entire thing to get a 4x1P setup. The only questions would be: (1) Do you need a SMP server at all? I'd claim yes -- you always need 2+ cores whether it's DC or 2P to avoid IO interrupts blocking other processes from running. (2) Does a DC system perform better than it's Nx1P cousin? My experience is yes. Did some rough tests in a drop-in-replacement 1x265 versus 2x244 and saw about +10% for DC. All the official benchmarks (Spec, Java, SAP, etc) from AMD/Sun/HP/IBM show DCs outperforming the Nx1P setups. (3) Do you need an insane amount of memory? Well here's the case where the more expensive motherboard will serve you better since each CPU slot has its own bank of memory. Spend more money on memory, get cheaper single-core CPUs. Of course, this doesn't apply if you are an Intel/Dell-only shop. Xeon DCs, while cheaper than their corresponding single-core SMPs, don't have the same performance profile of Opteron DCs. Basically, you're paying a bit extra so your server can generate a ton more heat. From pgsql-performance-owner@postgresql.org Wed Nov 16 11:41:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D49ADBB65 for ; Wed, 16 Nov 2005 11:41:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24984-04 for ; Wed, 16 Nov 2005 15:41:21 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4732FDBB14 for ; Wed, 16 Nov 2005 11:41:14 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 3EC4631058; Wed, 16 Nov 2005 16:41:19 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 07:41:10 -0800 Organization: Hub.Org Networking Services Lines: 25 Message-ID: References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <437B4773.1040404@boreham.org> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/280 X-Sequence-Number: 15537 David Boreham wrote: > >Spend a fortune on dual core CPUs and then buy crappy disks... I bet > >for most applications this system will be IO bound, and you will see a > >nice lot of drive failures in the first year of operation with > >consumer grade drives. > > I guess I've never bought into the vendor story that there are > two reliability grades. Why would they bother making two > different kinds of bearing, motor etc ? Seems like it's more > likely an excuse to justify higher prices. In my experience the > expensive SCSI drives I own break frequently while the cheapo > desktop drives just keep chunking along (modulo certain products > that have a specific known reliability problem). > > I'd expect that a larger number of hotter drives will give a less reliable > system than a smaller number of cooler ones. Our SCSI drives have failed maybe a little less than our IDE drives. Hell, some of the SCSIs even came bad when we bought them. Of course, the IDE drive failure % is inflated by all the IBM Deathstars we got -- ugh. Basically, I've found it's cooling that's most important. Packing the drives together into really small rackmounts? Good for your density, not good for the drives. Now we do larger rackmounts -- drives have more space in between each other plus fans in front and back of the drives. From pgsql-performance-owner@postgresql.org Wed Nov 16 15:15:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 180BBDB92F for ; Wed, 16 Nov 2005 15:15:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51525-02 for ; Wed, 16 Nov 2005 19:15:11 +0000 (GMT) X-Greylist: delayed 03:14:04.361569 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 5BC02DB947 for ; Wed, 16 Nov 2005 15:15:09 -0400 (AST) Received: from outbound0.sv.meer.net (outbound0.sv.meer.net [205.217.152.13]) by svr2.postgresql.org (Postfix) with ESMTP id 5F24FF0B01 for ; Wed, 16 Nov 2005 16:01:03 +0000 (GMT) Received: from mail.meer.net (mail.meer.net [209.157.152.14]) by outbound0.sv.meer.net (8.12.10/8.12.6) with ESMTP id jAGFivQs071823; Wed, 16 Nov 2005 07:44:57 -0800 (PST) (envelope-from trainor@TRANSBORDER.NET) Received: from [192.168.2.2] (pool-70-20-217-196.phil.east.verizon.net [70.20.217.196]) by mail.meer.net (8.13.3/8.13.3/meer) with ESMTP id jAGFipO9006973; Wed, 16 Nov 2005 07:44:51 -0800 (PST) (envelope-from trainor@transborder.net) In-Reply-To: <437B447C.7050508@noao.edu> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4258.8050507@noao.edu> <437B43AB.7050104@boreham.org> <437B447C.7050508@noao.edu> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <2F6294FF-F274-46E8-85D0-461A6FF36653@transborder.net> Cc: David Boreham , "Joshua D. Drake" , Alex Turner , Luke Lonergan , Adam Weisberg , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: "Douglas J. Trainor" Subject: OT Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 10:45:15 -0500 To: Steve Wampler X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/293 X-Sequence-Number: 15550 AMD added quad-core processors to their public roadmap for 2007. Beyond 2007, the quad-cores will scale up to 32 sockets!!!!!!!! (using Direct Connect Architecture 2.0) Expect Intel to follow. douglas On Nov 16, 2005, at 9:38 AM, Steve Wampler wrote: > [...] > > Got it - the cpu is only acting on one query in any instant but may be > switching between many 'simultaneous' queries. PG isn't really > involved > in the decision. That makes sense. From pgsql-performance-owner@postgresql.org Wed Nov 16 11:46:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 082C0DBB93 for ; Wed, 16 Nov 2005 11:46:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24941-08 for ; Wed, 16 Nov 2005 15:46:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id D6B39DBB86 for ; Wed, 16 Nov 2005 11:46:20 -0400 (AST) Received: from [10.30.1.41] ([72.16.194.3]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jAGFfGtd032572; Wed, 16 Nov 2005 07:41:22 -0800 Message-ID: <437B54A9.5070104@commandprompt.com> Date: Wed, 16 Nov 2005 07:47:53 -0800 From: "Joshua D. Drake" User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: David Boreham CC: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> In-Reply-To: <437B4773.1040404@boreham.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Wed, 16 Nov 2005 07:41:23 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/281 X-Sequence-Number: 15538 > > I guess I've never bought into the vendor story that there are > two reliability grades. Why would they bother making two > different kinds of bearing, motor etc ? Seems like it's more > likely an excuse to justify higher prices. In my experience the > expensive SCSI drives I own break frequently while the cheapo > desktop drives just keep chunking along (modulo certain products > that have a specific known reliability problem). I don't know if the reliability grade is true or not but what I can tell you is that I have scsi drives that are 5+ years old that still work without issue. I have never had an IDE drive last longer than 3 years (when used in production). That being said, so what. That is what raid is for. You loose a drive and hot swap it back in. Heck keep a hotspare in the trays. Joshua D. Drake > > I'd expect that a larger number of hotter drives will give a less > reliable > system than a smaller number of cooler ones. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Wed Nov 16 12:00:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F36C0D7D3D for ; Wed, 16 Nov 2005 12:00:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26145-08 for ; Wed, 16 Nov 2005 16:00:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by svr1.postgresql.org (Postfix) with ESMTP id 6E54FDB84A for ; Wed, 16 Nov 2005 12:00:09 -0400 (AST) Received: from [69.145.82.253] (unknown [69.145.82.253]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id BF8E511027B for ; Wed, 16 Nov 2005 08:00:08 -0800 (PST) Message-ID: <437B578C.4000309@boreham.org> Date: Wed, 16 Nov 2005 09:00:12 -0700 From: David Boreham User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <200511161550.jAGFoCY09049@candle.pha.pa.us> In-Reply-To: <200511161550.jAGFoCY09049@candle.pha.pa.us> Content-Type: multipart/alternative; boundary="------------020409050605040700020305" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=-0.001, HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/282 X-Sequence-Number: 15539 This is a multi-part message in MIME format. --------------020409050605040700020305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > >I suggest you read this on the difference between enterprise/SCSI and >desktop/IDE drives: > > http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interface_ATA_vs_SCSI_042003.pdf > > > This is exactly the kind of vendor propaganda I was talking about and it proves my point quite well : that there's nothing specific relating to reliability that is different between SCSI and SATA drives cited in that paper. It does have a bunch of FUD such as 'oh yeah we do a lot more drive characterization during manufacturing'. --------------020409050605040700020305 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

I suggest you read this on the difference between enterprise/SCSI and
desktop/IDE drives:

	http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interface_ATA_vs_SCSI_042003.pdf

  
This is exactly the kind of vendor propaganda I was talking about
and it proves my point quite well : that there's nothing specific relating
to reliability that is different between SCSI and SATA drives cited in that paper.
It does have a bunch of FUD such as 'oh yeah we do a lot more
drive characterization during manufacturing'.



--------------020409050605040700020305-- From pgsql-performance-owner@postgresql.org Wed Nov 16 12:02:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AAEADDB902 for ; Wed, 16 Nov 2005 12:02:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28023-03 for ; Wed, 16 Nov 2005 16:02:05 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id ED20DDB90A for ; Wed, 16 Nov 2005 12:02:04 -0400 (AST) Received: from [10.30.1.41] ([72.16.194.3]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jAGFv0HB000683; Wed, 16 Nov 2005 07:57:03 -0800 Message-ID: <437B5859.9040805@commandprompt.com> Date: Wed, 16 Nov 2005 08:03:37 -0800 From: "Joshua D. Drake" User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: William Yu CC: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Wed, 16 Nov 2005 07:57:03 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/283 X-Sequence-Number: 15540 > > The only questions would be: > (1) Do you need a SMP server at all? I'd claim yes -- you always need > 2+ cores whether it's DC or 2P to avoid IO interrupts blocking other > processes from running. I would back this up. Even for smaller installations (single raid 1, 1 gig of ram). Why? Well because many applications are going to be CPU bound. For example we have a PHP application that is a CMS. On a single CPU machine, RAID 1 it takes about 300ms to deliver a single page, point to point. We are not IO bound. So what happens is that under reasonable load we are actually waiting for the CPU to process the code. A simple upgrade to an SMP machine literally doubles our performance because we are still not IO bound. I strongly suggest that everyone use at least a single dual core because of this experience. > > (3) Do you need an insane amount of memory? Well here's the case where > the more expensive motherboard will serve you better since each CPU > slot has its own bank of memory. Spend more money on memory, get > cheaper single-core CPUs. Agreed. A lot of times the slowest dual-core is 5x what you actually need. So get the slowest, and bulk up on memory. If nothing else memory is cheap today and it might not be tomorrow. > Of course, this doesn't apply if you are an Intel/Dell-only shop. Xeon > DCs, while cheaper than their corresponding single-core SMPs, don't > have the same performance profile of Opteron DCs. Basically, you're > paying a bit extra so your server can generate a ton more heat. > Well if you are an Intel/Dell shop running PostgreSQL you have bigger problems ;) Sincerely, Joshua D. Drake > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Wed Nov 16 15:15:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 45AF2DB954 for ; Wed, 16 Nov 2005 15:15:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51183-04 for ; Wed, 16 Nov 2005 19:15:12 +0000 (GMT) X-Greylist: delayed 03:07:57.559284 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 71EAADB94E for ; Wed, 16 Nov 2005 15:15:10 -0400 (AST) Received: from vadmzmailmx02.bankofamerica.com (vamx02.bankofamerica.com [171.159.192.79]) by svr2.postgresql.org (Postfix) with ESMTP id D9774F0B34 for ; Wed, 16 Nov 2005 16:07:10 +0000 (GMT) Received: from vadmzmailmx03.bankofamerica.com ([171.182.200.79]) by vadmzmailmx02.bankofamerica.com (8.12.11/8.12.11) with ESMTP id jAGG741I016316 for ; Wed, 16 Nov 2005 16:07:06 GMT Received: from memscmpl4. (varchvp01s209.bankofamerica.com [171.177.163.14]) by vadmzmailmx03.bankofamerica.com (8.12.11/8.12.11) with SMTP id jAGG6B05030120 for ; Wed, 16 Nov 2005 16:07:04 GMT Received: from memmta0303 (171.186.140.81) by memscmpl4. (Sigaba Gateway v3.6.1) with ESMTP id 301306555; Wed, 16 Nov 2005 11:07:03 -0500 Date: Wed, 16 Nov 2005 11:07:00 -0500 From: "Welty, Richard" Subject: Re: Hardware/OS recommendations for large databases ( To: pgsql-performance@postgresql.org Message-id: <2F769A036C2082469C3A4BF2603694C601E7686E@ex2k.bankofamerica.com> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Content-class: urn:content-classes:message Thread-topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-index: AcXqxMG5kjnh5GXpRB6kEKlNrPmDdQAAuQxA X-MS-Has-Attach: X-MS-TNEF-Correlator: X-OriginalArrivalTime: 16 Nov 2005 16:07:03.0550 (UTC) FILETIME=[C8A3D9E0:01C5EAC7] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/294 X-Sequence-Number: 15551 David Boreham wrote: > I guess I've never bought into the vendor story that there are > two reliability grades. Why would they bother making two > different kinds of bearing, motor etc ? Seems like it's more > likely an excuse to justify higher prices. then how to account for the fact that bleeding edge SCSI drives turn at twice the rpms of bleeding edge consumer drives? richard From pgsql-performance-owner@postgresql.org Wed Nov 16 13:06:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D3079DB8A6 for ; Wed, 16 Nov 2005 13:06:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35077-07 for ; Wed, 16 Nov 2005 17:06:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 14AB9DB8D6 for ; Wed, 16 Nov 2005 13:06:26 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 16 Nov 2005 11:06:25 -0600 Subject: Re: Hardware/OS recommendations for large databases ( From: Scott Marlowe To: David Boreham Cc: pgsql-performance@postgresql.org In-Reply-To: <437B4773.1040404@boreham.org> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132160785.3582.60.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 16 Nov 2005 11:06:25 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/284 X-Sequence-Number: 15541 On Wed, 2005-11-16 at 08:51, David Boreham wrote: > >Spend a fortune on dual core CPUs and then buy crappy disks... I bet > >for most applications this system will be IO bound, and you will see a > >nice lot of drive failures in the first year of operation with > >consumer grade drives. > > I guess I've never bought into the vendor story that there are > two reliability grades. Why would they bother making two > different kinds of bearing, motor etc ? Seems like it's more > likely an excuse to justify higher prices. In my experience the > expensive SCSI drives I own break frequently while the cheapo > desktop drives just keep chunking along (modulo certain products > that have a specific known reliability problem). > > I'd expect that a larger number of hotter drives will give a less reliable > system than a smaller number of cooler ones. My experience has mirrored this. Anyone remember back when HP made their SureStore drives? We built 8 drive RAID arrays to ship to customer sites, pre-filled with data. Not a single one arrived fully operational. The failure rate on those drives was something like 60% in the first year, and HP quit making hard drives because of it. Those were SCSI Server class drives, supposedly built to last 5 years. OTOH, I remember putting a pair of 60 Gig IDEs into a server that had lots of ventilation and fans and such, and having no problems whatsoever. There was a big commercial EMC style array in the hosting center at the same place that had something like a 16 wide by 16 tall array of IDE drives for storing pdf / tiff stuff on it, and we had at least one failure a month in it. Of course, that's 256 drives, so you're gonna have failures, and it was configured with a spare on every other row or some such. We just had a big box of hard drives and it was smart enough to rebuild automagically when you put a new one in, so the maintenance wasn't really that bad. The performance was quite impressive too. From pgsql-performance-owner@postgresql.org Wed Nov 16 13:12:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C1C7DB935 for ; Wed, 16 Nov 2005 13:08:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36295-03 for ; Wed, 16 Nov 2005 17:08:39 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id D29F4DB90E for ; Wed, 16 Nov 2005 13:08:37 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 57so1478324wri for ; Wed, 16 Nov 2005 09:08:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=U3plebiRJeEgplRPZjVhy8l+/pjZtiSrR4CPf1UQzRbJWQ7u1XBVecOpQ/kA7CgRbMQKN19IVp+bZI9Ze+51o+OUnsa9u7dwoeX1uds4u7XmvxRGonKXLbWqK+tqbwLAcmT5lvuS2loWSwSmHxQIEe+uiK7oPHYyjUDYR4G7Xsk= Received: by 10.54.99.2 with SMTP id w2mr6042637wrb; Wed, 16 Nov 2005 09:08:37 -0800 (PST) Received: by 10.54.82.5 with HTTP; Wed, 16 Nov 2005 09:08:37 -0800 (PST) Message-ID: <33c6269f0511160908s5c432ee2r82f78598b8f5d036@mail.gmail.com> Date: Wed, 16 Nov 2005 12:08:37 -0500 From: Alex Turner To: Ron Subject: Re: Hardware/OS recommendations for large databases Cc: pgsql-performance@postgresql.org In-Reply-To: <6.2.5.6.0.20051116083943.01be0b98@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> <6.2.5.6.0.20051116083943.01be0b98@earthlink.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/286 X-Sequence-Number: 15543 Yes - that very benchmark shows that for a MySQL Datadrive in RAID 10, the 3ware controllers beat the Areca card. Alex. On 11/16/05, Ron wrote: > Got some hard numbers to back your statement up? IME, the Areca > 1160's with >=3D 1GB of cache beat any other commodity RAID > controller. This seems to be in agreement with at least one > independent testing source: > > http://print.tweakers.net/?reviews/557 > > RAID HW from Xyratex, Engino, or Dot Hill will _destroy_ any > commodity HW solution, but their price point is considerably higher. > > ...on another note, I completely agree with the poster who says we > need more cache on RAID controllers. We should all be beating on the > RAID HW manufacturers to use standard DIMMs for their caches and to > provide 2 standard DIMM slots in their full height cards (allowing > for up to 8GB of cache using 2 4GB DIMMs as of this writing). > > It should also be noted that 64 drive chassis' are going to become > possible once 2.5" 10Krpm SATA II and FC HDs become the standard next > year (48's are the TOTL now). We need controller technology to keep up. > > Ron > > At 12:16 AM 11/16/2005, Alex Turner wrote: > >Not at random access in RAID 10 they aren't, and anyone with their > >head screwed on right is using RAID 10. The 9500S will still beat the > >Areca cards at RAID 10 database access patern. > > > >Alex. > > > >On 11/15/05, Dave Cramer wrote: > > > Luke, > > > > > > Have you tried the areca cards, they are slightly faster yet. > > > > > > Dave > > > > > > On 15-Nov-05, at 7:09 AM, Luke Lonergan wrote: > > > > > > > > > > > > > > > > > > I agree - you can get a very good one from www.acmemicro.com or > > > > > > www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SA= TA > > > > > > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RA= M > > > > > > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read > > > > > > performance on these (with tuning) on Linux using the xfs filesystem, > > > > > > which is one of the most critical factors for large databases. > > > > > > > > > > > > > > > Note that you want to have your DBMS use all of the CPU and disk chan= nel > > > > > > bandwidth you have on each query, which takes a parallel database lik= e > > > > > > Bizgres MPP to achieve. > > > > > > > > > > > > > > > Regards, > > > > > > >---------------------------(end of broadcast)--------------------------- > >TIP 2: Don't 'kill -9' the postmaster > > > > From pgsql-performance-owner@postgresql.org Wed Nov 16 13:09:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 98ED7DB945 for ; Wed, 16 Nov 2005 13:09:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36233-04 for ; Wed, 16 Nov 2005 17:09:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id EFF5ADB93D for ; Wed, 16 Nov 2005 13:09:38 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 16 Nov 2005 11:09:38 -0600 Subject: Re: Hardware/OS recommendations for large databases ( From: Scott Marlowe To: William Yu Cc: pgsql-performance@postgresql.org In-Reply-To: References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132160978.3582.64.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 16 Nov 2005 11:09:38 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/285 X-Sequence-Number: 15542 On Wed, 2005-11-16 at 09:33, William Yu wrote: > Alex Turner wrote: > > Spend a fortune on dual core CPUs and then buy crappy disks... I bet > > for most applications this system will be IO bound, and you will see a > > nice lot of drive failures in the first year of operation with > > consumer grade drives. > > > > Spend your money on better Disks, and don't bother with Dual Core IMHO > > unless you can prove the need for it. > > I would say the opposite -- you always want Dual Core nowadays. DC > Opterons simply give you better bang for the buck than single core > Opterons. Price out a 1xDC system against a 2x1P system -- the 1xDC will > be cheaper. Do the same for 2xDC versus 4x1P, 4xDC versus 8x1P, 8xDC > versus 16x1P, etc. -- DC gets cheaper by wider and wider margins because > those mega-CPU motherboards are astronomically expensive. The biggest gain is going from 1 to 2 CPUs (real cpus, like the DC Opterons or genuine dual CPU mobo, not "hyperthreaded"). Part of the issue isn't just raw CPU processing power. The second CPU allows the machine to be more responsive because it doesn't have to context switch as much. While I've seen plenty of single CPU servers start to bog under load running one big query, the dual CPU machines always seem more than just twice as snappy under similar loads. From pgsql-performance-owner@postgresql.org Wed Nov 16 13:47:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A294DB75B for ; Wed, 16 Nov 2005 13:47:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40677-05 for ; Wed, 16 Nov 2005 17:47:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id E0BCCDAB82 for ; Wed, 16 Nov 2005 13:47:52 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Wed, 16 Nov 2005 12:47:41 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 16 Nov 2005 12:47:28 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Wed, 16 Nov 2005 12:47:28 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 16 Nov 2005 09:47:26 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" To: "Scott Marlowe" , "William Yu" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXq0SzleDDBZmahTU6pSm6FUY2s3wABKFlI In-Reply-To: <1132160978.3582.64.camel@state.g2switchworks.com> MIME-Version: 1.0 X-OriginalArrivalTime: 16 Nov 2005 17:47:28.0592 (UTC) FILETIME=[CFD84D00:01C5EAD5] X-WSS-ID: 6F65AF2431S12455364-05-01 Content-Type: multipart/alternative; boundary=B_3214979246_23519111 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/287 X-Sequence-Number: 15544 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214979246_23519111 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Scott, On 11/16/05 9:09 AM, "Scott Marlowe" wrote: > The biggest gain is going from 1 to 2 CPUs (real cpus, like the DC > Opterons or genuine dual CPU mobo, not "hyperthreaded"). Part of the > issue isn't just raw CPU processing power. The second CPU allows the > machine to be more responsive because it doesn't have to context switch > as much. >=20 > While I've seen plenty of single CPU servers start to bog under load > running one big query, the dual CPU machines always seem more than just > twice as snappy under similar loads. >=20 I agree, 2 CPUs are better than one in most cases. The discussion was kicked off by the suggestion to get 8 dual core CPUs to process a large database with postgres. Say your decision support query takes 15 minutes to run with one CPU. Add another and it still takes 15 minutes. Add 15 and the same ... OLTP is so different from Business intelligence and Decision Support that very little of this thread=B9s discussion is relevant IMO. The job is to design a system that can process sequential scan as fast as possible and uses all resources (CPUs, mem, disk channels) on each query. Sequential scan is 100x more important than random seeks. Here are the facts so far: * Postgres can only use 1 CPU on each query * Postgres I/O for sequential scan is CPU limited to 110-120 MB/s on the fastest modern CPUs * Postgres disk-based sort speed is 1/10 or more slower than commercial databases and memory doesn=B9t improve it (much) These are the conclusions that follow about decision support / BI system architecture for normal Postgres: * I/O hardware with more than 110MB/s of read bandwidth is not useful * More than 1 CPU is not useful * More RAM than a nominal amount for small table caching is not useful In other words, big SMP doesn=B9t address the problem at all. By contrast, having all CPUs on multiple machines, or even on a big SMP with lots of I/O channels, solves all of the above issues. Regards, - Luke --B_3214979246_23519111 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Scott= ,<BR> <BR> On 11/16/05 9:09 AM, "Scott Marlowe" <smarlowe@g2switchworks.c= om> wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>The biggest gain is going from 1 to 2 CPUs (real cpus, = like the DC<BR> Opterons or genuine dual CPU mobo, not "hyperthreaded").  Pa= rt of the<BR> issue isn't just raw CPU processing power.  The second CPU allows the<= BR> machine to be more responsive because it doesn't have to context switch<BR> as much.<BR> <BR> While I've seen plenty of single CPU servers start to bog under load<BR> running one big query, the dual CPU machines always seem more than just<BR> twice as snappy under similar loads.<BR> <BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'>I agree, 2 CPUs are better than one in most cases.<BR> <BR> The discussion was kicked off by the suggestion to get 8 dual core CPUs to = process a large database with postgres.  Say your decision support quer= y takes 15 minutes to run with one CPU.  Add another and it still takes= 15 minutes.  Add 15 and the same ...<BR> <BR> OLTP is <B>so</B> different from Business intelligence and Decision Support= that very little of this thread’s discussion is relevant IMO.<BR> <BR> The job is to design a system that can process sequential scan as fast as p= ossible and uses all resources (CPUs, mem, disk channels) on each query. &nb= sp;Sequential scan is 100x more important than random seeks.<BR> <BR> Here are the facts so far:<BR> </SPAN></FONT><UL><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'f= ont-size:14.0px'>Postgres can only use 1 CPU on each query </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>Postgres I/O for sequential scan is CPU limited to 110-120 MB/s= on the fastest modern CPUs </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>Postgres disk-based sort speed is 1/10 or more slower than comm= ercial databases and memory doesn’t improve it (much)<BR> </SPAN></FONT></UL><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font= -size:14.0px'><BR> These are the conclusions that follow about decision support / BI system ar= chitecture for normal Postgres:<BR> </SPAN></FONT><UL><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'f= ont-size:14.0px'>I/O hardware with more than 110MB/s of read bandwidth is no= t useful=20 </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>More than 1 CPU is not useful </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>More RAM than a nominal amount for small table caching is not u= seful<BR> </SPAN></FONT></UL><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font= -size:14.0px'><BR> In other words, big SMP doesn’t address the problem at all.  By = contrast, having all CPUs on multiple machines, or even on a big SMP with lo= ts of I/O channels, solves all of the above issues.<BR> <BR> Regards,<BR> <BR> - Luke </SPAN></FONT> </BODY> </HTML> --B_3214979246_23519111-- From pgsql-performance-owner@postgresql.org Wed Nov 16 13:49:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D4A27DB927 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 13:49:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39244-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:49:45 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id E3C56DB92D for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 13:49:43 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Wed, 16 Nov 2005 12:49:41 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 16 Nov 2005 12:49:31 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Wed, 16 Nov 2005 12:49:30 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 16 Nov 2005 09:49:28 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Scott Marlowe" <smarlowe@g2switchworks.com>, "William Yu" <wyu@talisys.com> cc: pgsql-performance@postgresql.org Message-ID: <BFA0B128.13D50%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXq0SzleDDBZmahTU6pSm6FUY2s3wABKFlIAAASLus= In-Reply-To: <BFA0B0AE.13D4E%llonergan@greenplum.com> MIME-Version: 1.0 X-OriginalArrivalTime: 16 Nov 2005 17:49:31.0061 (UTC) FILETIME=[18D79650:01C5EAD6] X-WSS-ID: 6F65AEBF31S12457262-01-01 Content-Type: multipart/alternative; boundary=B_3214979369_23551637 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/288 X-Sequence-Number: 15545 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3214979369_23551637 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Oops, Last point should be worded: =B3All CPUs on all machines used by a parallel database=B2 - Luke=20 On 11/16/05 9:47 AM, "Luke Lonergan" <llonergan@greenplum.com> wrote: > Scott, >=20 > On 11/16/05 9:09 AM, "Scott Marlowe" <smarlowe@g2switchworks.com> wrote: >=20 >> The biggest gain is going from 1 to 2 CPUs (real cpus, like the DC >> Opterons or genuine dual CPU mobo, not "hyperthreaded"). Part of the >> issue isn't just raw CPU processing power. The second CPU allows the >> machine to be more responsive because it doesn't have to context switch >> as much. >>=20 >> While I've seen plenty of single CPU servers start to bog under load >> running one big query, the dual CPU machines always seem more than just >> twice as snappy under similar loads. >>=20 > I agree, 2 CPUs are better than one in most cases. >=20 > The discussion was kicked off by the suggestion to get 8 dual core CPUs t= o > process a large database with postgres. Say your decision support query = takes > 15 minutes to run with one CPU. Add another and it still takes 15 minute= s. > Add 15 and the same ... >=20 > OLTP is so different from Business intelligence and Decision Support that= very > little of this thread=B9s discussion is relevant IMO. >=20 > The job is to design a system that can process sequential scan as fast as > possible and uses all resources (CPUs, mem, disk channels) on each query. > Sequential scan is 100x more important than random seeks. >=20 > Here are the facts so far: > * Postgres can only use 1 CPU on each query > * Postgres I/O for sequential scan is CPU limited to 110-120 MB/s on the > fastest modern CPUs > * Postgres disk-based sort speed is 1/10 or more slower than commercial > databases and memory doesn=B9t improve it (much) >=20 > These are the conclusions that follow about decision support / BI system > architecture for normal Postgres: > * I/O hardware with more than 110MB/s of read bandwidth is not useful > * More than 1 CPU is not useful > * More RAM than a nominal amount for small table caching is not useful >=20 > In other words, big SMP doesn=B9t address the problem at all. By contrast, > having all CPUs on multiple machines, or even on a big SMP with lots of I= /O > channels, solves all of the above issues. >=20 > Regards, >=20 - Luke=20 --B_3214979369_23551637 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Oops,= <BR> <BR> Last point should be worded: “All CPUs on all machines used by a para= llel database”<BR> <BR> - Luke <BR> <BR> <BR> On 11/16/05 9:47 AM, "Luke Lonergan" <llonergan@greenplum.com&= gt; wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>Scott,<BR> <BR> On 11/16/05 9:09 AM, "Scott Marlowe" <smarlowe@g2switchworks.c= om> wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>The biggest gain is going from 1 to 2 CPUs (real cpus, = like the DC<BR> Opterons or genuine dual CPU mobo, not "hyperthreaded").  Pa= rt of the<BR> issue isn't just raw CPU processing power.  The second CPU allows the<= BR> machine to be more responsive because it doesn't have to context switch<BR> as much.<BR> <BR> While I've seen plenty of single CPU servers start to bog under load<BR> running one big query, the dual CPU machines always seem more than just<BR> twice as snappy under similar loads.<BR> <BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'>I agree, 2 CPUs are better than one in most cases.<BR> <BR> The discussion was kicked off by the suggestion to get 8 dual core CPUs to = process a large database with postgres.  Say your decision support quer= y takes 15 minutes to run with one CPU.  Add another and it still takes= 15 minutes.  Add 15 and the same ...<BR> <BR> OLTP is <B>so</B> different from Business intelligence and Decision Support= that very little of this thread’s discussion is relevant IMO.<BR> <BR> The job is to design a system that can process sequential scan as fast as p= ossible and uses all resources (CPUs, mem, disk channels) on each query. &nb= sp;Sequential scan is 100x more important than random seeks.<BR> <BR> Here are the facts so far:<BR> </SPAN></FONT><UL><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'f= ont-size:14.0px'>Postgres can only use 1 CPU on each query=20 </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>Postgres I/O for sequential scan is CPU limited to 110-120 MB/s= on the fastest modern CPUs=20 </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>Postgres disk-based sort speed is 1/10 or more slower than comm= ercial databases and memory doesn’t improve it (much)<BR> </SPAN></FONT></UL><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font= -size:14.0px'><BR> These are the conclusions that follow about decision support / BI system ar= chitecture for normal Postgres:<BR> </SPAN></FONT><UL><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'f= ont-size:14.0px'>I/O hardware with more than 110MB/s of read bandwidth is no= t useful=20 </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>More than 1 CPU is not useful=20 </SPAN></FONT><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-= size:14.0px'>More RAM than a nominal amount for small table caching is not u= seful<BR> </SPAN></FONT></UL><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font= -size:14.0px'><BR> In other words, big SMP doesn’t address the problem at all.  By = contrast, having all CPUs on multiple machines, or even on a big SMP with lo= ts of I/O channels, solves all of the above issues.<BR> <BR> Regards,<BR> <BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'>- Luke <BR> </SPAN></FONT> </BODY> </HTML> --B_3214979369_23551637-- From pgsql-performance-owner@postgresql.org Wed Nov 16 13:54:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06314DB930 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 13:54:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40409-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:54:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 61B8EDB92E for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 13:54:34 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 16 Nov 2005 11:54:34 -0600 Subject: Re: Hardware/OS recommendations for large databases ( From: Scott Marlowe <smarlowe@g2switchworks.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: William Yu <wyu@talisys.com>, pgsql-performance@postgresql.org In-Reply-To: <BFA0B0AE.13D4E%llonergan@greenplum.com> References: <BFA0B0AE.13D4E%llonergan@greenplum.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-Id: <1132163674.3582.81.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 16 Nov 2005 11:54:34 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/289 X-Sequence-Number: 15546 On Wed, 2005-11-16 at 11:47, Luke Lonergan wrote: > Scott, Some cutting for clarity... I agree on the OLTP versus OLAP discussion. =20 > Here are the facts so far: > * Postgres can only use 1 CPU on each query > * Postgres I/O for sequential scan is CPU limited to 110-120 > MB/s on the fastest modern CPUs > * Postgres disk-based sort speed is 1/10 or more slower than > commercial databases and memory doesn=E2=80=99t improve it (much) But PostgreSQL only spills to disk if the data set won't fit into the amount of memory allocated by working_mem / sort_mem. And for most Business analysis stuff, this can be quite large, and you can even crank it up for a single query. =20 I've written reports that were horrifically slow, hitting the disk and all, and I upped sort_mem to hundreds of megabytes until it fit into memory, and suddenly, a slow query is running factors faster than before. Or did you mean something else by "disk base sort speed"??? From pgsql-performance-owner@postgresql.org Wed Nov 16 14:51:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CAC53DBA5E for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 14:51:27 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47324-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 18:51:27 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.193]) by svr1.postgresql.org (Postfix) with ESMTP id F2CAEDBA5B for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 14:51:24 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i30so1732300wxd for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 10:51:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=m5/kr0Fm57JAQ6s3cWuk0qqiJX5zvgX9Qcb1oFKpOsu6Zlj6UQEBP6YvkJ78xusaR4nxvfFqBUs7kCnaCsk8rU+pvWHAl++EThgXC4fot4ew9fIKXMXiW063OXp009BPUZXhNuUyNMFHXg5AvjHjWKPMn2OnALhHPMYl+IfMong= Received: by 10.70.60.17 with SMTP id i17mr4174899wxa; Wed, 16 Nov 2005 10:51:25 -0800 (PST) Received: by 10.70.126.9 with HTTP; Wed, 16 Nov 2005 10:51:25 -0800 (PST) Message-ID: <f3c0b4080511161051t514b1bd0o8ebe0f5dab6b591b@mail.gmail.com> Date: Wed, 16 Nov 2005 12:51:25 -0600 From: Matthew Nuzum <mattnuzum@gmail.com> Reply-To: newz@bearfruit.org To: David Boreham <david_list@boreham.org> Subject: Re: Hardware/OS recommendations for large databases ( Cc: pgsql-performance@postgresql.org In-Reply-To: <437B4773.1040404@boreham.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/290 X-Sequence-Number: 15547 On 11/16/05, David Boreham <david_list@boreham.org> wrote: > >Spend a fortune on dual core CPUs and then buy crappy disks... I bet > >for most applications this system will be IO bound, and you will see a > >nice lot of drive failures in the first year of operation with > >consumer grade drives. > > I guess I've never bought into the vendor story that there are > two reliability grades. Why would they bother making two > different kinds of bearing, motor etc ? Seems like it's more > likely an excuse to justify higher prices. In my experience the > expensive SCSI drives I own break frequently while the cheapo > desktop drives just keep chunking along (modulo certain products > that have a specific known reliability problem). > > I'd expect that a larger number of hotter drives will give a less reliabl= e > system than a smaller number of cooler ones. Of all the SCSI and IDE drives I've used, and I've used a lot, there is a definite difference in quality. The SCSI drives primarily use higher quality components that are intended to last longer under 24/7 work loads. I've taken several SCSI and IDE drives apart and you can tell from the guts that the SCSI drives are built with sturdier components. I haven't gotten my hands on the Raptor line of ATA drives yet, but I've heard they share this in common with the SCSI drives - they are built with components made to be used day and night for years straight without ending. That doesn't mean they will last longer than IDE drives, that just means they've been designed to withstand higher amounts of heat and sustained activity. I've got some IDE drives that have lasted years++ and I've got some IDE drives that have lasted months. However, my SCSI drives I've had over the years all lasted longer than the server they were installed in. I will say that in the last 10 years, the MTBF of IDE/ATA drives has improved dramatically, so I regularly use them in servers, however I have also shifted my ideology so that a server should be replaced after 3 years, where before I aimed for 5. It seems to me that the least reliable components in servers these days are the fans. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Wed Nov 16 14:52:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 13154DBA75 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 14:52:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48805-01-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 18:52:06 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 1AD6EDBA71 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 14:52:03 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EcSO0-0000tl-UB for pgsql-performance@postgresql.org; Wed, 16 Nov 2005 19:52:02 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EcSNe-0005xF-00 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 19:51:38 +0100 Date: Wed, 16 Nov 2005 19:51:38 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( Message-ID: <20051116185138.GA22831@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> <1132160785.3582.60.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1132160785.3582.60.camel@state.g2switchworks.com> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/291 X-Sequence-Number: 15548 On Wed, Nov 16, 2005 at 11:06:25AM -0600, Scott Marlowe wrote: > There was a big commercial EMC style array in the hosting center at the > same place that had something like a 16 wide by 16 tall array of IDE > drives for storing pdf / tiff stuff on it, and we had at least one > failure a month in it. Of course, that's 256 drives, so you're gonna > have failures, and it was configured with a spare on every other row or > some such. We just had a big box of hard drives and it was smart enough > to rebuild automagically when you put a new one in, so the maintenance > wasn't really that bad. The performance was quite impressive too. If you have a cool SAN, it alerts you and removes all data off a disk _before_ it starts giving hard failures :-) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Nov 16 15:03:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3531DB932 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 15:03:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49534-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 19:03:48 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.201]) by svr1.postgresql.org (Postfix) with ESMTP id 1C01CDB925 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 15:03:45 -0400 (AST) Received: by xproxy.gmail.com with SMTP id i30so1734894wxd for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 11:03:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bXuaSXVU2AfFouEiKRoOUCJHXAGyR3LCUHn5NIWhm8XbzneNfungoaoTTRQG+L+6uZSCARsTuzRX2sBpesqHhHC3iGJZfPqGp5ExE5UbWyrkvk9Bd1ZMSgiacHJ++K22pSNqYCqTKiIINa4KUb8zk2feQo7r62smmmoZ1/yuq60= Received: by 10.70.54.15 with SMTP id c15mr4179022wxa; Wed, 16 Nov 2005 11:03:46 -0800 (PST) Received: by 10.70.126.9 with HTTP; Wed, 16 Nov 2005 11:03:46 -0800 (PST) Message-ID: <f3c0b4080511161103j7677939bldf1c55b137ce9741@mail.gmail.com> Date: Wed, 16 Nov 2005 13:03:46 -0600 From: Matthew Nuzum <mattnuzum@gmail.com> Reply-To: newz@bearfruit.org To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <20051116185138.GA22831@uio.no> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> <1132160785.3582.60.camel@state.g2switchworks.com> <20051116185138.GA22831@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.666 required=5 tests=[AWL=-0.666, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.666 X-Spam-Level: X-Archive-Number: 200511/292 X-Sequence-Number: 15549 On 11/16/05, Steinar H. Gunderson <sgunderson@bigfoot.com> wrote: > If you have a cool SAN, it alerts you and removes all data off a disk > _before_ it starts giving hard failures :-) > > /* Steinar */ > -- > Homepage: http://www.sesse.net/ Good point. I have avoided data loss *twice* this year by using SMART hard drive monitoring software. I can't tell you how good it feels to replace a drive that is about to die, as compared to restoring data because a drive died. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Wed Nov 16 15:24:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 936A9D7763 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 15:24:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52007-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 19:24:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id C04B4D709D for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 15:24:37 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id E4B9BB80A for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 14:24:38 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <b41c75520511150028o553e6bb5j@mail.gmail.com> References: <1B80C974ABFB23429A403B6667FE84C71066E8@seiumain.SEIU.local> <b41c75520511150028o553e6bb5j@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <D1ABFA1F-FEB0-4E01-BC2E-482535A5DB28@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera <vivek@khera.org> Subject: Re: Hardware/OS recommendations for large databases (5TB) Date: Wed, 16 Nov 2005 14:24:38 -0500 To: Postgresql Performance <pgsql-performance@postgresql.org> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/295 X-Sequence-Number: 15552 On Nov 15, 2005, at 3:28 AM, Claus Guttesen wrote: > Hardware-wise I'd say dual core opterons. One dual-core-opteron > performs better than two single-core at the same speed. Tyan makes at 5TB data, i'd vote that the application is disk I/O bound, and the difference in CPU speed at the level of dual opteron vs. dual-core opteron is not gonna be noticed. to maximize disk, try getting a dedicated high-end disk system like nstor or netapp file servers hooked up to fiber channel, then use a good high-end fiber channel controller like one from LSI. and go with FreeBSD amd64 port. It is *way* fast, especially the FreeBSD 6.0 disk system. From pgsql-www-owner@postgresql.org Wed Nov 16 16:18:59 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5D88FD87A0; Wed, 16 Nov 2005 16:00:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37655-03; Wed, 16 Nov 2005 20:00:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by svr1.postgresql.org (Postfix) with ESMTP id 5466AD860D; Wed, 16 Nov 2005 16:00:26 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.200.148]) by smtp.nildram.co.uk (Postfix) with ESMTP id 878AF25336B; Wed, 16 Nov 2005 20:00:23 +0000 (GMT) Subject: Re: [PERFORM] Help speeding up delete From: Simon Riggs <simon@2ndquadrant.com> To: pgsql-www@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us> Cc: Steve Wampler <swampler@noao.edu>, Postgres-performance <pgsql-performance@postgresql.org> In-Reply-To: <4162.1132011763@sss.pgh.pa.us> References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> Content-Type: text/plain Date: Wed, 16 Nov 2005 20:00:06 +0000 Message-Id: <1132171206.4959.60.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 (2.2.2-5) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/105 X-Sequence-Number: 8820 On Mon, 2005-11-14 at 18:42 -0500, Tom Lane wrote: > Steve Wampler <swampler@noao.edu> writes: > > We've got an older system in production (PG 7.2.4). > > Update to 7.4 or later ;-) > > Quite seriously, if you're still using 7.2.4 for production purposes > you could justifiably be accused of negligence. There are three or four > data-loss-grade bugs fixed in the later 7.2.x releases, not to mention > security holes; and that was before we abandoned support for 7.2. > You *really* need to be thinking about an update. Perhaps we should put a link on the home page underneath LATEST RELEASEs saying 7.2: de-supported with a link to a scary note along the lines of the above. ISTM that there are still too many people on older releases. We probably need an explanation of why we support so many releases (in comparison to licenced software) and a note that this does not imply the latest releases are not yet production (in comparison to MySQL or Sybase who have been in beta for a very long time). Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Nov 16 16:09:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3579ED8CA0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 16:09:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37656-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 20:09:22 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 761ACD8B2D for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 16:09:19 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 16 Nov 2005 14:08:03 -0600 Subject: Re: Hardware/OS recommendations for large databases ( From: Scott Marlowe <smarlowe@g2switchworks.com> To: "Steinar H. Gunderson" <sgunderson@bigfoot.com> Cc: pgsql-performance@postgresql.org In-Reply-To: <20051116185138.GA22831@uio.no> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> <1132160785.3582.60.camel@state.g2switchworks.com> <20051116185138.GA22831@uio.no> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132171683.3582.85.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 16 Nov 2005 14:08:03 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/297 X-Sequence-Number: 15554 On Wed, 2005-11-16 at 12:51, Steinar H. Gunderson wrote: > On Wed, Nov 16, 2005 at 11:06:25AM -0600, Scott Marlowe wrote: > > There was a big commercial EMC style array in the hosting center at the > > same place that had something like a 16 wide by 16 tall array of IDE > > drives for storing pdf / tiff stuff on it, and we had at least one > > failure a month in it. Of course, that's 256 drives, so you're gonna > > have failures, and it was configured with a spare on every other row or > > some such. We just had a big box of hard drives and it was smart enough > > to rebuild automagically when you put a new one in, so the maintenance > > wasn't really that bad. The performance was quite impressive too. > > If you have a cool SAN, it alerts you and removes all data off a disk > _before_ it starts giving hard failures :-) Yeah, I forget who made the unit we used, but it was pretty much fully automated. IT was something like a large RAID 5+0 (0+5???) and would send an alert when a drive died or started getting errors, and the bad drive's caddy would be flashing read instead of steady green. I just remember thinking that I'd never used a drive array that was taller than I was before that. From pgsql-performance-owner@postgresql.org Wed Nov 16 19:25:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18F1ED8930 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 19:25:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64276-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 23:25:10 +0000 (GMT) X-Greylist: delayed 03:02:46.857118 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 92568D6853 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 19:25:05 -0400 (AST) Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) by svr2.postgresql.org (Postfix) with ESMTP id C9F8EF0B3E for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 20:22:18 +0000 (GMT) Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) by olive.qinip.net (Postfix) with ESMTP id 7D86A180F9; Wed, 16 Nov 2005 21:22:11 +0100 (MET) Message-ID: <437B94F9.20306@tweakers.net> Date: Wed, 16 Nov 2005 21:22:17 +0100 From: Arjen van der Meijden <acmmailing@tweakers.net> User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: Steve Wampler <swampler@noao.edu> Cc: Postgres-performance <pgsql-performance@postgresql.org> Subject: Re: Help speeding up delete References: <6BCB9D8A16AC4241919521715F4D8BCE6C7BC4@algol.sollentuna.se> <4379EE24.8000504@noao.edu> In-Reply-To: <4379EE24.8000504@noao.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0546-3, 16-11-2005), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/306 X-Sequence-Number: 15563 On 15-11-2005 15:18, Steve Wampler wrote: > Magnus Hagander wrote: > (This is after putting an index on the (id,name,value) tuple.) That outer seq scan > is still annoying, but maybe this will be fast enough. > > I've passed this on, along with the (strong) recommendation that they > upgrade PG. Have you tried with an index on (name,value) and of course one on id ? Best regards, Arjen From pgsql-performance-owner@postgresql.org Wed Nov 16 16:29:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36D19D8D8F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 16:29:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40154-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 20:29:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 547E9D818A for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 16:29:46 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21676021; Wed, 16 Nov 2005 13:29:44 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAGKTiGI025161; Wed, 16 Nov 2005 13:29:44 -0700 Message-ID: <437B96B8.2090302@noao.edu> Date: Wed, 16 Nov 2005 13:29:44 -0700 From: Steve Wampler <swampler@noao.edu> User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Arjen van der Meijden <acmmailing@tweakers.net> CC: Postgres-performance <pgsql-performance@postgresql.org> Subject: Re: Help speeding up delete References: <6BCB9D8A16AC4241919521715F4D8BCE6C7BC4@algol.sollentuna.se> <4379EE24.8000504@noao.edu> <437B94F9.20306@tweakers.net> In-Reply-To: <437B94F9.20306@tweakers.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/298 X-Sequence-Number: 15555 Arjen van der Meijden wrote: > On 15-11-2005 15:18, Steve Wampler wrote: > >> Magnus Hagander wrote: >> (This is after putting an index on the (id,name,value) tuple.) That >> outer seq scan >> is still annoying, but maybe this will be fast enough. >> >> I've passed this on, along with the (strong) recommendation that they >> upgrade PG. > > > Have you tried with an index on (name,value) and of course one on id ? Yes, although not with a unique index on (name,value) [possible, but not so on the just-id index]. Anyway, it turns out the latest incarnation is 'fast enough' for the user's need, so she's not doing any more with it until after an upgrade. -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Wed Nov 16 16:57:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 124B4D6FF4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 16:57:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44455-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 20:57:29 +0000 (GMT) X-Greylist: delayed 06:58:24.754511 by SQLgrey- Received: from smtpauth08.mail.atl.earthlink.net (smtpauth08.mail.atl.earthlink.net [209.86.89.68]) by svr1.postgresql.org (Postfix) with ESMTP id EA752D6853 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 16:57:25 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=IyQVBvmo9g7DS696otlWwMya3P1K7B2wy0x7ctgy8UcItbyoLypGKR7ridMWZWCI; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.226.16] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth08.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EcULM-0001Lq-Tu; Wed, 16 Nov 2005 15:57:25 -0500 Message-Id: <6.2.5.6.0.20051116154502.01c41f50@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Wed, 16 Nov 2005 15:57:20 -0500 To: Alex Turner <armtuk@gmail.com>,pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <33c6269f0511160908s5c432ee2r82f78598b8f5d036@mail.gmail.co m> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <B41A9E46-AC4F-4A3A-B383-AB70091745CF@fastcrypt.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> <6.2.5.6.0.20051116083943.01be0b98@earthlink.net> <33c6269f0511160908s5c432ee2r82f78598b8f5d036@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc57020ef3721c0cf8c22e08205296a0c7350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.226.16 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/299 X-Sequence-Number: 15556 You _ARE_ kidding right? In what hallucination? The performance numbers for the 1GB cache version of the Areca 1160 are the _grey_ line in the figures, and were added after the original article was published: "Note: Since the original Dutch article was published in late January, we have finished tests of the 16-port Areca ARC-1160 using 128MB, 512MB and 1GB cache configurations and RAID 5 arrays of up to 12 drives. The ARC-1160 was using the latest 1.35 beta firmware. The performance graphs have been updated to include the ARC-1160 results. Discussions of the results have not been updated, however. " With 1GB of cache, the 1160's beat everything else in almost all of the tests they participated in. For the few where they do not win hands down, the Escalade's (very occasionally) essentially tie. These are very easy to read full color graphs where higher is better and the grey line representing the 1GB 1160's is almost always higher on the graph than anything else. Granted the Escalades seem to give them the overall best run for their money, but they still are clearly second best when looking at all the graphs and the CPU utilization numbers in aggregate. Ron At 12:08 PM 11/16/2005, Alex Turner wrote: >Yes - that very benchmark shows that for a MySQL Datadrive in RAID 10, >the 3ware controllers beat the Areca card. > >Alex. > >On 11/16/05, Ron <rjpeace@earthlink.net> wrote: > > Got some hard numbers to back your statement up? IME, the Areca > > 1160's with >= 1GB of cache beat any other commodity RAID > > controller. This seems to be in agreement with at least one > > independent testing source: > > > > http://print.tweakers.net/?reviews/557 > > > > RAID HW from Xyratex, Engino, or Dot Hill will _destroy_ any > > commodity HW solution, but their price point is considerably higher. > > > > ...on another note, I completely agree with the poster who says we > > need more cache on RAID controllers. We should all be beating on the > > RAID HW manufacturers to use standard DIMMs for their caches and to > > provide 2 standard DIMM slots in their full height cards (allowing > > for up to 8GB of cache using 2 4GB DIMMs as of this writing). > > > > It should also be noted that 64 drive chassis' are going to become > > possible once 2.5" 10Krpm SATA II and FC HDs become the standard next > > year (48's are the TOTL now). We need controller technology to keep up. > > > > Ron > > > > At 12:16 AM 11/16/2005, Alex Turner wrote: > > >Not at random access in RAID 10 they aren't, and anyone with their > > >head screwed on right is using RAID 10. The 9500S will still beat the > > >Areca cards at RAID 10 database access patern. > > > > > >Alex. > > > > > >On 11/15/05, Dave Cramer <pg@fastcrypt.com> wrote: > > > > Luke, > > > > > > > > Have you tried the areca cards, they are slightly faster yet. > > > > > > > > Dave > > > > > > > > On 15-Nov-05, at 7:09 AM, Luke Lonergan wrote: > > > > > > > > > > > > > > > > > > > > > > > > I agree - you can get a very good one from www.acmemicro.com or > > > > > > > > www.rackable.com with 8x 400GB SATA disks and the new 3Ware 9550SX SATA > > > > > > > > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM > > > > > > > > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read > > > > > > > > performance on these (with tuning) on Linux using the xfs filesystem, > > > > > > > > which is one of the most critical factors for large databases. > > > > > > > > > > > > > > > > > > > > Note that you want to have your DBMS use all of the CPU and > disk channel > > > > > > > > bandwidth you have on each query, which takes a parallel database like > > > > > > > > Bizgres MPP to achieve. > > > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > > >---------------------------(end of broadcast)--------------------------- > > >TIP 2: Don't 'kill -9' the postmaster > > > > > > > > From pgsql-performance-owner@postgresql.org Wed Nov 16 17:01:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 90BAFD6D50 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:01:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45249-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 21:01:57 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 0CFFCD6D16 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 17:01:53 -0400 (AST) Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by svr2.postgresql.org (Postfix) with ESMTP id 858EDF0B58 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 21:01:55 +0000 (GMT) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jAGLADiV015144 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 13:10:13 -0800 Message-ID: <437B9DA9.2030806@modgraph-usa.com> Date: Wed, 16 Nov 2005 12:59:21 -0800 From: "Craig A. James" <cjames@modgraph-usa.com> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Perl DBD and an alarming problem References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> In-Reply-To: <1132136225.5711.4.camel@Panoramix> Content-Type: text/plain; charset=ISO-8859-13; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.189 required=5 tests=[MISSING_HEADERS=0.189] X-Spam-Score: 0.189 X-Spam-Level: X-Archive-Number: 200511/300 X-Sequence-Number: 15557 I am mystified by the behavior of "alarm" in conjunction with Postgres/perl/DBD. Here is roughly what I'm doing: eval { local $SIG{ALRM} = sub {die("Timeout");}; $time = gettimeofday; alarm 20; $sth = $dbh->prepare("a query that may take a long time..."); $sth->execute(); alarm 0; }; if ($@ && $@ =~ /Timeout/) { my $elapsed = gettimeofday - $time; print "Timed out after $elapsed seconds"; } Now the mystery: It works, but it hardly matters what time I use for the alarm call, the actual alarm event always happens at 26 seconds. I can set "alarm 1" or "alarm 20", and it almost always hits right at 26 seconds. Now if I increase alarm to anything in the range of about 25-60 seconds, the actual alarm arrives somewhere around the 90 second mark. It seems as though there are "windows of opportunity" for the alarm, and it is ignored until those "windows" arrive. Anyone have a clue what's going on and/or how I can fix it? A secondary question: It appears that $sth->cancel() is not implemented in the Pg DBD module. Is that true? Thanks, Craig From pgsql-performance-owner@postgresql.org Wed Nov 16 17:36:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EA829D6FCB for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:36:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54651-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 21:36:12 +0000 (GMT) X-Greylist: delayed 00:32:32.360955 by SQLgrey- Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41]) by svr1.postgresql.org (Postfix) with ESMTP id 3CACBD6D16 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 17:36:09 -0400 (AST) Received: (from www@localhost) by mail0.rawbw.com (8.11.6p2/8.11.6) id jAGL3bE15914 for pgsql-performance@postgresql.org; Wed, 16 Nov 2005 13:03:37 -0800 (PST) Received: from cybs-gw.ic3.com (cybs-gw.ic3.com [66.185.177.10]) by webmail.rawbw.com (IMP) with HTTP for <mudfoot@shell.rawbw.com>; Wed, 16 Nov 2005 13:03:37 -0800 Message-ID: <1132175017.437b9ea9e33e2@webmail.rawbw.com> Date: Wed, 16 Nov 2005 13:03:37 -0800 From: mudfoot@rawbw.com To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> <1132160785.3582.60.camel@state.g2switchworks.com> <20051116185138.GA22831@uio.no> <1132171683.3582.85.camel@state.g2switchworks.com> In-Reply-To: <1132171683.3582.85.camel@state.g2switchworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Originating-IP: 66.185.177.10 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.55 required=5 tests=[NO_REAL_NAME=0.55] X-Spam-Score: 0.55 X-Spam-Level: X-Archive-Number: 200511/303 X-Sequence-Number: 15560 Yeah those big disks arrays are real sweet. One day last week I was in a data center in Arizona when the big LSI/Storagetek array in the cage next to mine had a hard drive failure. So the alarm shrieked at like 13225535 decibles continuously for hours. BEEEP BEEEEP BEEEEP BEEEEP. Of course since this was a colo facility it wasn't staffed on site by the idiots who own the array. BEEEEP BEEEEEEEP BEEEEEEEP for hours. So I had to stand next to this thing--only separated by a few feet and a little wire mesh--while it shrieked for hours until a knuckle-dragger arrived on site to swap the drive. Yay. So if you're going to get a fancy array (they're worth it if somebody else is paying) then make sure to *turn off the @#%@#SF'ing audible alarm* if you deploy it in a colo facility. Quoting Scott Marlowe <smarlowe@g2switchworks.com>: > On Wed, 2005-11-16 at 12:51, Steinar H. Gunderson wrote: > > On Wed, Nov 16, 2005 at 11:06:25AM -0600, Scott Marlowe wrote: > > > There was a big commercial EMC style array in the hosting center at the > > > same place that had something like a 16 wide by 16 tall array of IDE > > > drives for storing pdf / tiff stuff on it, and we had at least one > > > failure a month in it. Of course, that's 256 drives, so you're gonna > > > have failures, and it was configured with a spare on every other row or > > > some such. We just had a big box of hard drives and it was smart > enough > > > to rebuild automagically when you put a new one in, so the maintenance > > > wasn't really that bad. The performance was quite impressive too. > > > > If you have a cool SAN, it alerts you and removes all data off a disk > > _before_ it starts giving hard failures :-) > > Yeah, I forget who made the unit we used, but it was pretty much fully > automated. IT was something like a large RAID 5+0 (0+5???) and would > send an alert when a drive died or started getting errors, and the bad > drive's caddy would be flashing read instead of steady green. > > I just remember thinking that I'd never used a drive array that was > taller than I was before that. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Wed Nov 16 17:04:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 686A6D6853 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:04:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46778-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 21:04:48 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 59E5BD8CA0 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 17:04:44 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id C8C0731058; Wed, 16 Nov 2005 22:04:45 +0100 (MET) From: Ron Mayer <rm_pg@cheapcomplexdevices.com> X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Wed, 16 Nov 2005 13:08:58 -0800 Organization: Hub.Org Networking Services Lines: 42 Message-ID: <437B9FEA.5010003@cheapcomplexdevices.com> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <437B3B18.1040509@commandprompt.com> <437B4773.1040404@boreham.org> <dlfjuk$9n9$1@news.hub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org To: William Yu <wyu@talisys.com> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <dlfjuk$9n9$1@news.hub.org> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/301 X-Sequence-Number: 15558 William Yu wrote: > > Our SCSI drives have failed maybe a little less than our IDE drives. Microsoft in their database showcase terraserver project has had the same experience. They studied multiple configurations including a SCSI/SAN solution as well as a cluster of SATA boxes. They measured a 6.4% average annual failure rate of their SATA version and a 5.5% average annual failure rate on their SCSI implementation. ftp://ftp.research.microsoft.com/pub/tr/TR-2004-107.pdf "We lost 9 drives out of 140 SATA drives on the Web and Storage Bricks in one year. This is a 6.4% annual failure rate. In contrast, the Compaq Storageworks SAN and Web servers lost approximately 32 drives in three years out of a total of 194 drives.13 This is a 5.5% annual failure rate. The failure rates indicate that SCSI drives are more reliable than SATA. SATA drives are substantially cheaper than SCSI drives. Because the SATA failure rate is so close to the SCSI failure rate gives SATA a substantial return on investment advantage." So unless your system is extremely sensitive to single drive failures, the difference is pretty small. And for the cost it seems you can buy enough extra spindles of SATA drives to easily make up for the performance difference. > Basically, I've found it's cooling that's most important. Packing the > drives together into really small rackmounts? Good for your density, not > good for the drives. Indeed that was their guess for their better-than-expected life of their SATA drives as well. From the same paper: "We were careful about disk cooling � SATA drives are rarely cooled with the same care that a SCSI array receives." From pgsql-performance-owner@postgresql.org Wed Nov 16 17:21:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B7FAD87A0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:21:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47471-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 21:21:32 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by svr1.postgresql.org (Postfix) with ESMTP id CE71CD7718 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 17:21:28 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=bvgIjQuqKqXUdqZ45KE6Dqeffk01hObKDaZUDmNvlX2YPy0Hsvy+hAgPAmbBDdRv; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.226.16] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EcUif-0007p6-TG; Wed, 16 Nov 2005 16:21:30 -0500 Message-Id: <6.2.5.6.0.20051116161052.03d54a70@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Wed, 16 Nov 2005 16:21:25 -0500 To: Alex Turner <armtuk@gmail.com>,pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <6.2.5.6.0.20051116154502.01c41f50@earthlink.net> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <B41A9E46-AC4F-4A3A-B383-AB70091745CF@fastcrypt.com> <33c6269f0511152116s4483af82s91c711b1b902da14@mail.gmail.com> <6.2.5.6.0.20051116083943.01be0b98@earthlink.net> <33c6269f0511160908s5c432ee2r82f78598b8f5d036@mail.gmail.com> <6.2.5.6.0.20051116154502.01c41f50@earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcf0cd1e4a07881175fee78a105238f226350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.226.16 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/302 X-Sequence-Number: 15559 Amendment: there are graphs where the 1GB Areca 1160's do not do as well. Given that they are mySQL specific and that similar usage scenarios not involving mySQL (as well as most of the usage scenarios involving mySQL; as I said these did not follow the pattern of the rest of the benchmarks) show the usual pattern of the 1GB 1160's in 1st place or tied for 1st place, it seems reasonable that mySQL has something to due with the aberrant results in those 2 (IIRC) cases. Ron At 03:57 PM 11/16/2005, Ron wrote: >You _ARE_ kidding right? In what hallucination? > >The performance numbers for the 1GB cache version of the Areca 1160 >are the _grey_ line in the figures, and were added after the >original article was published: > >"Note: Since the original Dutch article was published in late >January, we have finished tests of the 16-port Areca ARC-1160 using >128MB, 512MB and 1GB cache configurations and RAID 5 arrays of up to >12 drives. The ARC-1160 was using the latest 1.35 beta firmware. The >performance graphs have been updated to include the ARC-1160 >results. Discussions of the results have not been updated, however. " > >With 1GB of cache, the 1160's beat everything else in almost all of >the tests they participated in. For the few where they do not win >hands down, the Escalade's (very occasionally) essentially tie. > >These are very easy to read full color graphs where higher is better >and the grey line representing the 1GB 1160's is almost always >higher on the graph than anything else. Granted the Escalades seem >to give them the overall best run for their money, but they still >are clearly second best when looking at all the graphs and the CPU >utilization numbers in aggregate. > >Ron > > > >At 12:08 PM 11/16/2005, Alex Turner wrote: >>Yes - that very benchmark shows that for a MySQL Datadrive in RAID 10, >>the 3ware controllers beat the Areca card. >> >>Alex. >> >>On 11/16/05, Ron <rjpeace@earthlink.net> wrote: >> > Got some hard numbers to back your statement up? IME, the Areca >> > 1160's with >= 1GB of cache beat any other commodity RAID >> > controller. This seems to be in agreement with at least one >> > independent testing source: >> > >> > http://print.tweakers.net/?reviews/557 >> > >> > RAID HW from Xyratex, Engino, or Dot Hill will _destroy_ any >> > commodity HW solution, but their price point is considerably higher. >> > >> > ...on another note, I completely agree with the poster who says we >> > need more cache on RAID controllers. We should all be beating on the >> > RAID HW manufacturers to use standard DIMMs for their caches and to >> > provide 2 standard DIMM slots in their full height cards (allowing >> > for up to 8GB of cache using 2 4GB DIMMs as of this writing). >> > >> > It should also be noted that 64 drive chassis' are going to become >> > possible once 2.5" 10Krpm SATA II and FC HDs become the standard next >> > year (48's are the TOTL now). We need controller technology to keep up. >> > >> > Ron >> > >> > At 12:16 AM 11/16/2005, Alex Turner wrote: >> > >Not at random access in RAID 10 they aren't, and anyone with their >> > >head screwed on right is using RAID 10. The 9500S will still beat the >> > >Areca cards at RAID 10 database access patern. >> > > >> > >Alex. >> > > >> > >On 11/15/05, Dave Cramer <pg@fastcrypt.com> wrote: >> > > > Luke, >> > > > >> > > > Have you tried the areca cards, they are slightly faster yet. >> > > > >> > > > Dave >> > > > >> > > > On 15-Nov-05, at 7:09 AM, Luke Lonergan wrote: >> > > > >> > > > >> > > > >> > > > >> > > > >> > > > I agree - you can get a very good one from www.acmemicro.com or >> > > > >> > > > www.rackable.com with 8x 400GB SATA disks and the new 3Ware >> 9550SX SATA >> > > > >> > > > RAID controller for about $6K with two Opteron 272 CPUs and 8GB of RAM >> > > > >> > > > on a Tyan 2882 motherboard. We get about 400MB/s sustained disk read >> > > > >> > > > performance on these (with tuning) on Linux using the xfs filesystem, >> > > > >> > > > which is one of the most critical factors for large databases. >> > > > >> > > > >> > > > >> > > > >> > > > Note that you want to have your DBMS use all of the CPU and >> disk channel >> > > > >> > > > bandwidth you have on each query, which takes a parallel database like >> > > > >> > > > Bizgres MPP to achieve. >> > > > >> > > > >> > > > >> > > > >> > > > Regards, >> > > > >> > > >> > >---------------------------(end of broadcast)--------------------------- >> > >TIP 2: Don't 'kill -9' the postmaster >> > >> > >> > >> > > > > From pgsql-performance-owner@postgresql.org Wed Nov 16 17:50:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38596D7061 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 17:50:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55933-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 21:50:21 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by svr1.postgresql.org (Postfix) with ESMTP id A2217D6853 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 17:50:17 -0400 (AST) Received: by zproxy.gmail.com with SMTP id z3so1522319nzf for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 13:50:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rCEIW+23z9LTiVtRKoN3nfjvAtYxqcYJaLpCNTL0fUSTSBBJ3eV3RciZ5fT+YcMuzR7VSTMYe4HrgkzeZ2+S+e/9reff5bB4PiBHgDK7TOJ/TRzKG1fJgEJ5A46+D4kR9dH7oryXiKeCSBzMXYl9pPqT4DoFXOw82NZgCcM4gFA= Received: by 10.64.142.16 with SMTP id p16mr1307149qbd; Wed, 16 Nov 2005 13:50:19 -0800 (PST) Received: by 10.65.192.16 with HTTP; Wed, 16 Nov 2005 13:50:19 -0800 (PST) Message-ID: <b41c75520511161350u3ed6f4b1x@mail.gmail.com> Date: Wed, 16 Nov 2005 22:50:19 +0100 From: Claus Guttesen <kometen@gmail.com> To: Vivek Khera <vivek@khera.org> Subject: Re: Hardware/OS recommendations for large databases (5TB) Cc: Postgresql Performance <pgsql-performance@postgresql.org> In-Reply-To: <D1ABFA1F-FEB0-4E01-BC2E-482535A5DB28@khera.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1B80C974ABFB23429A403B6667FE84C71066E8@seiumain.SEIU.local> <b41c75520511150028o553e6bb5j@mail.gmail.com> <D1ABFA1F-FEB0-4E01-BC2E-482535A5DB28@khera.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/304 X-Sequence-Number: 15561 > at 5TB data, i'd vote that the application is disk I/O bound, and the > difference in CPU speed at the level of dual opteron vs. dual-core > opteron is not gonna be noticed. > > to maximize disk, try getting a dedicated high-end disk system like > nstor or netapp file servers hooked up to fiber channel, then use a > good high-end fiber channel controller like one from LSI. > > and go with FreeBSD amd64 port. It is *way* fast, especially the > FreeBSD 6.0 disk system. I'm (also) FreeBSD-biased but I'm not shure whether the 5 TB fs will work so well if tools like fsck are needed. Gvinum could be one option but I don't have any experience in that area. regards Claus From pgsql-performance-owner@postgresql.org Wed Nov 16 18:59:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D14E4D88AB for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 18:59:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64017-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 22:59:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.clickdiario.com (mail.clickdiario.com [70.85.167.114]) by svr1.postgresql.org (Postfix) with ESMTP id 4EAE9D6D16 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 18:59:23 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.clickdiario.com (Postfix) with ESMTP id BF91F10005; Wed, 16 Nov 2005 17:06:45 -0600 (CST) Received: from mail.clickdiario.com ([127.0.0.1]) by localhost (mail.clickdiario.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08481-04; Wed, 16 Nov 2005 17:06:45 -0600 (CST) Received: by mail.clickdiario.com (Postfix, from userid 5001) id A583710064; Wed, 16 Nov 2005 17:06:45 -0600 (CST) Received: from cristian1 (unknown [216.230.131.226]) by mail.clickdiario.com (Postfix) with ESMTP id 70C6610005; Wed, 16 Nov 2005 17:06:44 -0600 (CST) From: "Cristian Prieto" <cristian@clickdiario.com> To: <pgpool-general@pgfoundry.org>, <pgsql-performance@postgresql.org> Subject: PgPool and Postgresql sessions... Date: Wed, 16 Nov 2005 16:56:42 -0600 Message-ID: <007601c5eb01$04436ef0$6500a8c0@gt.ClickDiario.local> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcXrAQKifZg6wAaXRHeJ1yGHR0sMdw== X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/305 X-Sequence-Number: 15562 Hi, I just have a little question, does PgPool keeps the same session between different connections? I say it cuz I have a server with the following specifications: P4 3.2 ghz 80 gig sata drives x 2 1 gb ram 5 ips 1200 gb bandwidth 100 mbit/s port speed. I am running a PgSQL 8.1 server with 100 max connection, pgpool with num_init_children = 25 and max_pool = 4. I do the same queries all the time (just a bunch of sps, but they are always the same). Using explain analyze I get the fact that the sps are using a lot of time the first time they execute (I guess preparing the plan and the sps I wrote en plpgsql) so I would like to reuse the session the most possible. I need to serve 10M of connection per day. Is this possible? (the client is a webapplication, I repeat again, the queries are always the same). Thanks a lot for your help... From pgsql-performance-owner@postgresql.org Wed Nov 16 19:30:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99749D6FF4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 19:30:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64772-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 23:30:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 65E7FD9177 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 19:30:41 -0400 (AST) Received: (qmail 6623 invoked from network); 16 Nov 2005 23:30:44 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 16 Nov 2005 23:30:44 -0000 From: "Greg Sabino Mullane" <greg@turnstep.com> To: pgsql-performance@postgresql.org Subject: Re: Perl DBD and an alarming problem X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <437B9DA9.2030806@modgraph-usa.com> Date: Wed, 16 Nov 2005 23:30:44 -0000 X-Mailer: JoyMail 1.48 Message-ID: <b61d71c1a4056df4bd92b29656c2f16a@biglumber.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/307 X-Sequence-Number: 15564 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I am mystified by the behavior of "alarm" in conjunction with > Postgres/perl/DBD. Here is roughly what I'm doing: > Anyone have a clue what's going on and/or how I can fix it? Not really, but alarm has never worked well (or claimed to) with DBI. The DBI docs recommend trying out Sys::Sigaction: http://search.cpan.org/~lbaxter/Sys-SigAction/ > A secondary question: It appears that $sth->cancel() is not > implemented in the Pg DBD module. Is that true? Correct. DBD::Pg does not support asynchronous connections. It's possible it may in the future, but there has not been much of a perceived need. Feel free to enter a request on CPAN: http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBD-Pg There may be another way around it, if you can tell us some more about what exactly it is you are trying to do. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200511161830 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFDe8ErvJuQZxSWSsgRAoZ6AJ9h6gV5U7PyLDJIqXLpSB6r7NWaaQCdESSR CdNexfvYvSQjOLkEdPXd26U= =/W5F -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Wed Nov 16 20:23:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDDC8D8417 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 16 Nov 2005 20:23:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71478-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 00:23:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id C3D16D6D16 for <pgsql-performance@postgresql.org>; Wed, 16 Nov 2005 20:23:47 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jAH0Njbe048338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Nov 2005 17:23:48 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jAH0NjL4055582; Wed, 16 Nov 2005 17:23:45 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jAH0Njmq055581; Wed, 16 Nov 2005 17:23:45 -0700 (MST) (envelope-from mfuhr) Date: Wed, 16 Nov 2005 17:23:45 -0700 From: Michael Fuhr <mike@fuhr.org> To: "Craig A. James" <cjames@modgraph-usa.com> Cc: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Re: Perl DBD and an alarming problem Message-ID: <20051117002344.GA55377@winnie.fuhr.org> References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <437B9DA9.2030806@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/308 X-Sequence-Number: 15565 On Wed, Nov 16, 2005 at 12:59:21PM -0800, Craig A. James wrote: > eval { > local $SIG{ALRM} = sub {die("Timeout");}; > $time = gettimeofday; > alarm 20; > $sth = $dbh->prepare("a query that may take a long time..."); > $sth->execute(); > alarm 0; > }; > if ($@ && $@ =~ /Timeout/) { > my $elapsed = gettimeofday - $time; > print "Timed out after $elapsed seconds"; > } > > Now the mystery: It works, but it hardly matters what time I use for the > alarm call, the actual alarm event always happens at 26 seconds. I can set > "alarm 1" or "alarm 20", and it almost always hits right at 26 seconds. High-level languages' signal handlers don't always work well with low-level libraries. I haven't dug into the Perl source code but I'd guess that since only certain things are safe to do in a signal handler, Perl's handler simply sets some kind of state that the interpreter will examine later during normal execution. If you're using only Perl facilities then that probably happens fairly timely, but if you're stuck in a low-level library (e.g., libpq) then you might have to wait until that library returns control to Perl before Perl recognizes that a signal occurred. As an example, if I run code such as yours with alarm(2) and a query that takes 5 seconds, I see the following in a process trace (from ktrace/kdump on FreeBSD): 55395 perl 0.000978 CALL poll(0xbfbfe1b8,0x1,0xffffffff) 55395 perl 1.996629 RET poll -1 errno 4 Interrupted system call 55395 perl 0.000013 PSIG SIGALRM caught handler=0x281be22c mask=0x0 code=0x0 55395 perl 0.000050 CALL sigprocmask(0x1,0,0x805411c) 55395 perl 0.000005 RET sigprocmask 0 55395 perl 0.000020 CALL sigreturn(0xbfbfde60) 55395 perl 0.000007 RET sigreturn JUSTRETURN 55395 perl 0.000019 CALL poll(0xbfbfe1b8,0x1,0xffffffff) 55395 perl 3.004065 RET poll 1 55395 perl 0.000024 CALL recvfrom(0x3,0x81c6000,0x4000,0,0,0) 55395 perl 0.000016 GIO fd 3 read 60 bytes The poll() call is interrupted by SIGALRM after 2 seconds but then it starts again and doesn't return until the query completes after the remaining 3 seconds. Only sometime later does Perl invoke the ALRM handler I installed, presumably because it can't do so until the low-level code returns control to Perl. Is there a reason you're using alarm() in the client instead of setting statement_timeout on the server? -- Michael Fuhr From pgsql-performance-owner@postgresql.org Thu Nov 17 02:05:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 750F2DB972 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 02:05:26 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81612-09-4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 06:05:25 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 3B26DDB908 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 02:05:19 -0400 (AST) Received: from europa.cosmos.opusvl.com (europa.cosmos.opusvl.com [213.106.249.125]) by svr2.postgresql.org (Postfix) with ESMTP id C7597F0AC6 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 01:06:47 +0000 (GMT) Received: from localhost ([127.0.0.1]) by europa.cosmos.opusvl.com with esmtp (Exim 4.30) id 1EcYEd-0002IH-0V for pgsql-performance@postgresql.org; Thu, 17 Nov 2005 01:06:43 +0000 Message-ID: <437BD7A2.608@opusvl.com> Date: Thu, 17 Nov 2005 01:06:42 +0000 From: Rich Doughty <rich@opusvl.com> Organization: Opus VL User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Strange query plan invloving a view Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/311 X-Sequence-Number: 15568 i have the following query involving a view that i really need to optimise: SELECT * FROM tokens.ta_tokenhist h INNER JOIN tokens.vw_tokens t ON h.token_id = t.token_id WHERE h.sarreport_id = 9 ; where vw_tokens is defined as CREATE VIEW tokens.vw_tokens AS SELECT -- too many columns to mention FROM tokens.ta_tokens t LEFT JOIN tokens.ta_tokenhist i ON t.token_id = i.token_id AND i.status = 'issued' LEFT JOIN tokens.ta_tokenhist s ON t.token_id = s.token_id AND s.status = 'sold' LEFT JOIN tokens.ta_tokenhist r ON t.token_id = r.token_id AND r.status = 'redeemed' ; this gives me the following query plan: Merge Join (cost=18276278.45..31793043.16 rows=55727 width=322) Merge Cond: (("outer".token_id)::integer = "inner"."?column23?") -> Merge Left Join (cost=18043163.64..31639175.71 rows=4228018 width=76) Merge Cond: (("outer".token_id)::integer = "inner"."?column3?") -> Merge Left Join (cost=13649584.94..27194793.37 rows=4228018 width=48) Merge Cond: (("outer".token_id)::integer = "inner"."?column3?") -> Merge Left Join (cost=7179372.62..20653326.29 rows=4228018 width=44) Merge Cond: (("outer".token_id)::integer = "inner"."?column3?") -> Index Scan using ta_tokens_pkey on ta_tokens t (cost=0.00..13400398.89 rows=4053805 width=27) -> Sort (cost=7179372.62..7189942.67 rows=4228018 width=21) Sort Key: (i.token_id)::integer -> Index Scan using fkx_tokenhist__status on ta_tokenhist i (cost=0.00..6315961.47 rows=4228018 width=21) Index Cond: ((status)::text = 'issued'::text) -> Sort (cost=6470212.32..6479909.69 rows=3878949 width=8) Sort Key: (s.token_id)::integer -> Index Scan using fkx_tokenhist__status on ta_tokenhist s (cost=0.00..5794509.99 rows=3878949 width=8) Index Cond: ((status)::text = 'sold'::text) -> Sort (cost=4393578.70..4400008.00 rows=2571718 width=32) Sort Key: (r.token_id)::integer -> Index Scan using fkx_tokenhist__status on ta_tokenhist r (cost=0.00..3841724.02 rows=2571718 width=32) Index Cond: ((status)::text = 'redeemed'::text) -> Sort (cost=233114.81..233248.38 rows=53430 width=246) Sort Key: (h.token_id)::integer -> Index Scan using fkx_tokenhist__sarreports on ta_tokenhist h (cost=0.00..213909.12 rows=53430 width=246) Index Cond: ((sarreport_id)::integer = 9) However, the following query (which i believe should be equivalent) SELECT * FROM tokens.ta_tokenhist h INNER JOIN tokens.ta_tokens t ON h.token_id = t.token_id LEFT JOIN tokens.ta_tokenhist i ON t.token_id = i.token_id AND i.status = 'issued' LEFT JOIN tokens.ta_tokenhist s ON t.token_id = s.token_id AND s.status = 'sold' LEFT JOIN tokens.ta_tokenhist r ON t.token_id = r.token_id AND r.status = 'redeemed' WHERE h.sarreport_id = 9 ; gives the following query plan: Nested Loop Left Join (cost=0.00..3475785.52 rows=55727 width=1011) -> Nested Loop Left Join (cost=0.00..2474425.17 rows=55727 width=765) -> Nested Loop Left Join (cost=0.00..1472368.23 rows=55727 width=519) -> Nested Loop (cost=0.00..511614.87 rows=53430 width=273) -> Index Scan using fkx_tokenhist__sarreports on ta_tokenhist h (cost=0.00..213909.12 rows=53430 width=246) Index Cond: ((sarreport_id)::integer = 9) -> Index Scan using ta_tokens_pkey on ta_tokens t (cost=0.00..5.56 rows=1 width=27) Index Cond: (("outer".token_id)::integer = (t.token_id)::integer) -> Index Scan using fkx_tokenhist__tokens on ta_tokenhist i (cost=0.00..17.96 rows=2 width=246) Index Cond: (("outer".token_id)::integer = (i.token_id)::integer) Filter: ((status)::text = 'issued'::text) -> Index Scan using fkx_tokenhist__tokens on ta_tokenhist s (cost=0.00..17.96 rows=2 width=246) Index Cond: (("outer".token_id)::integer = (s.token_id)::integer) Filter: ((status)::text = 'sold'::text) -> Index Scan using fkx_tokenhist__tokens on ta_tokenhist r (cost=0.00..17.96 rows=1 width=246) Index Cond: (("outer".token_id)::integer = (r.token_id)::integer) Filter: ((status)::text = 'redeemed'::text) This query returns a lot quicker than the plan would suggest, as the planner is over-estimating the amount of rows where ((sarreport_id)::integer = 9). it thinks there are 53430 when in fact there are only 7 (despite a vacuum and analyse). Can anyone give me any suggestions? are the index stats the cause of my problem, or is it the rewrite of the query? Cheers Version: PostgreSQL 8.0.3 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.0.2 20050821 (prerelease) (Debian 4.0.1-6) -- - Rich Doughty From pgsql-www-owner@postgresql.org Thu Nov 17 04:43:26 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 09119D9007; Wed, 16 Nov 2005 21:34:25 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84452-06; Thu, 17 Nov 2005 01:34:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 1F329D8D8F; Wed, 16 Nov 2005 21:34:23 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 8803625077; Thu, 17 Nov 2005 09:34:26 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 61F9F2507D; Thu, 17 Nov 2005 09:34:25 +0800 (WST) Message-ID: <437BDF22.9030109@familyhealth.com.au> Date: Thu, 17 Nov 2005 09:38:42 +0800 From: Christopher Kings-Lynne <chriskl@familyhealth.com.au> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Simon Riggs <simon@2ndquadrant.com> Cc: pgsql-www@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, Steve Wampler <swampler@noao.edu>, Postgres-performance <pgsql-performance@postgresql.org> Subject: Re: [PERFORM] Help speeding up delete References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> In-Reply-To: <1132171206.4959.60.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200511/106 X-Sequence-Number: 8821 >>Update to 7.4 or later ;-) >> >>Quite seriously, if you're still using 7.2.4 for production purposes >>you could justifiably be accused of negligence. There are three or four >>data-loss-grade bugs fixed in the later 7.2.x releases, not to mention >>security holes; and that was before we abandoned support for 7.2. >>You *really* need to be thinking about an update. > > > Perhaps we should put a link on the home page underneath LATEST RELEASEs > saying > 7.2: de-supported > > with a link to a scary note along the lines of the above. I strongly support an explicit desupported notice for 7.2 and below on the website... Chris From pgsql-www-owner@postgresql.org Thu Nov 17 04:43:54 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 84D17D7FA3; Wed, 16 Nov 2005 21:36:25 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83146-10; Thu, 17 Nov 2005 01:36:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 6B6E8D6FCB; Wed, 16 Nov 2005 21:36:22 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id C38BC25079; Thu, 17 Nov 2005 09:36:25 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id D149225078; Thu, 17 Nov 2005 09:36:24 +0800 (WST) Message-ID: <437BDF9A.4060700@familyhealth.com.au> Date: Thu, 17 Nov 2005 09:40:42 +0800 From: Christopher Kings-Lynne <chriskl@familyhealth.com.au> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Simon Riggs <simon@2ndquadrant.com> Cc: pgsql-www@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, Steve Wampler <swampler@noao.edu>, Postgres-performance <pgsql-performance@postgresql.org> Subject: Re: [PERFORM] Help speeding up delete References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> In-Reply-To: <1132171206.4959.60.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.035 required=5 tests=[AWL=0.035] X-Spam-Score: 0.035 X-Spam-Level: X-Archive-Number: 200511/107 X-Sequence-Number: 8822 > Perhaps we should put a link on the home page underneath LATEST RELEASEs > saying > 7.2: de-supported > > with a link to a scary note along the lines of the above. > > ISTM that there are still too many people on older releases. > > We probably need an explanation of why we support so many releases (in > comparison to licenced software) and a note that this does not imply the > latest releases are not yet production (in comparison to MySQL or Sybase > who have been in beta for a very long time). By the way, is anyone interested in creating some sort of online repository on pgsql.org or pgfoundry where we can keep statically compiled pg_dump/all for several platforms for 8.1? That way if someone wanted to upgrade from 7.2 to 8.1, they can just grab the latest dumper from the website, dump their old database, then upgrade easily. In my experience not many pgsql admins have test servers or the skills to build up test machines with the latest pg_dump, etc. (Seriously.) In fact, few realise at all that they should use the 8.1 dumper. Chris From pgsql-www-owner@postgresql.org Thu Nov 17 05:19:31 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53E59DB86E; Thu, 17 Nov 2005 05:19:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07910-05-2; Thu, 17 Nov 2005 09:19:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 6E77BDB4CF; Thu, 17 Nov 2005 05:19:27 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 242948F28C; Thu, 17 Nov 2005 10:19:29 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: [PERFORM] Help speeding up delete Date: Thu, 17 Nov 2005 10:19:28 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE6C7BF2@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [pgsql-www] [PERFORM] Help speeding up delete thread-index: AcXrU4k7PjwS8+z1TDi66qZLjnVilgABDMAQ From: "Magnus Hagander" <mha@sollentuna.net> To: "Christopher Kings-Lynne" <chriskl@familyhealth.com.au>, "Simon Riggs" <simon@2ndquadrant.com> Cc: <pgsql-www@postgresql.org>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Steve Wampler" <swampler@noao.edu>, "Postgres-performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/108 X-Sequence-Number: 8823 > > Perhaps we should put a link on the home page underneath LATEST=20 > > RELEASEs saying > > 7.2: de-supported > >=20 > > with a link to a scary note along the lines of the above. > >=20 > > ISTM that there are still too many people on older releases. > >=20 > > We probably need an explanation of why we support so many=20 > releases (in=20 > > comparison to licenced software) and a note that this does=20 > not imply=20 > > the latest releases are not yet production (in comparison=20 > to MySQL or=20 > > Sybase who have been in beta for a very long time). >=20 > By the way, is anyone interested in creating some sort of=20 > online repository on pgsql.org or pgfoundry where we can keep=20 > statically compiled pg_dump/all for several platforms for 8.1? >=20 > That way if someone wanted to upgrade from 7.2 to 8.1, they=20 > can just grab the latest dumper from the website, dump their=20 > old database, then upgrade easily. But if they're upgrading to 8.1, don't they already have the new pg_dump? How else are they going to dump their *new* database? > In my experience not many pgsql admins have test servers or=20 > the skills to build up test machines with the latest pg_dump,=20 I don't, but I still dump with the latest version - works fine both on linux and windows for me...=20 > etc. (Seriously.) In fact, few realise at all that they=20 > should use the 8.1 dumper. That most people don't know they should use the new one I understand though. But I don't see how this will help against that :-) //Magnus From pgsql-performance-owner@postgresql.org Thu Nov 17 07:20:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AB84CD6FF4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 07:19:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19851-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 11:19:59 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id AA155D6853 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 07:19:53 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Echo2-0000hf-PJ for pgsql-performance@postgresql.org; Thu, 17 Nov 2005 12:19:56 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Echnb-0006uH-00 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 12:19:27 +0100 Date: Thu, 17 Nov 2005 12:19:27 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: Help speeding up delete Message-ID: <20051117111927.GB26459@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> <437BDF9A.4060700@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <437BDF9A.4060700@familyhealth.com.au> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/313 X-Sequence-Number: 15570 On Thu, Nov 17, 2005 at 09:40:42AM +0800, Christopher Kings-Lynne wrote: > In my experience not many pgsql admins have test servers or the skills > to build up test machines with the latest pg_dump, etc. (Seriously.) > In fact, few realise at all that they should use the 8.1 dumper. Isn't your distribution supposed to do this for you? Mine does these days... /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Nov 17 08:28:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A321FDB4C2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 08:28:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28712-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 12:28:44 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 39948DB4CF for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 08:28:39 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id DDD9031059; Thu, 17 Nov 2005 13:28:41 +0100 (MET) From: William Yu <wyu@talisys.com> X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Thu, 17 Nov 2005 04:28:38 -0800 Organization: Hub.Org Networking Services Lines: 19 Message-ID: <dlht1h$2q3r$1@news.hub.org> References: <2F769A036C2082469C3A4BF2603694C601E7686E@ex2k.bankofamerica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <2F769A036C2082469C3A4BF2603694C601E7686E@ex2k.bankofamerica.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/314 X-Sequence-Number: 15571 Welty, Richard wrote: > David Boreham wrote: > >>I guess I've never bought into the vendor story that there are >>two reliability grades. Why would they bother making two >>different kinds of bearing, motor etc ? Seems like it's more >>likely an excuse to justify higher prices. > > > then how to account for the fact that bleeding edge SCSI drives > turn at twice the rpms of bleeding edge consumer drives? The motors spin twice as fast? I'm pretty sure the original comment was based on drives w/ similar specs. E.g. 7200RPM "enterprise" drives versus 7200RPM "consumer" drives. Next time one of my 7200RPM SCSIs fail, I'll take it apart and compare the insides to an older 7200RPM IDE from roughly the same era. From pgsql-performance-owner@postgresql.org Thu Nov 17 10:34:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 52AB7D7003 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 10:34:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45817-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 14:34:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id D43B7DB90D for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 10:34:49 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 30F09B80A for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 09:34:53 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <b41c75520511161350u3ed6f4b1x@mail.gmail.com> References: <1B80C974ABFB23429A403B6667FE84C71066E8@seiumain.SEIU.local> <b41c75520511150028o553e6bb5j@mail.gmail.com> <D1ABFA1F-FEB0-4E01-BC2E-482535A5DB28@khera.org> <b41c75520511161350u3ed6f4b1x@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <E9467EC3-31C3-487F-816A-9C2E42394CA3@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera <vivek@khera.org> Subject: Re: Hardware/OS recommendations for large databases (5TB) Date: Thu, 17 Nov 2005 09:34:52 -0500 To: Postgresql Performance <pgsql-performance@postgresql.org> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/315 X-Sequence-Number: 15572 On Nov 16, 2005, at 4:50 PM, Claus Guttesen wrote: > I'm (also) FreeBSD-biased but I'm not shure whether the 5 TB fs will > work so well if tools like fsck are needed. Gvinum could be one option > but I don't have any experience in that area. Then look into an external filer and mount via NFS. Then it is not FreeBSD's responsibility to manage the volume. From pgsql-www-owner@postgresql.org Thu Nov 17 11:08:25 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49C24DB951; Thu, 17 Nov 2005 11:05:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48368-08; Thu, 17 Nov 2005 15:05:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 3645FDB975; Thu, 17 Nov 2005 11:05:11 -0400 (AST) Received: from vscan03.westnet.com.au (vscan03.westnet.com.au [203.10.1.142]) by svr2.postgresql.org (Postfix) with ESMTP id 8F2B3F0BEC; Thu, 17 Nov 2005 15:05:15 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 315CCB60294; Thu, 17 Nov 2005 23:05:11 +0800 (WST) Received: from vscan03.westnet.com.au ([127.0.0.1]) by localhost (vscan03.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03875-07-2; Thu, 17 Nov 2005 23:05:11 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan03.westnet.com.au (Postfix) with ESMTP id 81F04B60280; Thu, 17 Nov 2005 23:05:10 +0800 (WST) Message-ID: <437C9C26.309@familyhealth.com.au> Date: Thu, 17 Nov 2005 23:05:10 +0800 From: Christopher Kings-Lynne <chriskl@familyhealth.com.au> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Magnus Hagander <mha@sollentuna.net> Cc: Simon Riggs <simon@2ndquadrant.com>, pgsql-www@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, Steve Wampler <swampler@noao.edu>, Postgres-performance <pgsql-performance@postgresql.org> Subject: Re: [PERFORM] Help speeding up delete References: <6BCB9D8A16AC4241919521715F4D8BCE6C7BF2@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE6C7BF2@algol.sollentuna.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/112 X-Sequence-Number: 8827 >>That way if someone wanted to upgrade from 7.2 to 8.1, they >>can just grab the latest dumper from the website, dump their >>old database, then upgrade easily. > > But if they're upgrading to 8.1, don't they already have the new > pg_dump? How else are they going to dump their *new* database? Erm. Usually when you install the new package/port for 8.1, you cannot have both new and old installed at the same time man. Remember they both store exactly the same binary files in exactly the same place. >>In my experience not many pgsql admins have test servers or >>the skills to build up test machines with the latest pg_dump, > > I don't, but I still dump with the latest version - works fine both on > linux and windows for me... So you're saying you DO have the skills to do it then... >>etc. (Seriously.) In fact, few realise at all that they >>should use the 8.1 dumper. > > That most people don't know they should use the new one I understand > though. But I don't see how this will help against that :-) It'll make it easy... Chris From pgsql-performance-owner@postgresql.org Thu Nov 17 11:07:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F4B4D963C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 11:07:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47569-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 15:07:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 879ADD6853 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 11:07:41 -0400 (AST) Received: from vscan03.westnet.com.au (vscan03.westnet.com.au [203.10.1.142]) by svr2.postgresql.org (Postfix) with ESMTP id 15DD8F0BF8 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 15:07:45 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 28560B60184; Thu, 17 Nov 2005 23:07:43 +0800 (WST) Received: from vscan03.westnet.com.au ([127.0.0.1]) by localhost (vscan03.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04578-05-2; Thu, 17 Nov 2005 23:07:43 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan03.westnet.com.au (Postfix) with ESMTP id D140EB603EE; Thu, 17 Nov 2005 23:07:41 +0800 (WST) Message-ID: <437C9CBE.8020907@familyhealth.com.au> Date: Thu, 17 Nov 2005 23:07:42 +0800 From: Christopher Kings-Lynne <chriskl@familyhealth.com.au> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Steinar H. Gunderson" <sgunderson@bigfoot.com> Cc: pgsql-performance@postgresql.org Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> <437BDF9A.4060700@familyhealth.com.au> <20051117111927.GB26459@uio.no> In-Reply-To: <20051117111927.GB26459@uio.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/317 X-Sequence-Number: 15574 > Isn't your distribution supposed to do this for you? Mine does these days... A distribution that tries to automatically do a major postgresql update is doomed to fail - spectacularly... Chris From pgsql-www-owner@postgresql.org Thu Nov 17 11:17:13 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9D03EDB972; Thu, 17 Nov 2005 11:13:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47671-09; Thu, 17 Nov 2005 15:13:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id B5087DB97F; Thu, 17 Nov 2005 11:13:32 -0400 (AST) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from weaver.tuc.noao.edu ([140.252.14.8] verified) by noao.edu (CommuniGate Pro SMTP 5.0.1) with ESMTPS id 21690410; Thu, 17 Nov 2005 08:13:31 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.13.1/8.13.1) with ESMTP id jAHFDU0r002829; Thu, 17 Nov 2005 08:13:30 -0700 Message-ID: <437C9E1A.50505@noao.edu> Date: Thu, 17 Nov 2005 08:13:30 -0700 From: Steve Wampler <swampler@noao.edu> User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne <chriskl@familyhealth.com.au> CC: Magnus Hagander <mha@sollentuna.net>, Simon Riggs <simon@2ndquadrant.com>, pgsql-www@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, Postgres-performance <pgsql-performance@postgresql.org> Subject: Re: [PERFORM] Help speeding up delete References: <6BCB9D8A16AC4241919521715F4D8BCE6C7BF2@algol.sollentuna.se> <437C9C26.309@familyhealth.com.au> In-Reply-To: <437C9C26.309@familyhealth.com.au> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/113 X-Sequence-Number: 8828 Christopher Kings-Lynne wrote: >> That most people don't know they should use the new one I understand >> though. But I don't see how this will help against that :-) > > It'll make it easy... As the miscreant that caused this thread to get started, let me *wholeheartedly* agree with Chris. An easy way to get the pg_dump for the upgrade target to run with the upgradable source would work wonders. (Instructions included, of course.) -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-www-owner@postgresql.org Thu Nov 17 11:39:08 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AF7FD7B8B; Thu, 17 Nov 2005 11:39:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52805-03; Thu, 17 Nov 2005 15:39:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id CD1C8DB94C; Thu, 17 Nov 2005 11:39:02 -0400 (AST) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 636288F28C; Thu, 17 Nov 2005 16:39:06 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: [PERFORM] Help speeding up delete Date: Thu, 17 Nov 2005 16:39:06 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE6C7C03@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [pgsql-www] [PERFORM] Help speeding up delete thread-index: AcXriFF+MaR09uvOR3ivzN3N2SRPNQABHMjA From: "Magnus Hagander" <mha@sollentuna.net> To: "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> Cc: "Simon Riggs" <simon@2ndquadrant.com>, <pgsql-www@postgresql.org>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Steve Wampler" <swampler@noao.edu>, "Postgres-performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/114 X-Sequence-Number: 8829 > >>That way if someone wanted to upgrade from 7.2 to 8.1, they=20 > can just=20 > >>grab the latest dumper from the website, dump their old=20 > database, then=20 > >>upgrade easily. > >=20 > > But if they're upgrading to 8.1, don't they already have the new=20 > > pg_dump? How else are they going to dump their *new* database? >=20 > Erm. Usually when you install the new package/port for 8.1,=20 > you cannot have both new and old installed at the same time=20 > man. Remember they both store exactly the same binary files=20 > in exactly the same place. Urrk. Didn't think of that. I always install from source on Unix, which doesn't have the problem. And the Windows port doesn't have this problem - it will put the binaries in a version dependant directory. One could claim the packages are broken ;-), but that's not gonig to help here, I know... (I always install in pgsql-<version>, and then symlink pgsql there..) > >>etc. (Seriously.) In fact, few realise at all that they should use=20 > >>the 8.1 dumper. > >=20 > > That most people don't know they should use the new one I=20 > understand=20 > > though. But I don't see how this will help against that :-) >=20 > It'll make it easy... You assume they know enough to download it. If they don't know to look for it, they still won't find it. But the bottom line: I can see how it would be helpful if you're on a distro which packages postgresql in a way that prevents you from installing more than one version at the same time. //Magnus From pgsql-www-owner@postgresql.org Thu Nov 17 12:02:46 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F02C8D967F; Thu, 17 Nov 2005 11:56:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55332-03; Thu, 17 Nov 2005 15:56:35 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 0E06AD78B6; Thu, 17 Nov 2005 11:56:28 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 17 Nov 2005 09:56:32 -0600 Subject: Re: [PERFORM] Help speeding up delete From: Scott Marlowe <smarlowe@g2switchworks.com> To: Christopher Kings-Lynne <chriskl@familyhealth.com.au> Cc: Simon Riggs <simon@2ndquadrant.com>, pgsql-www@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, Steve Wampler <swampler@noao.edu>, Postgres-performance <pgsql-performance@postgresql.org> In-Reply-To: <437BDF9A.4060700@familyhealth.com.au> References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> <437BDF9A.4060700@familyhealth.com.au> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132242992.3582.98.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 17 Nov 2005 09:56:32 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/116 X-Sequence-Number: 8831 On Wed, 2005-11-16 at 19:40, Christopher Kings-Lynne wrote: > > Perhaps we should put a link on the home page underneath LATEST RELEASEs > > saying > > 7.2: de-supported > > > > with a link to a scary note along the lines of the above. > > > > ISTM that there are still too many people on older releases. > > > > We probably need an explanation of why we support so many releases (in > > comparison to licenced software) and a note that this does not imply the > > latest releases are not yet production (in comparison to MySQL or Sybase > > who have been in beta for a very long time). > > By the way, is anyone interested in creating some sort of online > repository on pgsql.org or pgfoundry where we can keep statically > compiled pg_dump/all for several platforms for 8.1? > > That way if someone wanted to upgrade from 7.2 to 8.1, they can just > grab the latest dumper from the website, dump their old database, then > upgrade easily. > > In my experience not many pgsql admins have test servers or the skills > to build up test machines with the latest pg_dump, etc. (Seriously.) > In fact, few realise at all that they should use the 8.1 dumper. I would especially like such a thing available as an RPM. A pgsql-8.1-clienttools.rpm or something like that, with psql, pg_dump, pg_restore, and what other command line tools you can think of that would help. From pgsql-www-owner@postgresql.org Thu Nov 17 13:02:32 2005 X-Original-To: pgsql-www-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 046FBDB15E for <pgsql-www-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 12:57:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68794-06 for <pgsql-www-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:57:40 +0000 (GMT) X-Greylist: delayed 00:28:35.330519 by SQLgrey- Received: from cicero0.cybercity.dk (cicero0.cybercity.dk [212.242.40.52]) by svr1.postgresql.org (Postfix) with ESMTP id 31C09D7B8B for <pgsql-www@postgresql.org>; Thu, 17 Nov 2005 12:57:37 -0400 (AST) Received: from [192.168.0.79] (0x3e42eeca.adsl.cybercity.dk [62.66.238.202]) by cicero0.cybercity.dk (Postfix) with ESMTP id 31BE22A153; Thu, 17 Nov 2005 17:28:16 +0100 (CET) Message-ID: <437CAF4B.2030100@krap.dk> Date: Thu, 17 Nov 2005 17:26:51 +0100 From: Svenne Krap <svenne@krap.dk> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Magnus Hagander <mha@sollentuna.net>, pgsql-www@postgresql.org Subject: Re: [PERFORM] Help speeding up delete References: <6BCB9D8A16AC4241919521715F4D8BCE6C7C03@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE6C7C03@algol.sollentuna.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/122 X-Sequence-Number: 8837 >You assume they know enough to download it. If they don't know to look >for it, they still won't find it. > > I think there should be a big, fat warning in the release notes. Something like: WARNING: Upgrading to version X.Y requires a full dump/restore cycle. Please download the appropriate dump-utility from http://postgresql.org/dumputils/X.Y/ and make a copy of your database before installing the new version X.Y. And then link to a dir with the statically linked pg_dump (and -all) for the most common platforms. I must admit, I did not know that one should use the new tool in a cyclus (and I have used Pg almost exclusively since 7.0). That could also be the place to add a line about version S.T is now considered obsolete and unsupported. /Svenne From pgsql-performance-owner@postgresql.org Thu Nov 17 13:25:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5FA78DA792 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 13:25:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74365-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 17:25:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 5E558D71B1 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 13:25:40 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EcnVz-0006jv-Qk for pgsql-performance@postgresql.org; Thu, 17 Nov 2005 18:25:40 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EcnVX-0007Km-00 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 18:25:11 +0100 Date: Thu, 17 Nov 2005 18:25:11 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: Help speeding up delete Message-ID: <20051117172511.GA28121@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> <437BDF9A.4060700@familyhealth.com.au> <20051117111927.GB26459@uio.no> <437C9CBE.8020907@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <437C9CBE.8020907@familyhealth.com.au> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/321 X-Sequence-Number: 15578 On Thu, Nov 17, 2005 at 11:07:42PM +0800, Christopher Kings-Lynne wrote: >> Isn't your distribution supposed to do this for you? Mine does these >> days... > A distribution that tries to automatically do a major postgresql update > is doomed to fail - spectacularly... Automatically? Well, you can install the two versions side-by-side, and do pg_upgradecluster, which ports your configuration to the new version and does a pg_dump between the two versions; exactly what a system administrator would do. Of course, stuff _can_ fail, but it works for the simple cases, and a great deal of the not-so-simple cases. I did this for our cluster the other day (130 wildly different databases, from 7.4 to 8.1) and it worked flawlessly. I do not really see why all the distributions could do something like this, instead of mucking around with special statically compiled pg_dumps and the like... /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Nov 17 16:48:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F002EDB98A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:48:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19624-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:48:31 +0000 (GMT) X-Greylist: delayed 03:01:11.321971 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 20C5EDB1D4 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:48:26 -0400 (AST) Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr2.postgresql.org (Postfix) with ESMTP id 25718F0B7C for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 17:47:14 +0000 (GMT) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id DC8B15DD9 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 18:47:09 +0100 (CET) Message-ID: <437CC21D.8070402@openwide.fr> Date: Thu, 17 Nov 2005 18:47:09 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: weird performances problem Content-Type: multipart/mixed; boundary="------------080708010505040208070501" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/331 X-Sequence-Number: 15588 This is a multi-part message in MIME format. --------------080708010505040208070501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi all, We are operating a 1.5GB postgresql database for a year and we have problems for nearly a month. Usually everything is OK with the database, queries are executed fast even if they are complicated but sometimes and for half an hour, we have a general slow down. The server is a dedicated quad xeon with 4GB and a RAID1 array for the system and a RAID10 one for postgresql data. We have very few updates/inserts/deletes during the day. Postgresql version is 7.4.8. - the database is vacuumed, analyzed regularly (but we are not using autovacuum) and usually performs pretty well ; - IOs are OK, the database is entirely in RAM (see top.txt and iostat.txt attached) ; - CPUs are usually 25% idle, load is never really growing and its maximum is below 5 ; - I attached two plans for a simple query, the one is what we have when the server is fast, the other when we have a slow down: it's exactly the same plan but, as you can see it, the time to fetch the first row from indexes is quite high for the slow query ; - during this slow down, queries that usually take 500ms can take up to 60 seconds (and sometimes even more) ; - we have up to 130 permanent connections from our apache servers during this slow down as we have a lot of apache children waiting for a response. I attached a vmstat output. Context switches are quite high but I'm not sure it can be called a context switch storm and that this is the cause of our problem. Thanks for any advice or idea to help us understanding this problem and hopefully solve it. Regards, -- Guillaume --------------080708010505040208070501 Content-Type: text/plain; name="iostat.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="iostat.txt" [root@bd root]# iostat 10 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 7.20 0.00 92.00 0 920 sda1 0.00 0.00 0.00 0 0 sda2 6.40 0.00 78.40 0 784 sda3 0.00 0.00 0.00 0 0 sda4 0.00 0.00 0.00 0 0 sda5 0.00 0.00 0.00 0 0 sda6 0.80 0.00 13.60 0 136 sdb 5.00 0.00 165.60 0 1656 sdb1 5.00 0.00 165.60 0 1656 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 1.30 0.00 20.80 0 208 sda1 0.00 0.00 0.00 0 0 sda2 0.70 0.00 9.60 0 96 sda3 0.00 0.00 0.00 0 0 sda4 0.00 0.00 0.00 0 0 sda5 0.00 0.00 0.00 0 0 sda6 0.60 0.00 11.20 0 112 sdb 5.40 0.00 173.60 0 1736 sdb1 5.40 0.00 173.60 0 1736 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 2.20 0.00 28.00 0 280 sda1 0.00 0.00 0.00 0 0 sda2 2.20 0.00 28.00 0 280 sda3 0.00 0.00 0.00 0 0 sda4 0.00 0.00 0.00 0 0 sda5 0.00 0.00 0.00 0 0 sda6 0.00 0.00 0.00 0 0 sdb 5.20 0.00 171.20 0 1712 sdb1 5.20 0.00 171.20 0 1712 --------------080708010505040208070501 Content-Type: text/plain; name="plan1.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="plan1.txt" QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..13.52 rows=2 width=1119) (actual time=0.154..0.167 rows=1 loops=1) -> Index Scan using pk_newslang on newslang nl (cost=0.00..3.87 rows=1 width=1004) (actual time=0.053..0.055 rows=1 loops=1) Index Cond: (((codelang)::text = 'FRA'::text) AND (3498704 = numnews)) -> Nested Loop Left Join (cost=0.00..9.61 rows=2 width=119) (actual time=0.050..0.059 rows=1 loops=1) -> Index Scan using pk_news on news n (cost=0.00..3.31 rows=2 width=98) (actual time=0.021..0.023 rows=1 loops=1) Index Cond: (numnews = 3498704) -> Index Scan using pk_photo on photo p (cost=0.00..3.14 rows=1 width=25) (actual time=0.021..0.025 rows=1 loops=1) Index Cond: (p.numphoto = "outer".numphoto) Total runtime: 0.320 ms (9 rows) --------------080708010505040208070501 Content-Type: text/plain; name="plan2.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="plan2.txt" QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=0.00..13.52 rows=2 width=1119) (actual time=155.286..155.305 rows=1 loops=1) -> Index Scan using pk_newslang on newslang nl (cost=0.00..3.87 rows=1 width=1004) (actual time=44.575..44.579 rows=1 loops=1) Index Cond: (((codelang)::text = 'FRA'::text) AND (3498704 = numnews)) -> Nested Loop Left Join (cost=0.00..9.61 rows=2 width=119) (actual time=110.648..110.660 rows=1 loops=1) -> Index Scan using pk_news on news n (cost=0.00..3.31 rows=2 width=98) (actual time=0.169..0.174 rows=1 loops=1) Index Cond: (numnews = 3498704) -> Index Scan using pk_photo on photo p (cost=0.00..3.14 rows=1 width=25) (actual time=110.451..110.454 rows=1 loops=1) Index Cond: (p.numphoto = "outer".numphoto) Total runtime: 155.514 ms (9 rows) --------------080708010505040208070501 Content-Type: text/plain; name="top.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="top.txt" 17:08:41 up 19 days, 15:16, 1 user, load average: 4.03, 4.26, 4.36 288 processes: 285 sleeping, 3 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 59.0% 0.0% 8.8% 0.2% 0.0% 0.0% 31.9% cpu00 52.3% 0.0% 13.3% 0.9% 0.0% 0.0% 33.3% cpu01 65.7% 0.0% 7.6% 0.0% 0.0% 0.0% 26.6% cpu02 58.0% 0.0% 7.6% 0.0% 0.0% 0.0% 34.2% cpu03 60.0% 0.0% 6.6% 0.0% 0.0% 0.0% 33.3% Mem: 3857224k av, 3495880k used, 361344k free, 0k shrd, 92160k buff 2374048k actv, 463576k in_d, 37708k in_c Swap: 4281272k av, 25412k used, 4255860k free 2173392k cached --------------080708010505040208070501 Content-Type: text/plain; name="vmstat.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vmstat.txt" [root@bd root]# vmstat 10 procs memory swap io system cpu r b swpd free buff cache si so bi bo in cs us sy id wa 4 0 25412 250160 91736 2170944 0 1 3 3 4 3 5 3 3 0 7 0 25412 247160 91736 2171024 0 0 0 116 588 4483 65 4 31 0 3 0 25412 235456 91752 2171132 0 0 0 129 491 3670 70 4 26 0 5 0 25412 233696 91760 2171216 0 0 0 152 530 4768 61 4 34 0 5 0 25412 233248 91768 2171232 0 0 0 183 624 5379 59 5 36 0 9 0 25412 195332 91788 2171304 0 0 0 127 541 4811 58 5 37 0 --------------080708010505040208070501-- From pgsql-performance-owner@postgresql.org Thu Nov 17 14:07:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3CB8DB616 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 14:06:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82445-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 18:06:58 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 133D7DB38D for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 14:06:56 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAHI6t3T029532; Thu, 17 Nov 2005 13:06:55 -0500 (EST) To: Rich Doughty <rich@opusvl.com> cc: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Re: Strange query plan invloving a view In-reply-to: <437BD7A2.608@opusvl.com> References: <437BD7A2.608@opusvl.com> Comments: In-reply-to Rich Doughty <rich@opusvl.com> message dated "Thu, 17 Nov 2005 01:06:42 +0000" Date: Thu, 17 Nov 2005 13:06:55 -0500 Message-ID: <29531.1132250815@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.006 required=5 tests=[AWL=0.006] X-Spam-Score: 0.006 X-Spam-Level: X-Archive-Number: 200511/322 X-Sequence-Number: 15579 Rich Doughty <rich@opusvl.com> writes: > However, the following query (which i believe should be equivalent) > SELECT * > FROM > tokens.ta_tokenhist h INNER JOIN > tokens.ta_tokens t ON h.token_id = t.token_id LEFT JOIN > tokens.ta_tokenhist i ON t.token_id = i.token_id AND > i.status = 'issued' LEFT JOIN > tokens.ta_tokenhist s ON t.token_id = s.token_id AND > s.status = 'sold' LEFT JOIN > tokens.ta_tokenhist r ON t.token_id = r.token_id AND > r.status = 'redeemed' > WHERE > h.sarreport_id = 9 > ; No, that's not equivalent at all, because the implicit parenthesization is left-to-right; therefore you've injected the constraint to a few rows of ta_tokenhist (and therefore only a few rows of ta_tokens) into the bottom of the LEFT JOIN stack. In the other case the constraint is at the wrong end of the join stack, and so the full view output gets formed before anything gets thrown away. Some day the Postgres planner will probably be smart enough to rearrange the join order despite the presence of outer joins ... but today is not that day. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 17 15:48:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4DBA8DB937 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 15:48:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07825-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 19:48:40 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by svr1.postgresql.org (Postfix) with ESMTP id 8DB91DB982 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 15:48:37 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i28so472561wra for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 11:48:38 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PJVuSqGD/bQrwPkNupBjPS59ddzQR04MNHI7FUqol7ZExQuM1MVfwXZ9rgL8Ia+q+8OoDMQOYp24xMtcVZnmcnX61/0K2+67BPJdGePYNx49LG2Ko8XtRHTWRpEPrm42z7kyzOxS88/3Z7XKiGHZZXyxVLdZmqzqbDuJEg/FURs= Received: by 10.54.67.12 with SMTP id p12mr6760115wra; Thu, 17 Nov 2005 11:48:38 -0800 (PST) Received: by 10.54.82.5 with HTTP; Thu, 17 Nov 2005 11:48:37 -0800 (PST) Message-ID: <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> Date: Thu, 17 Nov 2005 14:48:38 -0500 From: Alex Turner <armtuk@gmail.com> To: William Yu <wyu@talisys.com> Subject: Re: Hardware/OS recommendations for large databases ( Cc: pgsql-performance@postgresql.org In-Reply-To: <dlfjgf$41b$1@news.hub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/323 X-Sequence-Number: 15580 On 11/16/05, William Yu <wyu@talisys.com> wrote: > Alex Turner wrote: > > Spend a fortune on dual core CPUs and then buy crappy disks... I bet > > for most applications this system will be IO bound, and you will see a > > nice lot of drive failures in the first year of operation with > > consumer grade drives. > > > > Spend your money on better Disks, and don't bother with Dual Core IMHO > > unless you can prove the need for it. > > I would say the opposite -- you always want Dual Core nowadays. DC > Opterons simply give you better bang for the buck than single core > Opterons. Price out a 1xDC system against a 2x1P system -- the 1xDC will > be cheaper. Do the same for 2xDC versus 4x1P, 4xDC versus 8x1P, 8xDC > versus 16x1P, etc. -- DC gets cheaper by wider and wider margins because > those mega-CPU motherboards are astronomically expensive. > Opteron 242 - $178.00 Opteron 242 - $178.00 Tyan S2882 - $377.50 Total: $733.50 Opteron 265 - $719.00 Tyan K8E - $169.00 Total: $888.00 Tyan K8E - doesn't have any PCI-X, so it's also not apples to apples.=20 Infact I couldn't find a single CPU slot board that did, so you pretty much have to buy a dual CPU board to get PCI-X. 1xDC is _not_ cheaper. Our DB application does about 5 queries/second peak, plus a heavy insert job once per day. We only _need_ two CPUs, which is true for a great many DB applications. Unless you like EJB of course, which will thrash the crap out of your system. Consider the two most used regions for DBs: a) OLTP - probably IO bound, large number of queries/sec updating info on _disks_, not requiring much CPU activity except to retrieve item infomration which is well indexed and normalized. b) Data wharehouse - needs CPU, but probably still IO bound, large data set that won't fit in RAM will required large amounts of disk reads. CPU can easily keep up with disk reads. I have yet to come across a DB system that wasn't IO bound. > DC also gives you a better upgrade path. Let's say you do testing and > figure 2x246 is the right setup to handle the load. Well instead of > getting 2x1P, use the same 2P motherboard but only populate 1 CPU w/ a > DC/270. Now you have a server that can be upgraded to +80% more CPU by > popping in another DC/270 versus throwing out the entire thing to get a > 4x1P setup. No argument there. But it's pointless if you are IO bound. > > The only questions would be: > (1) Do you need a SMP server at all? I'd claim yes -- you always need 2+ > cores whether it's DC or 2P to avoid IO interrupts blocking other > processes from running. At least 2CPUs is always good for precisely those reasons. More than 2CPUs gives diminishing returns. > > (2) Does a DC system perform better than it's Nx1P cousin? My experience > is yes. Did some rough tests in a drop-in-replacement 1x265 versus 2x244 > and saw about +10% for DC. All the official benchmarks (Spec, Java, SAP, > etc) from AMD/Sun/HP/IBM show DCs outperforming the Nx1P setups. Maybe true, but the 265 does have a 25% faster FSB than the 244, which might perhaps play a role. > > (3) Do you need an insane amount of memory? Well here's the case where > the more expensive motherboard will serve you better since each CPU slot > has its own bank of memory. Spend more money on memory, get cheaper > single-core CPUs. Remember - large DB is going to be IO bound. Memory will get thrashed for file block buffers, even if you have large amounts, it's all gonna be cycled in and out again. > > Of course, this doesn't apply if you are an Intel/Dell-only shop. Xeon > DCs, while cheaper than their corresponding single-core SMPs, don't have > the same performance profile of Opteron DCs. Basically, you're paying a > bit extra so your server can generate a ton more heat. Dell/Xeon/Postgres is just a bad combination any day of the week ;) Alex. From pgsql-performance-owner@postgresql.org Thu Nov 17 15:50:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F0FB5D7B8B for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 15:50:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07729-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 19:50:11 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 1501AD6D07 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 15:50:08 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i28so472893wra for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 11:50:10 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DqSX66YjpQPeRjGgx8R1BkY5d60+3JpgjARk+cOZRH/StRvAQaAck5tXvaRZT7Np7zZpwmhi0AiyUJijQS97DElwYOYoKusmysuHz9HheaRiGvxO+J1KZdRPaCwr4bxjFolDrdFWZ5aqDoOoX5691VAwVmCZAsJflwBDMxWf4Ms= Received: by 10.54.76.9 with SMTP id y9mr6761964wra; Thu, 17 Nov 2005 11:50:10 -0800 (PST) Received: by 10.54.82.5 with HTTP; Thu, 17 Nov 2005 11:50:10 -0800 (PST) Message-ID: <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> Date: Thu, 17 Nov 2005 14:50:10 -0500 From: Alex Turner <armtuk@gmail.com> To: David Boreham <david_list@boreham.org> Subject: Re: Hardware/OS recommendations for large databases ( Cc: pgsql-performance@postgresql.org In-Reply-To: <437B578C.4000309@boreham.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200511161550.jAGFoCY09049@candle.pha.pa.us> <437B578C.4000309@boreham.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/324 X-Sequence-Number: 15581 Just pick up a SCSI drive and a consumer ATA drive. Feel their weight. You don't have to look inside to tell the difference. Alex On 11/16/05, David Boreham <david_list@boreham.org> wrote: > > > I suggest you read this on the difference between enterprise/SCSI and > desktop/IDE drives: > > http://www.seagate.com/content/docs/pdf/whitepaper/D2c_More_than_Interfac= e_ATA_vs_SCSI_042003.pdf > > > This is exactly the kind of vendor propaganda I was talking about > and it proves my point quite well : that there's nothing specific relati= ng > to reliability that is different between SCSI and SATA drives cited in t= hat > paper. > It does have a bunch of FUD such as 'oh yeah we do a lot more > drive characterization during manufacturing'. > > > > From pgsql-performance-owner@postgresql.org Thu Nov 17 15:54:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9EEABDB98A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 15:54:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08017-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 19:54:55 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by svr1.postgresql.org (Postfix) with ESMTP id E32D5DB998 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 15:54:52 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i28so473804wra for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 11:54:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WkDdsQ7FqqO4zoLGZGNqNop4apT4rAaVon/3wG4Ne8dybeih7kmtks1bzxXAbRa6M4w9nIx5EURrSZyllgHig3bXP/Y4ViatlD30LprkjhSVMYepszxmzTuglsBHAukbc82iZPrPbJfKsJ9NgqdGPil7QhQM9H7dm1WSXFuFYe0= Received: by 10.54.101.18 with SMTP id y18mr7419316wrb; Thu, 17 Nov 2005 11:54:54 -0800 (PST) Received: by 10.54.82.5 with HTTP; Thu, 17 Nov 2005 11:54:54 -0800 (PST) Message-ID: <33c6269f0511171154t22e0bce0p803a1803f8b1a539@mail.gmail.com> Date: Thu, 17 Nov 2005 14:54:54 -0500 From: Alex Turner <armtuk@gmail.com> To: "Joshua D. Drake" <jd@commandprompt.com> Subject: Re: Hardware/OS recommendations for large databases ( Cc: William Yu <wyu@talisys.com>, pgsql-performance@postgresql.org In-Reply-To: <437B5859.9040805@commandprompt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <437B5859.9040805@commandprompt.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/325 X-Sequence-Number: 15582 On 11/16/05, Joshua D. Drake <jd@commandprompt.com> wrote: > > > > The only questions would be: > > (1) Do you need a SMP server at all? I'd claim yes -- you always need > > 2+ cores whether it's DC or 2P to avoid IO interrupts blocking other > > processes from running. > > I would back this up. Even for smaller installations (single raid 1, 1 > gig of ram). Why? Well because many applications are going to be CPU > bound. For example > we have a PHP application that is a CMS. On a single CPU machine, RAID 1 > it takes about 300ms to deliver a single page, point to point. We are > not IO bound. > So what happens is that under reasonable load we are actually waiting > for the CPU to process the code. > This is the performance profile for PHP, not for Postgresql. This is the postgresql mailing list. > A simple upgrade to an SMP machine literally doubles our performance > because we are still not IO bound. I strongly suggest that everyone use > at least a single dual core because of this experience. > Performance of PHP, not postgresql. > > > > (3) Do you need an insane amount of memory? Well here's the case where > > the more expensive motherboard will serve you better since each CPU > > slot has its own bank of memory. Spend more money on memory, get > > cheaper single-core CPUs. > Agreed. A lot of times the slowest dual-core is 5x what you actually > need. So get the slowest, and bulk up on memory. If nothing else memory > is cheap today and it might not be tomorrow. [snip] Running postgresql on a single drive RAID 1 with PHP on the same machine is not a typical installation. 300ms for PHP in CPU time? wow dude - that's quite a page. PHP typical can handle up to 30-50 pages per second for a typical OLTP application on a single CPU box. Something is really wrong with that system if it takes 300ms per page. Alex. From pgsql-performance-owner@postgresql.org Thu Nov 17 16:22:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 389E9DB9AE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:22:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09450-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:22:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by svr1.postgresql.org (Postfix) with ESMTP id 7A21CDB97D for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:22:50 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Hardware/OS recommendations for large databases ( Date: Thu, 17 Nov 2005 15:22:50 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD907@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXrsSHF0O2OqsALTnO/xn1BVSgUUQAAmASQ From: "Merlin Moncure" <merlin.moncure@rcsonline.com> To: "Alex Turner" <armtuk@gmail.com> Cc: <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/326 X-Sequence-Number: 15583 > Remember - large DB is going to be IO bound. Memory will get thrashed > for file block buffers, even if you have large amounts, it's all gonna > be cycled in and out again. 'fraid I have to disagree here. I manage ERP systems for manufacturing companies of various sizes. My systems are all completely cpu bound...even though the larger database are well into two digit gigabyte sizes, the data turnover while huge is relatively constrained and well served by the O/S cache. OTOH, query latency is a *huge* factor and we do everything possible to lower it. Even if the cpu is not 100% loaded, faster processors make the application 'feel' faster to the client. Merlin From pgsql-performance-owner@postgresql.org Thu Nov 17 16:29:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6E163DB5B0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:29:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15121-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:29:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by svr1.postgresql.org (Postfix) with ESMTP id B2793DB466 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:29:50 -0400 (AST) Received: from [69.145.82.218] (unknown [69.145.82.218]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id BB51711027B for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 12:29:49 -0800 (PST) Message-ID: <437CE847.3010101@boreham.org> Date: Thu, 17 Nov 2005 13:29:59 -0700 From: David Boreham <david_list@boreham.org> Reply-To: david_list@boreham.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <200511161550.jAGFoCY09049@candle.pha.pa.us> <437B578C.4000309@boreham.org> <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> In-Reply-To: <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/327 X-Sequence-Number: 15584 Alex Turner wrote: >Just pick up a SCSI drive and a consumer ATA drive. > >Feel their weight. > > Not sure I get your point. We would want the lighter one, all things being equal, right ? (lower shipping costs, less likely to break when dropped on the floor....) From pgsql-performance-owner@postgresql.org Thu Nov 17 16:34:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B000DB982 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:34:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15132-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:34:18 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web33012.mail.mud.yahoo.com (web33012.mail.mud.yahoo.com [68.142.206.76]) by svr1.postgresql.org (Postfix) with SMTP id 7068CDB99F for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:34:15 -0400 (AST) Received: (qmail 21805 invoked by uid 60001); 17 Nov 2005 20:34:16 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=PK3XYaC1Qi4I0QWrOUtzX68QTxHaqJRHFU88fzcILE1zpaq2/8ZWJxMGLy15JAuGeTShmsm0+Ae8nX2a5cDdowENKALXQHoLZ0KLAOWbdooe+hPjThWUKAioMUUv3pRh47bn+QcRNBsa2YX6ADNxzGh6+8XJwPnCXyGCycdrmoA= ; Message-ID: <20051117203416.21803.qmail@web33012.mail.mud.yahoo.com> Received: from [65.94.98.166] by web33012.mail.mud.yahoo.com via HTTP; Thu, 17 Nov 2005 12:34:16 PST Date: Thu, 17 Nov 2005 12:34:16 -0800 (PST) From: Josel Malixi <jmalixi@yahoo.com> Subject: unsubscribe To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200511/328 X-Sequence-Number: 15585 unsubscribe __________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com From pgsql-performance-owner@postgresql.org Thu Nov 17 16:38:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C95D6D6D07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:38:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15905-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:38:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id CB728D7B8B for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:38:12 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 80C3031059; Thu, 17 Nov 2005 21:38:13 +0100 (MET) From: William Yu <wyu@talisys.com> X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Thu, 17 Nov 2005 12:38:11 -0800 Organization: Hub.Org Networking Services Lines: 74 Message-ID: <dlipnh$902$1@news.hub.org> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[ADVANCE_FEE_1=0, AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/329 X-Sequence-Number: 15586 Alex Turner wrote: > Opteron 242 - $178.00 > Opteron 242 - $178.00 > Tyan S2882 - $377.50 > Total: $733.50 > > Opteron 265 - $719.00 > Tyan K8E - $169.00 > Total: $888.00 You're comparing the wrong CPUs. The 265 is the 2x of the 244 so you'll have to bump up the price more although not enough to make a difference. Looks like the price of the 2X MBs have dropped since I last looked at it. Just a few months back, Tyan duals were $450-$500 which is what I was basing my "priced less" statement from. > Tyan K8E - doesn't have any PCI-X, so it's also not apples to apples. > Infact I couldn't find a single CPU slot board that did, so you pretty > much have to buy a dual CPU board to get PCI-X. You can get single CPU boards w/ PCIe and use PCIe controller cards. Probably expensive right now because they're so bleeding-edge new but definitely on the downswing. > a) OLTP - probably IO bound, large number of queries/sec updating info > on _disks_, not requiring much CPU activity except to retrieve item > infomration which is well indexed and normalized. Not in my experience. I find on our OLTP servers, we run 98% in RAM and hence are 100% CPU-bound. Our DB is about 50GB in size now, servers run w/ 8GB of RAM. We were *very* CPU limited running 2x244. During busy hours of the day, our avg "user transaction" time were jumping from 0.8sec to 1.3+sec. Did the 2x265 and now we're always in the 0.7sec to 0.9sec range. >>DC also gives you a better upgrade path. Let's say you do testing and >>figure 2x246 is the right setup to handle the load. Well instead of >>getting 2x1P, use the same 2P motherboard but only populate 1 CPU w/ a >>DC/270. Now you have a server that can be upgraded to +80% more CPU by >>popping in another DC/270 versus throwing out the entire thing to get a >>4x1P setup. > > > No argument there. But it's pointless if you are IO bound. Why would you just accept "we're IO bound, nothing we can do"? I'd do everything in my power to make my app go from IO bound to CPU bound -- whether by optimizing my code or buying more hardware. I can tell you if our OLTP servers were IO bound, it would run like crap. Instead of < 1 sec, we'd be looking at 5-10 seconds per "user transaction" and our users would be screaming bloody murder. In theory, you can always convert your IO bound DB to CPU bound by stuffing more and more RAM into your server. (Or partitioning the DB across multiple servers.) Whether it's cost effective depends on the DB and how much your users are paying you -- and that's a case-by-case analysis. Not a global statement of "IO-bound, pointless". >>(2) Does a DC system perform better than it's Nx1P cousin? My experience >>is yes. Did some rough tests in a drop-in-replacement 1x265 versus 2x244 >>and saw about +10% for DC. All the official benchmarks (Spec, Java, SAP, >>etc) from AMD/Sun/HP/IBM show DCs outperforming the Nx1P setups. > > > Maybe true, but the 265 does have a 25% faster FSB than the 244, which > might perhaps play a role. Nope. There's no such thing as FSB on Opterons. On-die memory controller runs @ CPU speed and hence connects at whatever the memory runs at (rounded off to some multiplier math). There's the HT speed that controls the max IO bandwidth but that's based on the motherboard, not the CPU. Plus the 265 and 244 both run at 1.8Ghz so the memory multiplier & HT IO are both the same. From pgsql-performance-owner@postgresql.org Thu Nov 17 16:38:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 629A0DB98A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:38:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14915-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:38:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 8E20EDB985 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:38:36 -0400 (AST) Received: from [10.30.1.23] ([72.16.194.3]) (authenticated bits=0) by hosting.commandprompt.com (8.13.4/8.13.4) with ESMTP id jAHKXCrF007472; Thu, 17 Nov 2005 12:33:16 -0800 Message-ID: <437CEA9B.6020401@commandprompt.com> Date: Thu, 17 Nov 2005 12:39:55 -0800 From: "Joshua D. Drake" <jd@commandprompt.com> User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: Alex Turner <armtuk@gmail.com> CC: William Yu <wyu@talisys.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <437B5859.9040805@commandprompt.com> <33c6269f0511171154t22e0bce0p803a1803f8b1a539@mail.gmail.com> In-Reply-To: <33c6269f0511171154t22e0bce0p803a1803f8b1a539@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (hosting.commandprompt.com [192.168.1.101]); Thu, 17 Nov 2005 12:33:16 -0800 (PST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/330 X-Sequence-Number: 15587 >> So what happens is that under reasonable load we are actually waiting >> for the CPU to process the code. >> >> > > This is the performance profile for PHP, not for Postgresql. This is > the post And your point? PostgreSQL benefits directly from what I am speaking about as well. >> Performance of PHP, not postgresql. >> >> Actually both. > [snip] > > Running postgresql on a single drive RAID 1 with PHP on the same > machine is not a typical installation. > Want to bet? What do you think the majority of people hosting at rackshack, rackspace, superrack etc... are doing? Or how about all those virtual hosts? > 300ms for PHP in CPU time? wow dude - that's quite a page. PHP > typical can handle up to 30-50 pages per second for a typical OLTP > application on a single CPU box. Something is really wrong with that > system if it takes 300ms per page. > There is wait time associated with that because we are hitting it with 50-100 connections at a time. Joshua D. Drake > Alex. > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Thu Nov 17 19:51:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D277D71C4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 19:51:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85431-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 23:51:51 +0000 (GMT) X-Greylist: delayed 03:10:29.601869 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id ABB00DB1D4 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 19:51:45 -0400 (AST) Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr2.postgresql.org (Postfix) with ESMTP id B1103F0B4F for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 20:41:14 +0000 (GMT) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAHKemIN018282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 17 Nov 2005 15:40:49 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAHKeK02014568; Thu, 17 Nov 2005 15:40:20 -0500 (EST) Message-ID: <437CEAD5.1090106@rentec.com> Date: Thu, 17 Nov 2005 15:40:53 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: david_list@boreham.org, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <200511161550.jAGFoCY09049@candle.pha.pa.us> <437B578C.4000309@boreham.org> <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> <437CE847.3010101@boreham.org> In-Reply-To: <437CE847.3010101@boreham.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAHKemIN018282 at Thu Nov 17 15:40:49 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/339 X-Sequence-Number: 15596 David Boreham wrote: > Alex Turner wrote: > >> Just pick up a SCSI drive and a consumer ATA drive. >> >> Feel their weight. >> >> > Not sure I get your point. We would want the lighter one, > all things being equal, right ? (lower shipping costs, less likely > to break when dropped on the floor....) Why would the lighter one be less likely to break when dropped on the floor? -- Alan From pgsql-performance-owner@postgresql.org Thu Nov 17 16:58:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EED3FDB985 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 16:58:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19485-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:58:49 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) by svr1.postgresql.org (Postfix) with ESMTP id 09A5EDB998 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:58:45 -0400 (AST) Received: by zproxy.gmail.com with SMTP id x3so22639nzd for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 12:58:47 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=bMk6fhrIIKdMvOq34pTVXdX6rb8TLGWCsNFXUDG81H9Kzyl8VQStuFGyIO62+XsRDdD0dlGNRu2YvGrKYuAqKvi4+vbPzIOAJVawbIT+jGS0PP3C/mReFPHLXcYFQLLfQ6W1CctTfbkDxb0EXdvFavm+UyDe7lstEUcktd5Tsis= Received: by 10.64.131.4 with SMTP id e4mr7798847qbd; Thu, 17 Nov 2005 12:58:46 -0800 (PST) Received: by 10.64.243.11 with HTTP; Thu, 17 Nov 2005 12:58:46 -0800 (PST) Message-ID: <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> Date: Thu, 17 Nov 2005 13:58:46 -0700 From: Joshua Marsh <icub3d@gmail.com> To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <dlipnh$902$1@news.hub.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13115_5972285.1132261126498" References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> <dlipnh$902$1@news.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/332 X-Sequence-Number: 15589 ------=_Part_13115_5972285.1132261126498 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 11/17/05, William Yu <wyu@talisys.com> wrote: > > > No argument there. But it's pointless if you are IO bound. > > Why would you just accept "we're IO bound, nothing we can do"? I'd do > everything in my power to make my app go from IO bound to CPU bound -- > whether by optimizing my code or buying more hardware. I can tell you if > our OLTP servers were IO bound, it would run like crap. Instead of < 1 > sec, we'd be looking at 5-10 seconds per "user transaction" and our > users would be screaming bloody murder. > > In theory, you can always convert your IO bound DB to CPU bound by > stuffing more and more RAM into your server. (Or partitioning the DB > across multiple servers.) Whether it's cost effective depends on the DB > and how much your users are paying you -- and that's a case-by-case > analysis. Not a global statement of "IO-bound, pointless". We all want our systems to be CPU bound, but it's not always possible. Remember, he is managing a 5 TB Databse. That's quite a bit different than = a 100 GB or even 500 GB database. ------=_Part_13115_5972285.1132261126498 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline <br><div><span class=3D"gmail_quote">On 11/17/05, <b class=3D"gmail_sendern= ame">William Yu</b> <<a href=3D"mailto:wyu@talisys.com">wyu@talisys.com<= /a>> wrote:</span><blockquote class=3D"gmail_quote" style=3D"border-left= : 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1e= x;"> > No argument there.  But it's pointless if you are IO bound.<= br><br>Why would you just accept "we're IO bound, nothing we can do&qu= ot;? I'd do<br>everything in my power to make my app go from IO bound to CP= U bound -- <br>whether by optimizing my code or buying more hardware. I can tell you i= f<br>our OLTP servers were IO bound, it would run like crap. Instead of <= ; 1<br>sec, we'd be looking at 5-10 seconds per "user transaction"= ; and our <br>users would be screaming bloody murder.<br><br>In theory, you can alway= s convert your IO bound DB to CPU bound by<br>stuffing more and more RAM in= to your server. (Or partitioning the DB<br>across multiple servers.) Whethe= r it's cost effective depends on the DB <br>and how much your users are paying you -- and that's a case-by-case<br>= analysis. Not a global statement of "IO-bound, pointless".</block= quote><div><br> We all want our systems to be CPU bound, but it's not always possible.  Remember, he is managing a 5 TB Databse.  That's quite a bit different than a 100 GB or even 500 GB database. <br>  </div><br></div> ------=_Part_13115_5972285.1132261126498-- From pgsql-performance-owner@postgresql.org Thu Nov 17 17:02:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6BE00D71C6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 17:02:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27635-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 21:02:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by svr1.postgresql.org (Postfix) with ESMTP id C65ADD6D07 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 17:02:39 -0400 (AST) Received: from [69.145.82.218] (unknown [69.145.82.218]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id BC0CE11027B for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 13:02:41 -0800 (PST) Message-ID: <437CEFFB.3060200@boreham.org> Date: Thu, 17 Nov 2005 14:02:51 -0700 From: David Boreham <david_list@boreham.org> Reply-To: david_list@boreham.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <200511161550.jAGFoCY09049@candle.pha.pa.us> <437B578C.4000309@boreham.org> <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> <437CE847.3010101@boreham.org> <437CEAD5.1090106@rentec.com> In-Reply-To: <437CEAD5.1090106@rentec.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/333 X-Sequence-Number: 15590 Alan Stange wrote: >> Not sure I get your point. We would want the lighter one, >> all things being equal, right ? (lower shipping costs, less likely >> to break when dropped on the floor....) > > Why would the lighter one be less likely to break when dropped on the > floor? They'd have less kinetic energy upon impact. From pgsql-performance-owner@postgresql.org Thu Nov 17 17:07:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A08D1DB9D6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 17:07:03 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26261-06-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 21:07:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 20790DB9A7 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 17:06:58 -0400 (AST) Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by svr2.postgresql.org (Postfix) with ESMTP id A57BFF0B59 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 21:07:00 +0000 (GMT) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jAHLFNlw025202; Thu, 17 Nov 2005 13:15:23 -0800 Message-ID: <437CF055.6020602@modgraph-usa.com> Date: Thu, 17 Nov 2005 13:04:21 -0800 From: "Craig A. James" <cjames@modgraph-usa.com> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Fuhr <mike@fuhr.org> Cc: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Re: Perl DBD and an alarming problem References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> In-Reply-To: <20051117002344.GA55377@winnie.fuhr.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.095 required=5 tests=[AWL=0.095] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200511/334 X-Sequence-Number: 15591 Thanks for the info on alarm and timeouts, this was a big help. One further comment: Michael Fuhr wrote: >> eval { >> local $SIG{ALRM} = sub {die("Timeout");}; >> $time = gettimeofday; >> alarm 20; >> $sth = $dbh->prepare("a query that may take a long time..."); >> $sth->execute(); >> alarm 0; >> }; >> if ($@ && $@ =~ /Timeout/) { >> my $elapsed = gettimeofday - $time; >> print "Timed out after $elapsed seconds"; >> } >> >>Now the mystery: It works, but it hardly matters what time I use for the >>alarm call, the actual alarm event always happens at 26 seconds... > > > High-level languages' signal handlers don't always work well with > low-level libraries... > > Is there a reason you're using alarm() in the client instead of > setting statement_timeout on the server? statement_timeout solved the problem, thanks VERY much for the pointer. To answer your question, I use alarm() because all the books and web references said that was how to do it. :-). I've used alarm() with Perl (with a 3rd-party C lib that had a potential infinite loop) very successfully. So thanks for the pointer to statement_timeout. But... When I set statement_timeout in the config file, it just didn't do anything - it never timed out (PG 8.0.3). I finally found in the documentation that I can do "set statement_timeout = xxx" from PerlDBI on a per-client basis, and that works. Craig From pgsql-performance-owner@postgresql.org Thu Nov 17 17:23:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8D152DBAD3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 17:23:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41187-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 21:23:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5F56BDBA78 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 17:22:54 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 10F0331059; Thu, 17 Nov 2005 22:22:56 +0100 (MET) From: William Yu <wyu@talisys.com> X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Thu, 17 Nov 2005 13:22:47 -0800 Organization: Hub.Org Networking Services Lines: 32 Message-ID: <dlisba$fpf$1@news.hub.org> References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> <dlipnh$902$1@news.hub.org> <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/335 X-Sequence-Number: 15592 Joshua Marsh wrote: > > On 11/17/05, *William Yu* <wyu@talisys.com <mailto:wyu@talisys.com>> wrote: > > > No argument there. But it's pointless if you are IO bound. > > Why would you just accept "we're IO bound, nothing we can do"? I'd do > everything in my power to make my app go from IO bound to CPU bound -- > whether by optimizing my code or buying more hardware. I can tell you if > our OLTP servers were IO bound, it would run like crap. Instead of < 1 > sec, we'd be looking at 5-10 seconds per "user transaction" and our > users would be screaming bloody murder. > > In theory, you can always convert your IO bound DB to CPU bound by > stuffing more and more RAM into your server. (Or partitioning the DB > across multiple servers.) Whether it's cost effective depends on the DB > and how much your users are paying you -- and that's a case-by-case > analysis. Not a global statement of "IO-bound, pointless". > > > We all want our systems to be CPU bound, but it's not always possible. > Remember, he is managing a 5 TB Databse. That's quite a bit different > than a 100 GB or even 500 GB database. I did say "in theory". :) I'm pretty sure google is more CPU bound than IO bound -- they just spread their DB over 50K servers or whatever. Not everybody is willing to pay for that but it's always in the realm of plausibility. Plus we have to go back to the statement I was replying to which was "I have yet to come across a DB system that wasn't IO bound". From pgsql-performance-owner@postgresql.org Thu Nov 17 18:19:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4BB1DB9B5 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 18:13:16 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69201-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 22:13:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by svr1.postgresql.org (Postfix) with SMTP id 26434DB96C for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 18:13:13 -0400 (AST) Received: (qmail 40787 invoked from network); 17 Nov 2005 22:13:15 -0000 Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@209.222.54.227 with login) by smtp100.rog.mail.re2.yahoo.com with SMTP; 17 Nov 2005 22:13:15 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 764414109; Thu, 17 Nov 2005 17:13:14 -0500 (EST) Date: Thu, 17 Nov 2005 17:13:14 -0500 From: Andrew Sullivan <ajs@crankycanuck.ca> To: pgsql-performance@postgresql.org Subject: Re: weird performances problem Message-ID: <20051117221314.GC26696@phlogiston.dyndns.org> References: <437CC21D.8070402@openwide.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <437CC21D.8070402@openwide.fr> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/336 X-Sequence-Number: 15593 On Thu, Nov 17, 2005 at 06:47:09PM +0100, Guillaume Smet wrote: > queries are executed fast even if they are complicated but sometimes and > for half an hour, we have a general slow down. Is it exactly half an hour? What changes at the time that happens (i.e. what else happens on the machine?). Is this a time, for example, when logrotate is killing your I/O with file moves? A -- Andrew Sullivan | ajs@crankycanuck.ca I remember when computers were frustrating because they *did* exactly what you told them to. That actually seems sort of quaint now. --J.D. Baldwin From pgsql-performance-owner@postgresql.org Thu Nov 17 19:29:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E85FAD71A8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 19:29:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82521-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 23:29:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 2B943DB98D for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 19:28:58 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jAHNSwZX049688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Nov 2005 16:29:00 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jAHNSvR4050568; Thu, 17 Nov 2005 16:28:57 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jAHNSvdR050567; Thu, 17 Nov 2005 16:28:57 -0700 (MST) (envelope-from mfuhr) Date: Thu, 17 Nov 2005 16:28:57 -0700 From: Michael Fuhr <mike@fuhr.org> To: "Craig A. James" <cjames@modgraph-usa.com> Cc: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Re: Perl DBD and an alarming problem Message-ID: <20051117232857.GA49910@winnie.fuhr.org> References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <437CF055.6020602@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/337 X-Sequence-Number: 15594 On Thu, Nov 17, 2005 at 01:04:21PM -0800, Craig A. James wrote: > When I set statement_timeout in the config file, it just didn't do anything > - it never timed out (PG 8.0.3). I finally found in the documentation that > I can do "set statement_timeout = xxx" from PerlDBI on a per-client basis, > and that works. You probably shouldn't set statement_timeout on a global basis anyway, but did you reload the server after you made the change? Setting statement_timeout in postgresql.conf and then reloading the server works here in 8.0.4. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Thu Nov 17 19:39:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3856EDB9EA for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 19:35:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83256-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 23:35:12 +0000 (GMT) X-Greylist: delayed 05:47:55.442799 by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 34533DB996 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 19:35:06 -0400 (AST) Received: from [86.200.101.246] (ALyon-254-1-66-246.w86-200.abo.wanadoo.fr [86.200.101.246]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 7CDC05DD2; Fri, 18 Nov 2005 00:35:08 +0100 (CET) Message-ID: <437D13AA.4010309@openwide.fr> Date: Fri, 18 Nov 2005 00:35:06 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc3 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Sullivan <ajs@crankycanuck.ca> CC: pgsql-performance@postgresql.org Subject: Re: weird performances problem References: <437CC21D.8070402@openwide.fr> <20051117221314.GC26696@phlogiston.dyndns.org> In-Reply-To: <20051117221314.GC26696@phlogiston.dyndns.org> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/338 X-Sequence-Number: 15595 Andrew, Andrew Sullivan wrote: > Is it exactly half an hour? What changes at the time that happens > (i.e. what else happens on the machine?). Is this a time, for > example, when logrotate is killing your I/O with file moves? No, it's not exactly half an hour. It's just that it slows down for some time (10, 20, 30 minutes) and then it's OK again. It happens several times per day. I checked if there are other processes running when we have this slow down but it's not the case. There's not really a difference between when it's OK or not (apart from the number of connections because the db is too slow): load is still at 4 or 5, iowait is still at 0%, there's still cpu idle and we still have free memory. I can't find what is the limit and why there is cpu idle. I forgot to give our non default postgresql.conf parameters: shared_buffers = 28800 sort_mem = 32768 vacuum_mem = 32768 max_fsm_pages = 350000 max_fsm_relations = 2000 checkpoint_segments = 16 effective_cache_size = 270000 random_page_cost = 2 Thanks for your help -- Guillaume From pgsql-performance-owner@postgresql.org Thu Nov 17 20:22:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5C2EFDB9AD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 20:15:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87380-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 00:15:30 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.193]) by svr1.postgresql.org (Postfix) with ESMTP id AD0ADDBA00 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 20:15:25 -0400 (AST) Received: by zproxy.gmail.com with SMTP id z3so55969nzf for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 16:15:28 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=qITIMSdlJRNqYFWXCfyQ1LqLZ64xl+V0ulBSmriB61/AXW+ISRD0QFzX3nQoC/QRGhi/93wR4qJhGlmfpRskRsaablpKCXeOeFFTEDEIYKs3xmVrJNCOns3TPUOQHfDaQG9acsKI8s5I0Ape3/O8+0HCb2dYIqSGSjFeEfzSBBg= Received: by 10.65.191.13 with SMTP id t13mr274719qbp; Thu, 17 Nov 2005 16:15:28 -0800 (PST) Received: by 10.65.192.16 with HTTP; Thu, 17 Nov 2005 16:15:28 -0800 (PST) Message-ID: <b41c75520511171615g7c0fe923l@mail.gmail.com> Date: Fri, 18 Nov 2005 01:15:28 +0100 From: Claus Guttesen <kometen@gmail.com> To: Guillaume Smet <guillaume.smet@openwide.fr> Subject: Re: weird performances problem Cc: Andrew Sullivan <ajs@crankycanuck.ca>, pgsql-performance@postgresql.org In-Reply-To: <437D13AA.4010309@openwide.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <437CC21D.8070402@openwide.fr> <20051117221314.GC26696@phlogiston.dyndns.org> <437D13AA.4010309@openwide.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/340 X-Sequence-Number: 15597 > I forgot to give our non default postgresql.conf parameters: > shared_buffers =3D 28800 > sort_mem =3D 32768 > vacuum_mem =3D 32768 > max_fsm_pages =3D 350000 > max_fsm_relations =3D 2000 > checkpoint_segments =3D 16 > effective_cache_size =3D 270000 > random_page_cost =3D 2 Isn't sort_mem quite high? Remember that sort_mem size is allocated for each sort, not for each connection. Mine is 4096 (4 MB). My effective_cache_size is set to 27462. What OS are you running? regards Claus From pgsql-performance-owner@postgresql.org Thu Nov 17 21:35:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 001F2DAC73 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 21:35:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96448-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 01:35:37 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0A6D4D9506 for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 21:35:31 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A12B531059; Fri, 18 Nov 2005 02:35:35 +0100 (MET) From: Ron Mayer <rm_pg@cheapcomplexdevices.com> X-Newsgroups: pgsql.performance Subject: Re: Help speeding up delete Date: Thu, 17 Nov 2005 17:39:48 -0800 Organization: Hub.Org Networking Services Lines: 30 Message-ID: <437D30E4.3080500@cheapcomplexdevices.com> References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> <437BDF22.9030109@familyhealth.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Christopher Kings-Lynne <chriskl@familyhealth.com.au> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <437BDF22.9030109@familyhealth.com.au> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/341 X-Sequence-Number: 15598 Christopher Kings-Lynne wrote: >>> >>> Quite seriously, if you're still using 7.2.4 for production purposes >>> you could justifiably be accused of negligence.... >> >> Perhaps we should put a link on the home page underneath LATEST RELEASEs >> saying >> 7.2: de-supported >> with a link to a scary note along the lines of the above. > > I strongly support an explicit desupported notice for 7.2 and below on > the website... I'd go so far as to say the version #s of supported versions is one of pieces of information I'd most expect to see on the main support page ( http://www.postgresql.org/support/ ). Perhaps it'd be nice to even show a table like Version Released On Support Ends 7.1 4 BC Sep 3 1752 7.2 Feb 31 1900 Jan 0 2000 7.4 2003-11-17 At least 2005-x-x 8.0 2005-01-19 At least 2006-x-x with a footnote saying that only the most recent dot release of each family is considered supported. It also might be nice to have a footnote saying that any of the commercical support companies might support the older versions for longer periods of time. From pgsql-performance-owner@postgresql.org Thu Nov 17 21:50:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 825DDDB726 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 21:50:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09259-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 01:51:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 356FFDB71D for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 21:50:53 -0400 (AST) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id AD0DA25079; Fri, 18 Nov 2005 09:50:56 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 2877D25078; Fri, 18 Nov 2005 09:50:51 +0800 (WST) Message-ID: <437D34CC.9080200@familyhealth.com.au> Date: Fri, 18 Nov 2005 09:56:28 +0800 From: Christopher Kings-Lynne <chriskl@familyhealth.com.au> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Steinar H. Gunderson" <sgunderson@bigfoot.com> Cc: pgsql-performance@postgresql.org Subject: Re: Help speeding up delete References: <43790A99.9050603@noao.edu> <4162.1132011763@sss.pgh.pa.us> <1132171206.4959.60.camel@localhost.localdomain> <437BDF9A.4060700@familyhealth.com.au> <20051117111927.GB26459@uio.no> <437C9CBE.8020907@familyhealth.com.au> <20051117172511.GA28121@uio.no> In-Reply-To: <20051117172511.GA28121@uio.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-familyhealth-MailScanner-Information: Please contact the ISP for more information X-familyhealth-MailScanner: Found to be clean X-familyhealth-MailScanner-From: chriskl@familyhealth.com.au X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.02 required=5 tests=[AWL=0.020] X-Spam-Score: 0.02 X-Spam-Level: X-Archive-Number: 200511/342 X-Sequence-Number: 15599 > I do not really see why all the distributions could do something like this, > instead of mucking around with special statically compiled pg_dumps and the > like... Contrib modules and tablespaces. Plus, no version of pg_dump before 8.0 is able to actually perform such reliable dumps and reloads (due to bugs). However, that's probably moot these days. Chris From pgsql-performance-owner@postgresql.org Fri Nov 18 01:37:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4781D78B6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 17 Nov 2005 23:46:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34867-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 03:46:38 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 2C7FED719A for <pgsql-performance@postgresql.org>; Thu, 17 Nov 2005 23:46:31 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jAI3kWQ1049884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Nov 2005 20:46:34 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jAI3kVRJ070282; Thu, 17 Nov 2005 20:46:31 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jAI3kVGM070281; Thu, 17 Nov 2005 20:46:31 -0700 (MST) (envelope-from mfuhr) Date: Thu, 17 Nov 2005 20:46:31 -0700 From: Michael Fuhr <mike@fuhr.org> To: "Craig A. James" <cjames@modgraph-usa.com> Cc: pgsql-performance@postgresql.org Subject: Re: Perl DBD and an alarming problem Message-ID: <20051118034631.GA70159@winnie.fuhr.org> References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <437D3085.9040207@modgraph-usa.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/345 X-Sequence-Number: 15602 [Please copy the mailing list on replies.] On Thu, Nov 17, 2005 at 05:38:13PM -0800, Craig A. James wrote: > >You probably shouldn't set statement_timeout on a global basis > >anyway > > The server is a "one trick pony" so setting a global timeout value is > actually appropriate. Beware that statement_timeout also applies to maintenance commands like VACUUM; it might be more appropriate to set per-user timeouts with ALTER USER. If you do set a global timeout then you might want to set a per-user timeout of 0 for database superusers so maintenance activities don't get timed out. > >... but did you reload the server after you made the change? > >Setting statement_timeout in postgresql.conf and then reloading the > >server works here in 8.0.4. > > Yes. By "reload" I assume you mean restarting it from scratch. Either a restart or a "pg_ctl reload", which sends a SIGHUP to the server. You can effect some changes by sending a signal to a running server without having to restart it entirely. > In this case, I use > > /etc/init.d/postgresql restart > > It definitely had no effect at all. I tried values clear down to 1 > millisecond, but the server never timed out for any query. Did you use "SHOW statement_timeout" to see if the value was set to what you wanted? Are you sure you edited the right file? As a database superuser execute "SHOW config_file" to see what file the server is using. What exactly did the line look like after you changed it? -- Michael Fuhr From pgsql-performance-owner@postgresql.org Fri Nov 18 01:16:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E5019D719A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 00:58:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43077-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 04:58:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 7D6F5DB7B0 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 00:58:53 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EcyKj-00071r-00; Thu, 17 Nov 2005 23:58:45 -0500 To: Joshua Marsh <icub3d@gmail.com> Cc: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> <dlipnh$902$1@news.hub.org> <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> In-Reply-To: <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 17 Nov 2005 23:58:45 -0500 Message-ID: <873blur1q2.fsf@stark.xeocode.com> Lines: 14 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/343 X-Sequence-Number: 15600 Joshua Marsh <icub3d@gmail.com> writes: > We all want our systems to be CPU bound, but it's not always possible. Sure it is, let me introduce you to my router, a 486DX100... Ok, I guess that wasn't very helpful, I admit. -- greg From pgsql-performance-owner@postgresql.org Fri Nov 18 01:23:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A285DB7B0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 01:17:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45057-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 05:17:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id AB0F5DB745 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 01:17:18 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Ecycd-0007EV-00; Fri, 18 Nov 2005 00:17:15 -0500 To: Joshua Marsh <icub3d@gmail.com> Cc: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <3E37B936B592014B978C4415F90D662D01995F7B@MI8NYCMAIL06.Mi8.com> <33c6269f0511152115v1a34ab81j30f1f5df5a6c6956@mail.gmail.com> <dlfjgf$41b$1@news.hub.org> <33c6269f0511171148q7ea67482xd595ea5717956aa2@mail.gmail.com> <dlipnh$902$1@news.hub.org> <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> In-Reply-To: <38242de90511171258v22f334f3ua474a8aa99bdc29d@mail.gmail.com> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 18 Nov 2005 00:17:15 -0500 Message-ID: <87zmo2pmas.fsf@stark.xeocode.com> Lines: 19 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/344 X-Sequence-Number: 15601 Joshua Marsh <icub3d@gmail.com> writes: > We all want our systems to be CPU bound, but it's not always possible. > Remember, he is managing a 5 TB Databse. That's quite a bit different than a > 100 GB or even 500 GB database. Ok, a more productive point: it's not really the size of the database that controls whether you're I/O bound or CPU bound. It's the available I/O bandwidth versus your CPU speed. If your I/O subsystem can feed data to your CPU as fast as it can consume it then you'll be CPU bound no matter how much data you have in total. It's harder to scale up I/O subsystems than CPUs, instead of just replacing a CPU it tends to mean replacing the whole system to get a better motherboard with a faster, better bus, as well as adding more controllers and more disks. -- greg From pgsql-performance-owner@postgresql.org Fri Nov 18 02:08:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B69A2DB4C2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 02:08:03 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47937-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 06:08:02 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id C3423DA387 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 02:08:00 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 01:07:55 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 01:07:55 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 01:07:54 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 17 Nov 2005 22:07:54 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com> cc: pgsql-performance@postgresql.org Message-ID: <BFA2AFBA.13FC4%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsARNdwzQ0YbPFQJC9u/hNHCb98wABVaAV In-Reply-To: <87zmo2pmas.fsf@stark.xeocode.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 06:07:55.0088 (UTC) FILETIME=[6A835D00:01C5EC06] X-WSS-ID: 6F63B03121G13205170-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/346 X-Sequence-Number: 15603 Greg, On 11/17/05 9:17 PM, "Greg Stark" <gsstark@mit.edu> wrote: > Ok, a more productive point: it's not really the size of the database that > controls whether you're I/O bound or CPU bound. It's the available I/O > bandwidth versus your CPU speed. Postgres + Any x86 CPU from 2.4GHz up to Opteron 280 is CPU bound after 110MB/s of I/O. This is true of Postgres 7.4, 8.0 and 8.1. A $1,000 system with one CPU and two SATA disks in a software RAID0 will perform exactly the same as a $80,000 system with 8 dual core CPUs and the world's best SCSI RAID hardware on a large database for decision support (what the poster asked about). Regards, - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 08:58:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF79DDB985 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 08:58:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16590-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:58:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 841DADB9E7 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 08:58:40 -0400 (AST) Received: (qmail 15708 invoked from network); 18 Nov 2005 12:58:44 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 18 Nov 2005 12:58:44 -0000 In-Reply-To: <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> References: <200511161550.jAGFoCY09049@candle.pha.pa.us> <437B578C.4000309@boreham.org> <33c6269f0511171150j24f2dd2bq607b69994338aa9@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <012EB91C-667A-495F-B4F2-F14EE7162ABA@fastcrypt.com> Cc: David Boreham <david_list@boreham.org>, pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer <pg@fastcrypt.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 07:58:43 -0500 To: Alex Turner <armtuk@gmail.com> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/347 X-Sequence-Number: 15604 On 17-Nov-05, at 2:50 PM, Alex Turner wrote: > Just pick up a SCSI drive and a consumer ATA drive. > > Feel their weight. > > You don't have to look inside to tell the difference. At one point stereo manufacturers put weights in the case just to make them heavier. The older ones weighed more and the consumer liked heavy stereos. Be careful what you measure. Dave > > Alex > > On 11/16/05, David Boreham <david_list@boreham.org> wrote: >> >> >> I suggest you read this on the difference between enterprise/SCSI >> and >> desktop/IDE drives: >> >> http://www.seagate.com/content/docs/pdf/whitepaper/ >> D2c_More_than_Interface_ATA_vs_SCSI_042003.pdf >> >> >> This is exactly the kind of vendor propaganda I was talking about >> and it proves my point quite well : that there's nothing specific >> relating >> to reliability that is different between SCSI and SATA drives >> cited in that >> paper. >> It does have a bunch of FUD such as 'oh yeah we do a lot more >> drive characterization during manufacturing'. >> >> >> >> > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > From pgsql-performance-owner@postgresql.org Fri Nov 18 09:00:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E2D9ADB8C6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 09:00:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17733-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:00:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 026AEDB77A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 09:00:10 -0400 (AST) Received: (qmail 15714 invoked from network); 18 Nov 2005 13:00:14 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 18 Nov 2005 13:00:14 -0000 In-Reply-To: <BFA2AFBA.13FC4%llonergan@greenplum.com> References: <BFA2AFBA.13FC4%llonergan@greenplum.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> Cc: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer <pg@fastcrypt.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 08:00:17 -0500 To: Luke Lonergan <llonergan@greenplum.com> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/348 X-Sequence-Number: 15605 On 18-Nov-05, at 1:07 AM, Luke Lonergan wrote: > Greg, > > > On 11/17/05 9:17 PM, "Greg Stark" <gsstark@mit.edu> wrote: > >> Ok, a more productive point: it's not really the size of the >> database that >> controls whether you're I/O bound or CPU bound. It's the available >> I/O >> bandwidth versus your CPU speed. > > Postgres + Any x86 CPU from 2.4GHz up to Opteron 280 is CPU bound > after > 110MB/s of I/O. This is true of Postgres 7.4, 8.0 and 8.1. > > A $1,000 system with one CPU and two SATA disks in a software RAID0 > will > perform exactly the same as a $80,000 system with 8 dual core CPUs > and the > world's best SCSI RAID hardware on a large database for decision > support > (what the poster asked about). Now there's an interesting line drawn in the sand. I presume you have numbers to back this up ? This should draw some interesting posts. Dave > > Regards, > > - Luke > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > From pgsql-performance-owner@postgresql.org Fri Nov 18 09:22:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DFF1EDB985 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 09:22:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17605-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:22:45 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 5DD6ADB9FA for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 09:22:39 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id CAE77434448; Fri, 18 Nov 2005 13:22:33 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 1261D15EA4; Fri, 18 Nov 2005 13:22:42 +0000 (GMT) Message-ID: <437DD5A1.1090605@archonet.com> Date: Fri, 18 Nov 2005 13:22:41 +0000 From: Richard Huxton <dev@archonet.com> User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Cramer <pg@fastcrypt.com> Cc: Luke Lonergan <llonergan@greenplum.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA2AFBA.13FC4%llonergan@greenplum.com> <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> In-Reply-To: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/349 X-Sequence-Number: 15606 Dave Cramer wrote: > > On 18-Nov-05, at 1:07 AM, Luke Lonergan wrote: > >> Postgres + Any x86 CPU from 2.4GHz up to Opteron 280 is CPU bound after >> 110MB/s of I/O. This is true of Postgres 7.4, 8.0 and 8.1. >> >> A $1,000 system with one CPU and two SATA disks in a software RAID0 will >> perform exactly the same as a $80,000 system with 8 dual core CPUs >> and the >> world's best SCSI RAID hardware on a large database for decision support >> (what the poster asked about). > > > Now there's an interesting line drawn in the sand. I presume you have > numbers to back this up ? > > This should draw some interesting posts. Well, I'm prepared to swap Luke *TWO* $1000 systems for one $80,000 system if he's got one going :-) -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Nov 18 13:31:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 71566DB985 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 09:30:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20717-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:30:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id E83FDDB9F2 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 09:30:49 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 08:30:37 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 08:30:37 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 08:30:36 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 05:30:34 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Richard Huxton" <dev@archonet.com>, "Dave Cramer" <pg@fastcrypt.com> cc: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA3177A.14008%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsQzAxqdsQTWT6QCueM+k0hrU5HAAARCrh In-Reply-To: <437DD5A1.1090605@archonet.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 13:30:37.0387 (UTC) FILETIME=[42E089B0:01C5EC44] X-WSS-ID: 6F6308F721G13412697-01-01 Content-Type: multipart/alternative; boundary=B_3215136635_1770200 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/360 X-Sequence-Number: 15617 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215136635_1770200 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Richard, On 11/18/05 5:22 AM, "Richard Huxton" <dev@archonet.com> wrote: > Well, I'm prepared to swap Luke *TWO* $1000 systems for one $80,000 > system if he's got one going :-) Finally, a game worth playing! Except it=B9s backward =AD I=B9ll show you 80 $1,000 systems performing 80 times faster than one $80,000 system. On your proposition =AD I don=B9t have any $80,000 systems for trade, do you? - Luke --B_3215136635_1770200 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Richa= rd,<BR> <BR> On 11/18/05 5:22 AM, "Richard Huxton" <dev@archonet.com> wr= ote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>Well, I'm prepared to swap Luke *TWO* $1000 systems for= one $80,000<BR> system if he's got one going :-)<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> Finally, a game worth playing!<BR> <BR> Except it’s backward – I’ll show you 80 $1,000 systems pe= rforming 80 times faster than one $80,000 system.<BR> <BR> On your proposition – I don’t have any $80,000 systems for trad= e, do you?<BR> <BR> - Luke</SPAN></FONT> </BODY> </HTML> --B_3215136635_1770200-- From pgsql-performance-owner@postgresql.org Fri Nov 18 12:25:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 710BCDB985 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 09:42:15 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21424-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:42:17 +0000 (GMT) X-Greylist: delayed 17:01:00.223893 by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 63DE9DB965 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 09:42:11 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIDftn9018179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 08:41:57 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAIDfNr0018317; Fri, 18 Nov 2005 08:41:23 -0500 (EST) Message-ID: <437DDA26.4000603@rentec.com> Date: Fri, 18 Nov 2005 08:41:58 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 CC: Dave Cramer <pg@fastcrypt.com>, Luke Lonergan <llonergan@greenplum.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA2AFBA.13FC4%llonergan@greenplum.com> <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> <437DD5A1.1090605@archonet.com> In-Reply-To: <437DD5A1.1090605@archonet.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAIDftn9018179 at Fri Nov 18 08:41:57 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.095 required=5 tests=[AWL=-0.095, MISSING_HEADERS=0.189] X-Spam-Score: 0.095 X-Spam-Level: X-Archive-Number: 200511/359 X-Sequence-Number: 15616 Richard Huxton wrote: > Dave Cramer wrote: >> >> On 18-Nov-05, at 1:07 AM, Luke Lonergan wrote: >> >>> Postgres + Any x86 CPU from 2.4GHz up to Opteron 280 is CPU bound >>> after >>> 110MB/s of I/O. This is true of Postgres 7.4, 8.0 and 8.1. >>> >>> A $1,000 system with one CPU and two SATA disks in a software RAID0 >>> will >>> perform exactly the same as a $80,000 system with 8 dual core CPUs >>> and the >>> world's best SCSI RAID hardware on a large database for decision >>> support >>> (what the poster asked about). >> >> >> Now there's an interesting line drawn in the sand. I presume you >> have numbers to back this up ? >> >> This should draw some interesting posts. That's interesting, as I occasionally see more than 110MB/s of postgresql IO on our system. I'm using a 32KB block size, which has been a huge win in performance for our usage patterns. 300GB database with a lot of turnover. A vacuum analyze now takes about 3 hours, which is much shorter than before. Postgresql 8.1, dual opteron, 8GB memory, Linux 2.6.11, FC drives. -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 12:20:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C2A0DBA26 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 09:47:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20961-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:47:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 50BF4DBA5F for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 09:47:03 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 18 Nov 2005 08:47:00 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 08:47:00 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 08:46:59 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 05:46:58 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA31B52.14012%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsReV45/v76ff9T2yQxgfgf3wdzwAAKXmW In-Reply-To: <437DDA26.4000603@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 13:47:00.0177 (UTC) FILETIME=[8CAA6410:01C5EC46] X-WSS-ID: 6F6304DE2RS9387233-03-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/358 X-Sequence-Number: 15615 Alan, On 11/18/05 5:41 AM, "Alan Stange" <stange@rentec.com> wrote: > > That's interesting, as I occasionally see more than 110MB/s of > postgresql IO on our system. I'm using a 32KB block size, which has > been a huge win in performance for our usage patterns. 300GB database > with a lot of turnover. A vacuum analyze now takes about 3 hours, which > is much shorter than before. Postgresql 8.1, dual opteron, 8GB memory, > Linux 2.6.11, FC drives. 300GB / 3 hours = 27MB/s. If you are using the 2.6 linux kernel, you may be fooled into thinking you burst more than you actually get in net I/O because the I/O stats changed in tools like iostat and vmstat. The only meaningful stats are (size of data) / (time to process data). Do a sequential scan of one of your large tables that you know the size of, then divide by the run time and report it. I'm compiling some new test data to make my point now. Regards, - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 12:00:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 865CADBA64 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 09:47:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22119-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:47:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 12B46DBA26 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 09:47:36 -0400 (AST) Received: (qmail 15951 invoked from network); 18 Nov 2005 13:47:41 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 18 Nov 2005 13:47:41 -0000 In-Reply-To: <BFA3177A.14008%llonergan@greenplum.com> References: <BFA3177A.14008%llonergan@greenplum.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/alternative; boundary=Apple-Mail-52--604358616 Message-Id: <B06243D5-43B8-4D4F-A065-A000C2BD7207@fastcrypt.com> Cc: "Richard Huxton" <dev@archonet.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org From: Dave Cramer <pg@fastcrypt.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 08:47:43 -0500 To: Luke Lonergan <llonergan@greenplum.com> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/354 X-Sequence-Number: 15611 --Apple-Mail-52--604358616 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed On 18-Nov-05, at 8:30 AM, Luke Lonergan wrote: > Richard, > > On 11/18/05 5:22 AM, "Richard Huxton" <dev@archonet.com> wrote: > >> Well, I'm prepared to swap Luke *TWO* $1000 systems for one $80,000 >> system if he's got one going :-) > > Finally, a game worth playing! > > Except it=92s backward =96 I=92ll show you 80 $1,000 systems = performing =20 > 80 times faster than one $80,000 system. Now you wouldn't happen to be selling a system that would enable this =20= for postgres, now would ya ? > > On your proposition =96 I don=92t have any $80,000 systems for trade, =20= > do you? > > - Luke --Apple-Mail-52--604358616 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=WINDOWS-1252 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 18-Nov-05, at = 8:30 AM, Luke Lonergan wrote:</DIV><BR = class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"> <FONT = face=3D"Verdana, Helvetica, Arial"><SPAN = style=3D"font-size:14.0px">Richard,<BR> <BR> On 11/18/05 5:22 AM, = "Richard Huxton" <<A = href=3D"mailto:dev@archonet.com">dev@archonet.com</A>> wrote:<BR> = <BR> </SPAN></FONT><BLOCKQUOTE type=3D"cite"><FONT face=3D"Verdana, = Helvetica, Arial"><SPAN style=3D"font-size:14.0px">Well, I'm prepared to = swap Luke *TWO* $1000 systems for one $80,000<BR> system if he's got one = going :-)<BR> </SPAN></FONT></BLOCKQUOTE><FONT face=3D"Verdana, = Helvetica, Arial"><SPAN style=3D"font-size:14.0px"><BR> Finally, a game = worth playing!<BR> <BR> Except it=92s backward =96 I=92ll show you 80 = $1,000 systems performing 80 times faster than one $80,000 = system.<BR></SPAN></FONT></BLOCKQUOTE>Now you wouldn't happen to be = selling a system that would enable this for postgres, now would ya = ?<BR><BLOCKQUOTE type=3D"cite"><FONT face=3D"Verdana, Helvetica, = Arial"><SPAN style=3D"font-size:14.0px"> <BR> On your proposition =96 I = don=92t have any $80,000 systems for trade, do you?<BR> <BR> - = Luke</SPAN></FONT> </BLOCKQUOTE></DIV><BR></BODY></HTML>= --Apple-Mail-52--604358616-- From pgsql-performance-owner@postgresql.org Fri Nov 18 11:36:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E7CEDBA5F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 10:04:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25064-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 14:05:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 23503DB77A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 10:04:55 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 18 Nov 2005 09:04:47 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 09:04:25 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 09:04:24 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 06:04:24 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Dave Cramer" <pg@fastcrypt.com> cc: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA31F68.14017%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsQAi9HGMh4pFwSiam1ZsLnxnClAACPIaY In-Reply-To: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 14:04:25.0376 (UTC) FILETIME=[FBA71A00:01C5EC48] X-WSS-ID: 6F6300E531S14414958-23-01 Content-Type: multipart/alternative; boundary=B_3215138664_1920020 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/352 X-Sequence-Number: 15609 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215138664_1920020 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Dave, On 11/18/05 5:00 AM, "Dave Cramer" <pg@fastcrypt.com> wrote: >=20 > Now there's an interesting line drawn in the sand. I presume you have > numbers to back this up ? >=20 > This should draw some interesting posts. OK, here we go: The $1,000 system (System A): - I bought 16 of these in 2003 for $1,200 each. They have Intel or Asus motherboards, Intel P4 3.0GHz CPUs with an 800MHz FSB. They have a system drive and two RAID0 SATA drives, the Western Digital 74GB Raptor (10K RPM). They have 1GB of RAM. * A test of write and read performance on the RAID0: > [llonergan@kite4 raid0]$ time dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D2500= 00 > 250000+0 records in > 250000+0 records out >=20 > real 0m17.453s > user 0m0.249s > sys 0m10.246s > [llonergan@kite4 raid0]$ time dd if=3Dbigfile of=3D/dev/null bs=3D8k > 250000+0 records in > 250000+0 records out >=20 > real 0m18.930s > user 0m0.130s > sys 0m3.590s > So, the write performance is 114MB/s and read performance is 106MB/s. The $6,000 system (System B): * I just bought 5 of these systems for $6,000 each. They are dual Opteron systems with 8GB of RAM and 2x 250 model CPUs, which are close to the fastest. They have the new 3Ware 9550SX SATA RAID adapters coupled to Western Digital 400GB RE2 model hard drives. They are organized as a RAID5= . * A test of write and read performance on the RAID5: > [root@modena2 dbfast1]# time dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D20000= 00 > 2000000+0 records in > 2000000+0 records out >=20 > real 0m51.441s > user 0m0.288s > sys 0m29.119s >=20 > [root@modena2 dbfast1]# time dd if=3Dbigfile of=3D/dev/null bs=3D8k > 2000000+0 records in > 2000000+0 records out >=20 > real 0m39.605s > user 0m0.244s > sys 0m19.207s >=20 > So, the write performance is 314MB/s and read performance is 404MB/s (!) = This > is the fastest I=B9ve seen 8 disk drives perform. >=20 So, the question is: which of these systems (A or B) can scan a large table faster using non-MPP postgres? How much faster would you wager? Send your answer, and I=B9ll post the result. Regards, - Luke --B_3215138664_1920020 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Dave,= <BR> <BR> <BR> On 11/18/05 5:00 AM, "Dave Cramer" <pg@fastcrypt.com> wrote= :<BR> <FONT COLOR=3D"#0000FF">> <BR> > Now there's an interesting line drawn in the sand. I presume you have = <BR> > numbers to back this up ?<BR> > <BR> > This should draw some interesting posts.<BR> </FONT><BR> OK, here we go:<BR> <BR> The $1,000 system (System A):<BR> <BR> - I bought 16 of these in 2003 for $1,200 each. They have Intel or Asus mot= herboards, Intel P4 3.0GHz CPUs with an 800MHz FSB.  They have a system= drive and two RAID0 SATA drives, the Western Digital 74GB Raptor (10K RPM).=  They have 1GB of RAM.<BR> <BR> </SPAN></FONT><UL><LI><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'f= ont-size:14.0px'>A test of write and read performance on the RAID0:<BR> </SPAN></FONT></UL><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font= -size:14.0px'><BR> </SPAN></FONT><BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Courie= r New">[llonergan@kite4 raid0]$ time dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D= 250000<BR> 250000+0 records in<BR> 250000+0 records out<BR> <BR> real    0m17.453s<BR> user    0m0.249s<BR> sys     0m10.246s<BR> </FONT></SPAN></BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verda= na, Helvetica, Arial"><BR> </FONT></SPAN><BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Courie= r New">[llonergan@kite4 raid0]$ time dd if=3Dbigfile of=3D/dev/null bs=3D8k<BR> 250000+0 records in<BR> 250000+0 records out<BR> <BR> real    0m18.930s<BR> user    0m0.130s<BR> sys     0m3.590s<BR> </FONT></SPAN></BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verda= na, Helvetica, Arial"><BR> </FONT></SPAN><BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verdan= a, Helvetica, Arial">So, the write performance is 114MB/s and read performan= ce is 106MB/s.<BR> </FONT></SPAN></BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verda= na, Helvetica, Arial"><BR> The $6,000 system (System B):<BR> <BR> </FONT></SPAN><UL><LI><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verdana, H= elvetica, Arial">I just bought 5 of these systems for $6,000 each.  The= y are dual Opteron systems with 8GB of RAM and 2x 250 model CPUs, which are = close to the fastest.  They have the new 3Ware 9550SX SATA RAID adapter= s coupled to  Western Digital 400GB RE2 model hard drives.  They a= re organized as a RAID5.<BR> </FONT></SPAN></UL><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verdana, Helv= etica, Arial"><BR> </FONT></SPAN><UL><LI><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verdana, H= elvetica, Arial">A test of write and read performance on the RAID5:<BR> </FONT></SPAN></UL><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verdana, Helv= etica, Arial"><BR> </FONT></SPAN><BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Courie= r New">[root@modena2 dbfast1]# time dd if=3D/dev/zero of=3Dbigfile bs=3D8k count=3D2= 000000<BR> 2000000+0 records in<BR> 2000000+0 records out<BR> <BR> real    0m51.441s<BR> user    0m0.288s<BR> sys     0m29.119s<BR> <BR> [root@modena2 dbfast1]# time dd if=3Dbigfile of=3D/dev/null bs=3D8k<BR> 2000000+0 records in<BR> 2000000+0 records out<BR> <BR> real    0m39.605s<BR> user    0m0.244s<BR> sys     0m19.207s<BR> <BR> </FONT><FONT FACE=3D"Verdana, Helvetica, Arial">So, the write performance is = 314MB/s and read performance is 404MB/s (!)  This is the fastest I̵= 7;ve seen 8 disk drives perform.<BR> <BR> </FONT></SPAN></BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verda= na, Helvetica, Arial">So, the question is: which of these systems (A or B) c= an scan a large table faster using non-MPP postgres?  How much faster w= ould you wager?<BR> <BR> Send your answer, and I’ll post the result.<BR> <BR> Regards,<BR> <BR> - Luke</FONT></SPAN> </BODY> </HTML> --B_3215138664_1920020-- From pgsql-performance-owner@postgresql.org Fri Nov 18 10:56:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F5D4DB8FD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 10:47:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26659-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 14:47:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id C7C98DB77A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 10:47:47 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIEkoVE020786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 09:46:51 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAIEkK7Y025463; Fri, 18 Nov 2005 09:46:20 -0500 (EST) Message-ID: <437DE960.9070606@rentec.com> Date: Fri, 18 Nov 2005 09:46:56 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA31B52.14012%llonergan@greenplum.com> In-Reply-To: <BFA31B52.14012%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAIEkoVE020786 at Fri Nov 18 09:46:51 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200511/350 X-Sequence-Number: 15607 Luke Lonergan wrote: > Alan, > > On 11/18/05 5:41 AM, "Alan Stange" <stange@rentec.com> wrote: > > >> That's interesting, as I occasionally see more than 110MB/s of >> postgresql IO on our system. I'm using a 32KB block size, which has >> been a huge win in performance for our usage patterns. 300GB database >> with a lot of turnover. A vacuum analyze now takes about 3 hours, which >> is much shorter than before. Postgresql 8.1, dual opteron, 8GB memory, >> Linux 2.6.11, FC drives. >> > > 300GB / 3 hours = 27MB/s. > That's 3 hours under load, with 80 compute clients beating on the database at the same time. We have the stats turned way up, so the analyze tends to read a big chunk of the tables a second time as well. We typically don't have three hours a day of idle time. -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 11:41:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F1A8DBAAE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 11:01:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27132-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:01:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by svr1.postgresql.org (Postfix) with ESMTP id B36A1DBAA4 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:00:57 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=ga4fEG4e5dsrDnq72MTJ8fd2V1p6p77SNd5+kb440/DDvkRjKf3Dm+VchHBUchAg; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [71.243.20.20] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Ed7jZ-00061e-BO; Fri, 18 Nov 2005 10:01:01 -0500 Message-Id: <6.2.5.6.0.20051118092018.03b6cba0@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Fri, 18 Nov 2005 10:00:56 -0500 To: "Luke Lonergan" <llonergan@greenplum.com>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <BFA2AFBA.13FC4%llonergan@greenplum.com> References: <87zmo2pmas.fsf@stark.xeocode.com> <BFA2AFBA.13FC4%llonergan@greenplum.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcea7568f56d9b8dfc9f309d8278238e95350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.20.20 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200511/353 X-Sequence-Number: 15610 While I agree with you in principle that pg becomes CPU bound relatively easily compared to other DB products (at ~110-120MBps according to a recent thread), there's a bit of hyperbole in your post. a. There's a big difference between the worst performing 1C x86 ISA CPU available and the best performing 2C one (IIRC, that's the 2.4GHz, 1MB L2 cache AMDx2 4800+ as of this writing) b. Two 2C CPU's vs one 1C CPU means that a pg process will almost never be waiting on other non pg processes. It also means that 3-4 pg processes, CPU bound or not, can execute in parallel. Not an option with one 1C CPU. c. Mainboards with support for multiple CPUs and lots' of RAM are _not_ the cheap ones. d. No one should ever use RAID 0 for valuable data. Ever. So at the least you need 4 HD's for a RAID 10 set (RAID 5 is not a good option unless write performance is unimportant. 4HD RAID 5 is particularly not a good option.) e. The server usually needs to talk to things over a network connection. Often performance here matters. Mainboards with 2 1GbE NICs and/or PCI-X (or PCI-E) slots for 10GbE cards are not the cheap ones. f. Trash HDs mean poor IO performance and lower reliability. While TOTL 15Krpm 4Gb FC HDs are usually overkill (Not always. It depends on context.), you at least want SATA II HDs with NCQ or TCQ support. And you want them to have a decent media warranty- preferably a 5 year one if you can get it. Again, these are not the cheapest HD's available. g. Throughput limitations say nothing about latency considerations. OLTP-like systems _want_ HD spindles. AMAP. Even non OLTP-like systems need a fair number of spindles to optimize HD IO: dedicated WAL set, multiple dedicated DB sets, dedicated OS and swap space set, etc, etc. At 50MBps ASTR, you need 16 HD's operating in parallel to saturate the bandwidth of a PCI-X channel. That's ~8 independent pg tasks (queries using different tables, dedicated WAL IO, etc) running in parallel. Regardless of application domain. h. Decent RAID controllers and HBAs are not cheap either. Even SW RAID benefits from having a big dedicated RAM buffer to talk to. While the above may not cost you $80K, it sure isn't costing you $1K either. Maybe ~$15-$20K, but not $1K. Ron At 01:07 AM 11/18/2005, Luke Lonergan wrote: >Greg, > > >On 11/17/05 9:17 PM, "Greg Stark" <gsstark@mit.edu> wrote: > > > Ok, a more productive point: it's not really the size of the database that > > controls whether you're I/O bound or CPU bound. It's the available I/O > > bandwidth versus your CPU speed. > >Postgres + Any x86 CPU from 2.4GHz up to Opteron 280 is CPU bound after >110MB/s of I/O. This is true of Postgres 7.4, 8.0 and 8.1. > >A $1,000 system with one CPU and two SATA disks in a software RAID0 will >perform exactly the same as a $80,000 system with 8 dual core CPUs and the >world's best SCSI RAID hardware on a large database for decision support >(what the poster asked about). > >Regards, > >- Luke > > > >---------------------------(end of broadcast)--------------------------- >TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match From pgsql-performance-owner@postgresql.org Fri Nov 18 11:24:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 262AFD82C0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 11:13:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30513-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:13:59 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id 17DBAD6D50 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:13:52 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 10:13:43 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 10:13:43 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 10:13:42 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 07:13:42 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Dave Cramer" <pg@fastcrypt.com> cc: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA32FA6.14027%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsQAi9HGMh4pFwSiam1ZsLnxnClAAEqB0s In-Reply-To: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 15:13:43.0481 (UTC) FILETIME=[AA139290:01C5EC52] X-WSS-ID: 6F63302D21G13482411-01-01 Content-Type: multipart/alternative; boundary=B_3215142822_2162763 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/351 X-Sequence-Number: 15608 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215142822_2162763 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Dave, On 11/18/05 5:00 AM, "Dave Cramer" <pg@fastcrypt.com> wrote: >=20 > Now there's an interesting line drawn in the sand. I presume you have > numbers to back this up ? >=20 > This should draw some interesting posts. Part 2: The answer System A: > This system is running RedHat 3 Update 4, with a Fedora 2.6.10 Linux kern= el. >=20 > On a single table with 15 columns (the Bizgres IVP) at a size double memo= ry > (2.12GB), Postgres 8.0.3 with Bizgres enhancements takes 32 seconds to sc= an > the table: that=B9s 66 MB/s. Not the efficiency I=B9d hope from the onboard = SATA > controller that I=B9d like, I would have expected to get 85% of the 100MB/s= raw > read performance. >=20 > So that=B9s $1,200 / 66 MB/s (without adjusting for 2003 price versus now) = =3D > 18.2 $/MB/s >=20 > Raw data: > [llonergan@kite4 IVP]$ cat scan.sh > #!/bin/bash >=20 > time psql -c "select count(*) from ivp.bigtable1" dgtestdb > [llonergan@kite4 IVP]$ cat sysout1 > count =20 > ---------- > 10000000 > (1 row) >=20 >=20 > real 0m32.565s > user 0m0.002s > sys 0m0.003s >=20 > Size of the table data: > [llonergan@kite4 IVP]$ du -sk dgtestdb/base > 2121648 dgtestdb/base >=20 System B: > This system is running an XFS filesystem, and has been tuned to use very = large > (16MB) readahead. It=B9s running the Centos 4.1 distro, which uses a Linux > 2.6.9 kernel. >=20 > Same test as above, but with 17GB of data takes 69.7 seconds to scan (!) > That=B9s 244.2MB/s, which is obviously double my earlier point of 110-120MB= /s. > This system is running with a 16MB Linux readahead setting, let=B9s try it = with > the default (I think) setting of 256KB =AD AHA! Now we get 171.4 seconds or > 99.3MB/s. >=20 > So, using the tuned setting of =B3blockdev =8Bsetra 16384=B2 we get $6,000 / 24= 4MB/s > =3D 24.6 $/MB/s > If we use the default Linux setting it=B9s 2.5x worse. >=20 > Raw data: > [llonergan@modena2 IVP]$ cat scan.sh > #!/bin/bash >=20 > time psql -c "select count(*) from ivp.bigtable1" dgtestdb > [llonergan@modena2 IVP]$ cat sysout3 > count =20 > ---------- > 80000000 > (1 row) >=20 >=20 > real 1m9.875s > user 0m0.000s > sys 0m0.004s > [llonergan@modena2 IVP]$ !du > du -sk dgtestdb/base > 17021260 dgtestdb/base Summary: <cough, cough> OK =AD you can get more I/O bandwidth out of the current I/O path for sequential scan if you tune the filesystem for large readahead. This is a cheap alternative to overhauling the executor to use asynch I/O. Still, there is a CPU limit here =AD this is not I/O bound, it is CPU limited as evidenced by the sensitivity to readahead settings. If the filesystem could do 1GB/s, you wouldn=B9t go any faster than 244MB/s. - Luke --B_3215142822_2162763 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Dave,= <BR> <BR> On 11/18/05 5:00 AM, "Dave Cramer" <pg@fastcrypt.com> wrote= :<BR> <FONT COLOR=3D"#0000FF">> <BR> > Now there's an interesting line drawn in the sand. I presume you have = <BR> > numbers to back this up ?<BR> > <BR> > This should draw some interesting posts.<BR> </FONT><BR> Part 2: The answer<BR> <BR> System A:<BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>This system is running RedHat 3 Update 4, with a Fedora= 2.6.10 Linux kernel.<BR> <BR> On a single table with 15 columns (the Bizgres IVP) at a size double memory= (2.12GB), Postgres 8.0.3 with Bizgres enhancements takes 32 seconds to scan= the table: that’s 66 MB/s.  Not the efficiency I’d hope fr= om the onboard SATA controller that I’d like, I would have expected to= get 85% of the 100MB/s raw read performance.<BR> <BR> So that’s $1,200 / 66 MB/s (without adjusting for 2003 price versus n= ow) =3D 18.2 $/MB/s<BR> <BR> Raw data:<BR> </SPAN></FONT><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Courier New">[llon= ergan@kite4 IVP]$ cat scan.sh <BR> #!/bin/bash<BR> <BR> time psql -c "select count(*) from ivp.bigtable1" dgtestdb<BR> [llonergan@kite4 IVP]$ cat sysout1<BR>   count   <BR> ----------<BR>  10000000<BR> (1 row)<BR> <BR> <BR> real    0m32.565s<BR> user    0m0.002s<BR> sys     0m0.003s<BR> <BR> Size of the table data:<BR> [llonergan@kite4 IVP]$ du -sk dgtestdb/base<BR> 2121648 dgtestdb/base<BR> </FONT><FONT FACE=3D"Verdana, Helvetica, Arial"><BR> </FONT></SPAN></BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verda= na, Helvetica, Arial">System B:<BR> </FONT></SPAN><BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Verdan= a, Helvetica, Arial">This system is running an XFS filesystem, and has been = tuned to use very large (16MB) readahead.  It’s running the Cento= s 4.1 distro, which uses a Linux 2.6.9 kernel.<BR> <BR> Same test as above, but with 17GB of data takes 69.7 seconds to scan (!) &n= bsp;That’s 244.2MB/s, which is obviously double my earlier point of 11= 0-120MB/s.  This system is running with a 16MB Linux readahead setting,= let’s try it with the default (I think) setting of 256KB – AHA!= Now we get 171.4 seconds or 99.3MB/s.<BR> <BR> So, using the tuned setting of “blockdev —setra 16384” we= get $6,000 / 244MB/s =3D 24.6 $/MB/s<BR> If we use the default Linux setting it’s 2.5x worse.<BR> <BR> Raw data:<BR> </FONT><FONT FACE=3D"Courier New">[llonergan@modena2 IVP]$ cat scan.sh <BR> #!/bin/bash<BR> <BR> time psql -c "select count(*) from ivp.bigtable1" dgtestdb<BR> [llonergan@modena2 IVP]$ cat sysout3<BR>   count   <BR> ----------<BR>  80000000<BR> (1 row)<BR> <BR> <BR> real    1m9.875s<BR> user    0m0.000s<BR> sys     0m0.004s<BR> [llonergan@modena2 IVP]$ !du<BR> du -sk dgtestdb/base<BR> 17021260        dgtestdb/base<BR> </FONT></SPAN></BLOCKQUOTE><SPAN STYLE=3D'font-size:14.0px'><FONT FACE=3D"Couri= er New"><BR> </FONT><FONT FACE=3D"Verdana, Helvetica, Arial">Summary:<BR> <BR> <cough, cough> OK – you can get more I/O bandwidth out of the c= urrent I/O path for sequential scan if you tune the filesystem for large rea= dahead.  This is a cheap alternative to overhauling the executor to use= asynch I/O.<BR> <BR> Still, there is a CPU limit here – this is not I/O bound, it is CPU l= imited as evidenced by the sensitivity to readahead settings.   If= the filesystem could do 1GB/s, you wouldn’t go any faster than 244MB/= s.<BR> <BR> - Luke</FONT></SPAN> </BODY> </HTML> --B_3215142822_2162763-- From pgsql-performance-owner@postgresql.org Fri Nov 18 15:45:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6BC05DB835 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 11:25:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39852-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:25:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 42E45DBAAE for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:25:44 -0400 (AST) Received: (qmail 16600 invoked from network); 18 Nov 2005 15:25:49 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 18 Nov 2005 15:25:49 -0000 In-Reply-To: <BFA32FA6.14027%llonergan@greenplum.com> References: <BFA32FA6.14027%llonergan@greenplum.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/alternative; boundary=Apple-Mail-55--598469618 Message-Id: <A4D5EB2A-73BC-43F8-8B5A-36268193A047@fastcrypt.com> Cc: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org From: Dave Cramer <pg@fastcrypt.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 10:25:52 -0500 To: Luke Lonergan <llonergan@greenplum.com> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.129 required=5 tests=[AWL=-0.128, HTML_FONT_BIG=0.256, HTML_MESSAGE=0.001] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200511/379 X-Sequence-Number: 15636 --Apple-Mail-55--598469618 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Luke, Interesting numbers. I'm a little concerned about the use of blockdev =20= =97setra 16384. If I understand this correctly it assumes that the =20 table is contiguous on the disk does it not ? Dave On 18-Nov-05, at 10:13 AM, Luke Lonergan wrote: > Dave, > > On 11/18/05 5:00 AM, "Dave Cramer" <pg@fastcrypt.com> wrote: > > > > Now there's an interesting line drawn in the sand. I presume you =20 > have > > numbers to back this up ? > > > > This should draw some interesting posts. > > Part 2: The answer > > System A: >> This system is running RedHat 3 Update 4, with a Fedora 2.6.10 =20 >> Linux kernel. >> >> On a single table with 15 columns (the Bizgres IVP) at a size =20 >> double memory (2.12GB), Postgres 8.0.3 with Bizgres enhancements =20 >> takes 32 seconds to scan the table: that=92s 66 MB/s. Not the =20 >> efficiency I=92d hope from the onboard SATA controller that I=92d =20 >> like, I would have expected to get 85% of the 100MB/s raw read =20 >> performance. >> >> So that=92s $1,200 / 66 MB/s (without adjusting for 2003 price =20 >> versus now) =3D 18.2 $/MB/s >> >> Raw data: >> [llonergan@kite4 IVP]$ cat scan.sh >> #!/bin/bash >> >> time psql -c "select count(*) from ivp.bigtable1" dgtestdb >> [llonergan@kite4 IVP]$ cat sysout1 >> count >> ---------- >> 10000000 >> (1 row) >> >> >> real 0m32.565s >> user 0m0.002s >> sys 0m0.003s >> >> Size of the table data: >> [llonergan@kite4 IVP]$ du -sk dgtestdb/base >> 2121648 dgtestdb/base >> > System B: >> This system is running an XFS filesystem, and has been tuned to =20 >> use very large (16MB) readahead. It=92s running the Centos 4.1 =20 >> distro, which uses a Linux 2.6.9 kernel. >> >> Same test as above, but with 17GB of data takes 69.7 seconds to =20 >> scan (!) That=92s 244.2MB/s, which is obviously double my earlier =20= >> point of 110-120MB/s. This system is running with a 16MB Linux =20 >> readahead setting, let=92s try it with the default (I think) setting =20= >> of 256KB =96 AHA! Now we get 171.4 seconds or 99.3MB/s. >> >> So, using the tuned setting of =93blockdev =97setra 16384=94 we get =20= >> $6,000 / 244MB/s =3D 24.6 $/MB/s >> If we use the default Linux setting it=92s 2.5x worse. >> >> Raw data: >> [llonergan@modena2 IVP]$ cat scan.sh >> #!/bin/bash >> >> time psql -c "select count(*) from ivp.bigtable1" dgtestdb >> [llonergan@modena2 IVP]$ cat sysout3 >> count >> ---------- >> 80000000 >> (1 row) >> >> >> real 1m9.875s >> user 0m0.000s >> sys 0m0.004s >> [llonergan@modena2 IVP]$ !du >> du -sk dgtestdb/base >> 17021260 dgtestdb/base > > Summary: > > <cough, cough> OK =96 you can get more I/O bandwidth out of the =20 > current I/O path for sequential scan if you tune the filesystem for =20= > large readahead. This is a cheap alternative to overhauling the =20 > executor to use asynch I/O. > > Still, there is a CPU limit here =96 this is not I/O bound, it is CPU =20= > limited as evidenced by the sensitivity to readahead settings. If =20= > the filesystem could do 1GB/s, you wouldn=92t go any faster than =20 > 244MB/s. > > - Luke --Apple-Mail-55--598469618 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=WINDOWS-1252 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; ">Luke,<DIV><BR = class=3D"khtml-block-placeholder"></DIV><DIV><SPAN = class=3D"Apple-style-span"><FONT class=3D"Apple-style-span" = face=3D"Verdana" size=3D"4"><SPAN class=3D"Apple-style-span" = style=3D"font-size: 14px;">Interesting numbers. I'm a little concerned = about the use of</SPAN></FONT>=A0<SPAN style=3D""><FONT = class=3D"Apple-style-span" size=3D"4"><SPAN class=3D"Apple-style-span" = style=3D"font-size: 14px;"><FONT class=3D"Apple-style-span" = face=3D"Verdana">blockdev =97setra 16384. If I understand this correctly = it assumes that the table is contiguous on the disk does it not = ?</FONT></SPAN></FONT></SPAN><FONT class=3D"Apple-style-span" = size=3D"4"><SPAN class=3D"Apple-style-span" style=3D"font-size: = 14px;"></SPAN></FONT></SPAN></DIV><DIV><FONT class=3D"Apple-style-span" = face=3D"Verdana" size=3D"4"><SPAN class=3D"Apple-style-span" = style=3D"font-size: 14px;"><BR = class=3D"khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT = class=3D"Apple-style-span" face=3D"Verdana" size=3D"4"><SPAN = class=3D"Apple-style-span" style=3D"font-size: 14px;"><BR = class=3D"khtml-block-placeholder"></SPAN></FONT></DIV><DIV><SPAN = class=3D"Apple-style-span"><FONT class=3D"Apple-style-span" = size=3D"4"><SPAN class=3D"Apple-style-span" style=3D"font-size: = 14px;"><FONT class=3D"Apple-style-span" = face=3D"Verdana">Dave<BR></FONT></SPAN></FONT><DIV><DIV>On 18-Nov-05, at = 10:13 AM, Luke Lonergan wrote:</DIV><BR = class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"> <FONT = face=3D"Verdana, Helvetica, Arial"><SPAN = style=3D"font-size:14.0px">Dave,<BR> <BR> On 11/18/05 5:00 AM, "Dave = Cramer" <<A href=3D"mailto:pg@fastcrypt.com">pg@fastcrypt.com</A>> = wrote:<BR> <FONT color=3D"#0000FF">> <BR> > Now there's an = interesting line drawn in the sand. I presume you have <BR> > numbers = to back this up ?<BR> > <BR> > This should draw some interesting = posts.<BR> </FONT><BR> Part 2: The answer<BR> <BR> System A:<BR> = </SPAN></FONT><BLOCKQUOTE type=3D"cite"><FONT face=3D"Verdana, = Helvetica, Arial"><SPAN style=3D"font-size:14.0px">This system is = running RedHat 3 Update 4, with a Fedora 2.6.10 Linux kernel.<BR> <BR> = On a single table with 15 columns (the Bizgres IVP) at a size double = memory (2.12GB), Postgres 8.0.3 with Bizgres enhancements takes 32 = seconds to scan the table: that=92s 66 MB/s. =A0Not the efficiency I=92d = hope from the onboard SATA controller that I=92d like, I would have = expected to get 85% of the 100MB/s raw read performance.<BR> <BR> So = that=92s $1,200 / 66 MB/s (without adjusting for 2003 price versus now) = =3D 18.2 $/MB/s<BR> <BR> Raw data:<BR> </SPAN></FONT><SPAN = style=3D"font-size:14.0px"><FONT face=3D"Courier New">[llonergan@kite4 = IVP]$ cat scan.sh <BR> #!/bin/bash<BR> <BR> time psql -c "select = count(*) from ivp.bigtable1" dgtestdb<BR> [llonergan@kite4 IVP]$ cat = sysout1<BR> =A0=A0count =A0=A0<BR> ----------<BR> =A010000000<BR> (1 = row)<BR> <BR> <BR> real =A0=A0=A00m32.565s<BR> user =A0=A0=A00m0.002s<BR> = sys =A0=A0=A0=A00m0.003s<BR> <BR> Size of the table data:<BR> = [llonergan@kite4 IVP]$ du -sk dgtestdb/base<BR> 2121648 = dgtestdb/base<BR> </FONT><FONT face=3D"Verdana, Helvetica, Arial"><BR> = </FONT></SPAN></BLOCKQUOTE><SPAN style=3D"font-size:14.0px"><FONT = face=3D"Verdana, Helvetica, Arial">System B:<BR> = </FONT></SPAN><BLOCKQUOTE type=3D"cite"><SPAN = style=3D"font-size:14.0px"><FONT face=3D"Verdana, Helvetica, Arial">This = system is running an XFS filesystem, and has been tuned to use very = large (16MB) readahead. =A0It=92s running the Centos 4.1 distro, which = uses a Linux 2.6.9 kernel.<BR> <BR> Same test as above, but with 17GB of = data takes 69.7 seconds to scan (!) =A0That=92s 244.2MB/s, which is = obviously double my earlier point of 110-120MB/s. =A0This system is = running with a 16MB Linux readahead setting, let=92s try it with the = default (I think) setting of 256KB =96 AHA! Now we get 171.4 seconds or = 99.3MB/s.<BR> <BR> So, using the tuned setting of =93blockdev =97setra = 16384=94 we get $6,000 / 244MB/s =3D 24.6 $/MB/s<BR> If we use the = default Linux setting it=92s 2.5x worse.<BR> <BR> Raw data:<BR> = </FONT><FONT face=3D"Courier New">[llonergan@modena2 IVP]$ cat scan.sh = <BR> #!/bin/bash<BR> <BR> time psql -c "select count(*) from = ivp.bigtable1" dgtestdb<BR> [llonergan@modena2 IVP]$ cat sysout3<BR> = =A0=A0count =A0=A0<BR> ----------<BR> =A080000000<BR> (1 row)<BR> <BR> = <BR> real =A0=A0=A01m9.875s<BR> user =A0=A0=A00m0.000s<BR> sys = =A0=A0=A0=A00m0.004s<BR> [llonergan@modena2 IVP]$ !du<BR> du -sk = dgtestdb/base<BR> 17021260 =A0=A0=A0=A0=A0=A0=A0dgtestdb/base<BR> = </FONT></SPAN></BLOCKQUOTE><SPAN style=3D"font-size:14.0px"><FONT = face=3D"Courier New"><BR> </FONT><FONT face=3D"Verdana, Helvetica, = Arial">Summary:<BR> <BR> <cough, cough> OK =96 you can get more = I/O bandwidth out of the current I/O path for sequential scan if you = tune the filesystem for large readahead. =A0This is a cheap alternative = to overhauling the executor to use asynch I/O.<BR> <BR> Still, there is = a CPU limit here =96 this is not I/O bound, it is CPU limited as = evidenced by the sensitivity to readahead settings. =A0=A0If the = filesystem could do 1GB/s, you wouldn=92t go any faster than = 244MB/s.<BR> <BR> - Luke</FONT></SPAN> = </BLOCKQUOTE></DIV><BR></SPAN></DIV></BODY></HTML>= --Apple-Mail-55--598469618-- From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 25616DBAAE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 11:27:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39796-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:28:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 6120CDBA92 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:27:52 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 18 Nov 2005 10:27:45 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 10:27:43 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 10:27:42 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 07:27:42 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA332EE.14035%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsTw0c95ObdkQGQ1Cr04ElJkGvZwABZDAP In-Reply-To: <437DE960.9070606@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 15:27:43.0217 (UTC) FILETIME=[9E991E10:01C5EC54] X-WSS-ID: 6F632D642RS9471348-06-01 Content-Type: multipart/alternative; boundary=B_3215143662_2194465 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/378 X-Sequence-Number: 15635 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215143662_2194465 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Alan, On 11/18/05 6:46 AM, "Alan Stange" <stange@rentec.com> wrote: > That's 3 hours under load, with 80 compute clients beating on the > database at the same time. We have the stats turned way up, so the > analyze tends to read a big chunk of the tables a second time as > well. We typically don't have three hours a day of idle time. So I guess you=B9re saying you don=B9t know what your I/O rate is? - Luke --B_3215143662_2194465 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Alan,= <BR> <BR> On 11/18/05 6:46 AM, "Alan Stange" <stange@rentec.com> wrot= e:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>That's 3 hours under load, with 80 compute clients beat= ing on the<BR> database at the same time.   We have the stats turned way up, so = the<BR> analyze tends to read a big chunk of the tables a second time as<BR> well.    We typically don't have three hours a day of idle t= ime.<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> So I guess you’re saying you don’t know what your I/O rate is?<= BR> <BR> - Luke<BR> </SPAN></FONT> </BODY> </HTML> --B_3215143662_2194465-- From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDC99DBA92 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 11:30:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40592-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:30:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id F04DADBAAF for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:30:49 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 18 Nov 2005 10:30:40 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 10:30:32 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 10:30:31 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 07:30:31 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Dave Cramer" <pg@fastcrypt.com> cc: "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA33397.1403A%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsVGDnQ6yoPa0qRCyzZpo4/hApJQAAKGyl In-Reply-To: <A4D5EB2A-73BC-43F8-8B5A-36268193A047@fastcrypt.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 15:30:32.0129 (UTC) FILETIME=[03470B10:01C5EC55] X-WSS-ID: 6F632C1131S14498826-01-01 Content-Type: multipart/alternative; boundary=B_3215143831_2195651 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/377 X-Sequence-Number: 15634 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215143831_2195651 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Dave, On 11/18/05 7:25 AM, "Dave Cramer" <pg@fastcrypt.com> wrote: > Luke, >=20 > Interesting numbers. I'm a little concerned about the use of=A0blockdev =8Bse= tra > 16384. If I understand this correctly it assumes that the table is contig= uous > on the disk does it not ? For optimum performance, yes it does. Remember that the poster is asking about a 5TB warehouse. Decision support applications deal with large table= s and sequential scans a lot, and the data is generally contiguous on disk. If delete gaps are there, they will generally vacuum them away. - Luke --B_3215143831_2195651 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Dave,= <BR> <BR> On 11/18/05 7:25 AM, "Dave Cramer" <pg@fastcrypt.com> wrote= :<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>Luke,<BR> <BR> Interesting numbers. I'm a little concerned about the use of=A0blockdev ̵= 2;setra 16384. If I understand this correctly it assumes that the table is c= ontiguous on the disk does it not ?<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> For optimum performance, yes it does.  Remember that the poster is ask= ing about a 5TB warehouse.  Decision support applications deal with lar= ge tables and sequential scans a lot, and the data is generally contiguous o= n disk.  If delete gaps are there, they will generally vacuum them away= .<BR> <BR> - Luke</SPAN></FONT> </BODY> </HTML> --B_3215143831_2195651-- From pgsql-performance-owner@postgresql.org Fri Nov 18 12:15:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CE4F4DBAAE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 11:55:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52034-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:55:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bfccomputing.com (bfccomputing.com [217.160.248.65]) by svr1.postgresql.org (Postfix) with ESMTP id 08A07D82C0 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:55:32 -0400 (AST) Received: from [10.0.0.202] (68-169-200-61.sbtnvt.adelphia.net [68.169.200.61]) by bfccomputing.com (Postfix) with ESMTP id 8E83BE8608; Fri, 18 Nov 2005 10:55:20 -0500 (EST) In-Reply-To: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> References: <BFA2AFBA.13FC4%llonergan@greenplum.com> <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <d555b0eedb008ce34e18463cceb73b04@bfccomputing.com> Content-Transfer-Encoding: 7bit Cc: pgsql-performance@postgresql.org From: Bill McGonigle <bill@bfccomputing.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 10:55:19 -0500 To: Dave Cramer <pg@fastcrypt.com> X-Mailer: Apple Mail (2.623) X-bfccomputing-MailScanner-Information: Please contact the ISP for more information X-bfccomputing-MailScanner: Found to be clean X-bfccomputing-MailScanner-SpamCheck: X-MailScanner-From: bill@bfccomputing.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/357 X-Sequence-Number: 15614 On Nov 18, 2005, at 08:00, Dave Cramer wrote: >> A $1,000 system with one CPU and two SATA disks in a software RAID0 >> will >> perform exactly the same as a $80,000 system with 8 dual core CPUs >> and the >> world's best SCSI RAID hardware on a large database for decision >> support >> (what the poster asked about). > > Now there's an interesting line drawn in the sand. I presume you have > numbers to back this up ? > This should draw some interesting posts. There is some truth to it. For an app I'm currently running (full-text search using tsearch2 on ~100MB of data) on: Dev System: Asus bare-bones bookshelf case/mobo 3GHz P4 w/ HT 800MHz memory Bus Fedora Core 3 (nightly update) 1GB RAM 1 SATA Seagate disk (7200RPM, 8MB Cache) $800 worst-case query: 7.2 seconds now, the machine I'm deploying to: Dell SomthingOrOther (4) 2.4GHz Xeons 533MHz memory bus RedHat Enterprise 3.6 1GB RAM (5) 150000 RPM Ultra SCSI 320 on an Adaptec RAID 5 controller > $10000 same worst-case query: 9.6 seconds Now it's not apples-to-apples. There's a kernel 2.4 vs. 2.6 difference and the memory bus is much faster and I'm not sure what kind of context switching hit you get with the Xeon MP memory controller. On a previous postgresql app I did I ran nearly identically spec'ed machines except for the memory bus and saw about a 30% boost in performance just with the 800MHz bus. I imagine the Opteron bus does even better. So the small machine is probably slower on disk but makes up for it in single-threaded access to CPU and memory speed. But if this app were to be scaled it would make much more sense to cluster several $800 machines than it would to buy 'big-iron'. -Bill ----- Bill McGonigle, Owner Work: 603.448.4440 BFC Computing, LLC Home: 603.448.1668 bill@bfccomputing.com Mobile: 603.252.2606 http://www.bfccomputing.com/ Pager: 603.442.1833 Jabber: flowerpt@gmail.com Text: bill+text@bfccomputing.com Blog: http://blog.bfccomputing.com/ From pgsql-performance-owner@postgresql.org Fri Nov 18 12:12:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81B1CDBA5F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:05:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53903-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:05:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id D0925DB77A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:05:17 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 51F42B814 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:05:17 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <BFA2AFBA.13FC4%llonergan@greenplum.com> References: <BFA2AFBA.13FC4%llonergan@greenplum.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <7F33229E-AE95-436B-AB2F-01AC023DD7EE@khera.org> Content-Transfer-Encoding: 7bit From: Vivek Khera <vivek@khera.org> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 11:05:16 -0500 To: Postgresql Performance <pgsql-performance@postgresql.org> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/356 X-Sequence-Number: 15613 On Nov 18, 2005, at 1:07 AM, Luke Lonergan wrote: > A $1,000 system with one CPU and two SATA disks in a software RAID0 > will > perform exactly the same as a $80,000 system with 8 dual core CPUs > and the > world's best SCSI RAID hardware on a large database for decision > support > (what the poster asked about). Hahahahahahahahahahahahaha! Whooo... needed to fall out of my chair laughing this morning. I can tell you from direct personal experience that you're just plain wrong. I've had to move my primary DB server from a dual P3 1GHz with 4-disk RAID10 SCSI, to Dual P3 2GHz with 14-disk RAID10 and faster drives, to Dual Opteron 2GHz with 8-disk RAID10 and even faster disks to keep up with my load on a 60+ GB database. The Dual opteron system has just a little bit of extra capacity if I offload some of the reporting operations to a replicated copy (via slony1). If I run all the queries on the one DB it can't keep up. One most telling point about the difference in speed is that the 14- disk array system cannot keep up with the replication being generated by the dual opteron, even when it is no doing any other queries of its own. The I/O system just ain't fast enough. From pgsql-performance-owner@postgresql.org Fri Nov 18 12:09:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83D09D6D50 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:07:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47817-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:07:06 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id 0DD23DBAB3 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:07:06 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 70E82B80A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 11:07:05 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <BFA32FA6.14027%llonergan@greenplum.com> References: <BFA32FA6.14027%llonergan@greenplum.com> Content-Type: multipart/alternative; boundary=Apple-Mail-1--595997702 Message-Id: <1F5BD2B1-8A75-498E-ADB7-8CB661066013@khera.org> From: Vivek Khera <vivek@khera.org> Subject: Re: Hardware/OS recommendations for large databases ( Date: Fri, 18 Nov 2005 11:07:04 -0500 To: Postgresql Performance <pgsql-performance@postgresql.org> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/355 X-Sequence-Number: 15612 --Apple-Mail-1--595997702 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed On Nov 18, 2005, at 10:13 AM, Luke Lonergan wrote: > Still, there is a CPU limit here =96 this is not I/O bound, it is CPU =20= > limited as evidenced by the sensitivity to readahead settings. If =20= > the filesystem could do 1GB/s, you wouldn=92t go any faster than =20 > 244MB/s. Yeah, and mysql would probably be faster on your trivial queries. =20 Try concurrent large joins and updates and see which system is faster. --Apple-Mail-1--595997702 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=WINDOWS-1252 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Nov 18, 2005, = at 10:13 AM, Luke Lonergan wrote:</DIV><BR = class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"><SPAN = class=3D"Apple-style-span" style=3D"border-collapse: separate; = border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Georgia; = font-size: 14px; font-style: normal; font-variant: normal; font-weight: = normal; letter-spacing: normal; line-height: normal; text-align: auto; = -khtml-text-decorations-in-effect: none; text-indent: 0px; = -apple-text-size-adjust: auto; text-transform: none; orphans: 2; = white-space: normal; widows: 2; word-spacing: 0px; "><SPAN = style=3D"font-size:14.0px"><FONT face=3D"Verdana, Helvetica, = Arial"><SPAN class=3D"Apple-style-span" style=3D"font-family: Verdana; = ">Still, there is a CPU limit here =96 this is not I/O bound, it is CPU = limited as evidenced by the sensitivity to readahead settings. =A0=A0If = the filesystem could do 1GB/s, you wouldn=92t go any faster than = 244MB/s.</SPAN><BR style=3D"font-family: Verdana; = "></FONT></SPAN></SPAN></BLOCKQUOTE></DIV><BR><DIV>Yeah, and mysql would = probably be faster on your trivial queries.=A0 Try concurrent large = joins and updates and see which system is faster.</DIV><DIV><BR = class=3D"khtml-block-placeholder"></DIV></BODY></HTML>= --Apple-Mail-1--595997702-- From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B5A1DB77A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:13:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54914-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:13:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp104.rog.mail.re2.yahoo.com (smtp104.rog.mail.re2.yahoo.com [206.190.36.82]) by svr1.postgresql.org (Postfix) with SMTP id 9C4A4DBAAE for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:13:14 -0400 (AST) Received: (qmail 29651 invoked from network); 18 Nov 2005 16:13:14 -0000 Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@209.222.54.227 with login) by smtp104.rog.mail.re2.yahoo.com with SMTP; 18 Nov 2005 16:13:14 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id B888740B5; Fri, 18 Nov 2005 11:13:12 -0500 (EST) Date: Fri, 18 Nov 2005 11:13:12 -0500 From: Andrew Sullivan <ajs@crankycanuck.ca> To: Guillaume Smet <guillaume.smet@openwide.fr> Cc: Andrew Sullivan <ajs@crankycanuck.ca>, pgsql-performance@postgresql.org Subject: Re: weird performances problem Message-ID: <20051118161312.GC28967@phlogiston.dyndns.org> References: <437CC21D.8070402@openwide.fr> <20051117221314.GC26696@phlogiston.dyndns.org> <437D13AA.4010309@openwide.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <437D13AA.4010309@openwide.fr> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/376 X-Sequence-Number: 15633 On Fri, Nov 18, 2005 at 12:35:06AM +0100, Guillaume Smet wrote: > sort_mem = 32768 I would be very suspicious of that much memory for sort. Please see the docs for what that does. That is the amount that _each sort_ can allocate before spilling to disk. If some set of your users are causing complicated queries with, say, four sorts apiece, then each user is potentially allocating 4x that much memory. That's going to wreak havoc on your disk buffers (which are tricky to monitor on most systems, and impossible on some). This'd be the first knob I'd twiddle, for sure. A -- Andrew Sullivan | ajs@crankycanuck.ca It is above all style through which power defers to reason. --J. Robert Oppenheimer From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 984ABDBAB1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:14:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54005-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:14:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id D644DDBAAE for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:14:29 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIGDeP9024547 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 11:13:41 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAIGD9qD006841; Fri, 18 Nov 2005 11:13:09 -0500 (EST) Message-ID: <437DFDB8.1030208@rentec.com> Date: Fri, 18 Nov 2005 11:13:44 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA332EE.14035%llonergan@greenplum.com> In-Reply-To: <BFA332EE.14035%llonergan@greenplum.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Logged: Logged by unicorn.rentec.com as jAIGDeP9024547 at Fri Nov 18 11:13:41 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.019 required=5 tests=[AWL=0.019] X-Spam-Score: 0.019 X-Spam-Level: X-Archive-Number: 200511/375 X-Sequence-Number: 15632 Luke Lonergan wrote: > Alan, > > On 11/18/05 6:46 AM, "Alan Stange" <stange@rentec.com> wrote: > > That's 3 hours under load, with 80 compute clients beating on the > database at the same time. We have the stats turned way up, so the > analyze tends to read a big chunk of the tables a second time as > well. We typically don't have three hours a day of idle time. > > > So I guess you�re saying you don�t know what your I/O rate is? No, I'm say *you* don't know what my IO rate is. I told you in my initial post that I was observing numbers in excess of what you claiming, but you seemed to think I didn't know how to measure an IO rate. I should note too that our system uses about 20% of a single cpu when performing a table scan at >100MB/s of IO. I think you claimed the system would be cpu bound at this low IO rate. Cheers, -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D9562D82C0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:16:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53168-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:16:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id BC3D8DBAC0 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:16:53 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 18 Nov 2005 11:16:47 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 11:16:40 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 11:16:40 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 08:16:39 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Vivek Khera" <vivek@khera.org>, "Postgresql Performance" <pgsql-performance@postgresql.org> Message-ID: <BFA33E67.1404D%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsWvFEknbFGdXQQ46m0ym7HfvpqgAAIMyI In-Reply-To: <1F5BD2B1-8A75-498E-ADB7-8CB661066013@khera.org> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 16:16:40.0865 (UTC) FILETIME=[7592A110:01C5EC5B] X-WSS-ID: 6F6321E52RS9512144-08-01 Content-Type: multipart/alternative; boundary=B_3215146600_2400117 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/374 X-Sequence-Number: 15631 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215146600_2400117 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Vivek, On 11/18/05 8:07 AM, "Vivek Khera" <vivek@khera.org> wrote: >=20 > On Nov 18, 2005, at 10:13 AM, Luke Lonergan wrote: >=20 >> Still, there is a CPU limit here =AD this is not I/O bound, it is CPU limi= ted >> as evidenced by the sensitivity to readahead settings. =A0=A0If the filesyst= em >> could do 1GB/s, you wouldn=B9t go any faster than 244MB/s. >=20 > Yeah, and mysql would probably be faster on your trivial queries.=A0 Try > concurrent large joins and updates and see which system is faster. That=B9s what we do to make a living. And it=B9s Oracle that a lot faster because they implemented a much tighter, optimized I/O path to disk than Postgres. Since you asked, we bought the 5 systems as a cluster =AD and with Bizgres MP= P we get close to 400MB/s per machine on complex queries. - Luke --B_3215146600_2400117 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Vivek= ,<BR> <BR> On 11/18/05 8:07 AM, "Vivek Khera" <vivek@khera.org> wrote:= <BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'><BR> On Nov 18, 2005, at 10:13 AM, Luke Lonergan wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>Still, there is a CPU limit here – this is not I/= O bound, it is CPU limited as evidenced by the sensitivity to readahead sett= ings. =A0=A0If the filesystem could do 1GB/s, you wouldn’t go any faster t= han 244MB/s.<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> Yeah, and mysql would probably be faster on your trivial queries.=A0 Try conc= urrent large joins and updates and see which system is faster.<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> That’s what we do to make a living.  And it’s Oracle that = a <B>lot</B> faster because they implemented a much tighter, optimized I/O p= ath to disk than Postgres.<BR> <BR> Since you asked, we bought the 5 systems as a cluster – and with Bizg= res MPP we get close to 400MB/s per machine on complex queries.<BR> <BR> - Luke  </SPAN></FONT> </BODY> </HTML> --B_3215146600_2400117-- From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 94778DBAAD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:18:21 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54874-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:18:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id A5C1EDBAB3 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:18:18 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 11:17:54 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 11:17:49 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 11:17:48 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 08:17:48 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA33EAC.1404E%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsWynYmaQcVW8AQ/6P36vjrmRtnwAAHO+A In-Reply-To: <437DFDB8.1030208@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 16:17:49.0336 (UTC) FILETIME=[9E627980:01C5EC5B] X-WSS-ID: 6F6321F621G13526393-04-01 Content-Type: multipart/alternative; boundary=B_3215146668_2362154 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/373 X-Sequence-Number: 15630 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215146668_2362154 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Alan, On 11/18/05 8:13 AM, "Alan Stange" <stange@rentec.com> wrote: > I told you in my initial post that I was observing numbers in excess of > what you claiming, but you seemed to think I didn't know how to measure > an IO rate. > Prove me wrong, post your data. > I should note too that our system uses about 20% of a single cpu when > performing a table scan at >100MB/s of IO. I think you claimed the > system would be cpu bound at this low IO rate. See above. - Luke > --B_3215146668_2362154 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Alan,= <BR> <BR> On 11/18/05 8:13 AM, "Alan Stange" <stange@rentec.com> wrot= e:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>I told you in my initial post that I was observing numb= ers in excess of<BR> what you claiming, but you seemed to think I didn't know how to measure<BR> an IO rate.<BR> <BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'>Prove me wrong, post your data.<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>I should note too that our system uses about 20% of a s= ingle cpu when<BR> performing a table scan at >100MB/s of IO. I think you claimed the<BR> system would be cpu bound at this low IO rate.<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> See above.<BR> <BR> - Luke<BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'><BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> </SPAN></FONT> </BODY> </HTML> --B_3215146668_2362154-- From pgsql-performance-owner@postgresql.org Fri Nov 18 15:43:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3014DBAB3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:20:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54529-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:20:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id 8A08AD82C0 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:20:32 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 11:20:12 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 11:20:11 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 11:20:11 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 08:20:11 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Vivek Khera" <vivek@khera.org>, "Postgresql Performance" <pgsql-performance@postgresql.org> Message-ID: <BFA33F3B.1404F%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsWzbRV+j6Vby9QAyiN/Gwt8OJ2wAALwAZ In-Reply-To: <7F33229E-AE95-436B-AB2F-01AC023DD7EE@khera.org> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 16:20:11.0938 (UTC) FILETIME=[F361D020:01C5EC5B] X-WSS-ID: 6F6320B121G13528235-01-01 Content-Type: multipart/alternative; boundary=B_3215146811_2392297 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/372 X-Sequence-Number: 15629 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215146811_2392297 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Vivek,=20 On 11/18/05 8:05 AM, "Vivek Khera" <vivek@khera.org> wrote: > I can tell you from direct personal experience that you're just plain > wrong. >=20 > up with my load on a 60+ GB database. The Dual opteron system has I=B9m always surprised by what passes for a large database. The poster is talking about 5,000GB, or almost 100 times the data you have. Post your I/O numbers on sequential scan. Sequential scan is critical for Decision Support / Data Warehousing. - Luke --B_3215146811_2392297 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Vivek= , <BR> <BR> On 11/18/05 8:05 AM, "Vivek Khera" <vivek@khera.org> wrote:= <BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>I can tell you from direct personal experience that you= 're just plain <BR> wrong.<BR> <BR> up with my load on a 60+ GB database.  The Dual opteron system has <BR= > </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> I’m always surprised by what passes for a large database.  The p= oster is talking about 5,000GB, or almost 100 times the data you have.<BR> <BR> Post your I/O numbers on sequential scan.  Sequential scan is critical= for Decision Support / Data Warehousing.<BR> <BR> - Luke </SPAN></FONT> </BODY> </HTML> --B_3215146811_2392297-- From pgsql-performance-owner@postgresql.org Fri Nov 18 14:21:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A7558DBABC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:28:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54554-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:28:42 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by svr1.postgresql.org (Postfix) with ESMTP id 6CE6ADBAAE for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:28:41 -0400 (AST) Received: by wproxy.gmail.com with SMTP id i28so643224wra for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 08:28:41 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OhND7JtrNA0UcN+mJjo9pHEZTUinRTqxMteAy8rao47DE1N5vi9tcwChWerARV7kEi0o6Tn3pEOnnyTDS5Y0sK0GrQKjAi8U8vs/UBbgtICCoDyCruFHtjWcEqPaukFpwvV+T+DDjTv0SwAjCMw1oUq7ZAEIbTrOiXRVnuU+L50= Received: by 10.54.121.9 with SMTP id t9mr2396495wrc; Fri, 18 Nov 2005 08:28:41 -0800 (PST) Received: by 10.54.82.5 with HTTP; Fri, 18 Nov 2005 08:28:40 -0800 (PST) Message-ID: <33c6269f0511180828m3bc7f41dp186b4573792bf6a0@mail.gmail.com> Date: Fri, 18 Nov 2005 11:28:40 -0500 From: Alex Turner <armtuk@gmail.com> To: Luke Lonergan <llonergan@greenplum.com> Subject: Re: Hardware/OS recommendations for large databases ( Cc: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org In-Reply-To: <BFA32FA6.14027%llonergan@greenplum.com> MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: base64 Content-Disposition: inline References: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> <BFA32FA6.14027%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/364 X-Sequence-Number: 15621 T2sgLSBzbyBJIHJhbiB0aGUgc2FtZSB0ZXN0IG9uIG15IHN5c3RlbSBhbmQgZ2V0IGEgdG90YWwg c3BlZWQgb2YKMTEzTUIvc2VjLiAgV2h5IGlzIHRoaXM/ICBXaHkgaXMgdGhlIHN5c3RlbSBzbyBs aW1pdGVkIHRvIGFyb3VuZCBqdXN0CjExME1CL3NlYz8gIEkgdHVuZWQgcmVhZCBhaGVhZCB1cCBh IGJpdCwgYW5kIG15IHJlc3VsdHMgaW1wcm92ZSBhCmJpdC4uCgpBbGV4CgoKT24gMTEvMTgvMDUs IEx1a2UgTG9uZXJnYW4gPGxsb25lcmdhbkBncmVlbnBsdW0uY29tPiB3cm90ZToKPiAgRGF2ZSwK Pgo+ICBPbiAxMS8xOC8wNSA1OjAwIEFNLCAiRGF2ZSBDcmFtZXIiIDxwZ0BmYXN0Y3J5cHQuY29t PiB3cm90ZToKPiAgPgo+ICA+IE5vdyB0aGVyZSdzIGFuIGludGVyZXN0aW5nIGxpbmUgZHJhd24g aW4gdGhlIHNhbmQuIEkgcHJlc3VtZSB5b3UgaGF2ZQo+ICA+IG51bWJlcnMgdG8gYmFjayB0aGlz IHVwID8KPiAgPgo+ICA+IFRoaXMgc2hvdWxkIGRyYXcgc29tZSBpbnRlcmVzdGluZyBwb3N0cy4K Pgo+ICBQYXJ0IDI6IFRoZSBhbnN3ZXIKPgo+ICBTeXN0ZW0gQToKPgo+IFRoaXMgc3lzdGVtIGlz IHJ1bm5pbmcgUmVkSGF0IDMgVXBkYXRlIDQsIHdpdGggYSBGZWRvcmEgMi42LjEwIExpbnV4IGtl cm5lbC4KPgo+ICBPbiBhIHNpbmdsZSB0YWJsZSB3aXRoIDE1IGNvbHVtbnMgKHRoZSBCaXpncmVz IElWUCkgYXQgYSBzaXplIGRvdWJsZSBtZW1vcnkKPiAoMi4xMkdCKSwgUG9zdGdyZXMgOC4wLjMg d2l0aCBCaXpncmVzIGVuaGFuY2VtZW50cyB0YWtlcyAzMiBzZWNvbmRzIHRvIHNjYW4KPiB0aGUg dGFibGU6IHRoYXQncyA2NiBNQi9zLiAgTm90IHRoZSBlZmZpY2llbmN5IEknZCBob3BlIGZyb20g dGhlIG9uYm9hcmQKPiBTQVRBIGNvbnRyb2xsZXIgdGhhdCBJJ2QgbGlrZSwgSSB3b3VsZCBoYXZl IGV4cGVjdGVkIHRvIGdldCA4NSUgb2YgdGhlCj4gMTAwTUIvcyByYXcgcmVhZCBwZXJmb3JtYW5j ZS4KPgo+ICBTbyB0aGF0J3MgJDEsMjAwIC8gNjYgTUIvcyAod2l0aG91dCBhZGp1c3RpbmcgZm9y IDIwMDMgcHJpY2UgdmVyc3VzIG5vdykgPQo+IDE4LjIgJC9NQi9zCj4KPiAgUmF3IGRhdGE6Cj4g IFtsbG9uZXJnYW5Aa2l0ZTQgSVZQXSQgY2F0IHNjYW4uc2gKPiAgIyEvYmluL2Jhc2gKPgo+ICB0 aW1lIHBzcWwgLWMgInNlbGVjdCBjb3VudCgqKSBmcm9tIGl2cC5iaWd0YWJsZTEiIGRndGVzdGRi Cj4gIFtsbG9uZXJnYW5Aa2l0ZTQgSVZQXSQgY2F0IHN5c291dDEKPiAgICBjb3VudAo+ICAtLS0t LS0tLS0tCj4gICAxMDAwMDAwMAo+ICAoMSByb3cpCj4KPgo+ICByZWFsICAgIDBtMzIuNTY1cwo+ ICB1c2VyICAgIDBtMC4wMDJzCj4gIHN5cyAgICAgMG0wLjAwM3MKPgo+ICBTaXplIG9mIHRoZSB0 YWJsZSBkYXRhOgo+ICBbbGxvbmVyZ2FuQGtpdGU0IElWUF0kIGR1IC1zayBkZ3Rlc3RkYi9iYXNl Cj4gIDIxMjE2NDggZGd0ZXN0ZGIvYmFzZQo+Cj4gIFN5c3RlbSBCOgo+Cj4gVGhpcyBzeXN0ZW0g aXMgcnVubmluZyBhbiBYRlMgZmlsZXN5c3RlbSwgYW5kIGhhcyBiZWVuIHR1bmVkIHRvIHVzZSB2 ZXJ5Cj4gbGFyZ2UgKDE2TUIpIHJlYWRhaGVhZC4gIEl0J3MgcnVubmluZyB0aGUgQ2VudG9zIDQu MSBkaXN0cm8sIHdoaWNoIHVzZXMgYQo+IExpbnV4IDIuNi45IGtlcm5lbC4KPgo+ICBTYW1lIHRl c3QgYXMgYWJvdmUsIGJ1dCB3aXRoIDE3R0Igb2YgZGF0YSB0YWtlcyA2OS43IHNlY29uZHMgdG8g c2NhbiAoISkKPiBUaGF0J3MgMjQ0LjJNQi9zLCB3aGljaCBpcyBvYnZpb3VzbHkgZG91YmxlIG15 IGVhcmxpZXIgcG9pbnQgb2YgMTEwLTEyME1CL3MuCj4gIFRoaXMgc3lzdGVtIGlzIHJ1bm5pbmcg d2l0aCBhIDE2TUIgTGludXggcmVhZGFoZWFkIHNldHRpbmcsIGxldCdzIHRyeSBpdAo+IHdpdGgg dGhlIGRlZmF1bHQgKEkgdGhpbmspIHNldHRpbmcgb2YgMjU2S0IgliBBSEEhIE5vdyB3ZSBnZXQg MTcxLjQgc2Vjb25kcwo+IG9yIDk5LjNNQi9zLgo+Cj4gIFNvLCB1c2luZyB0aGUgdHVuZWQgc2V0 dGluZyBvZiAiYmxvY2tkZXYgl3NldHJhIDE2Mzg0IiB3ZSBnZXQgJDYsMDAwIC8KPiAyNDRNQi9z ID0gMjQuNiAkL01CL3MKPiAgSWYgd2UgdXNlIHRoZSBkZWZhdWx0IExpbnV4IHNldHRpbmcgaXQn cyAyLjV4IHdvcnNlLgo+Cj4gIFJhdyBkYXRhOgo+ICBbbGxvbmVyZ2FuQG1vZGVuYTIgSVZQXSQg Y2F0IHNjYW4uc2gKPiAgIyEvYmluL2Jhc2gKPgo+ICB0aW1lIHBzcWwgLWMgInNlbGVjdCBjb3Vu dCgqKSBmcm9tIGl2cC5iaWd0YWJsZTEiIGRndGVzdGRiCj4gIFtsbG9uZXJnYW5AbW9kZW5hMiBJ VlBdJCBjYXQgc3lzb3V0Mwo+ICAgIGNvdW50Cj4gIC0tLS0tLS0tLS0KPiAgIDgwMDAwMDAwCj4g ICgxIHJvdykKPgo+Cj4gIHJlYWwgICAgMW05Ljg3NXMKPiAgdXNlciAgICAwbTAuMDAwcwo+ICBz eXMgICAgIDBtMC4wMDRzCj4gIFtsbG9uZXJnYW5AbW9kZW5hMiBJVlBdJCAhZHUKPiAgZHUgLXNr IGRndGVzdGRiL2Jhc2UKPiAgMTcwMjEyNjAgICAgICAgIGRndGVzdGRiL2Jhc2UKPgo+ICBTdW1t YXJ5Ogo+Cj4gIDxjb3VnaCwgY291Z2g+IE9LIJYgeW91IGNhbiBnZXQgbW9yZSBJL08gYmFuZHdp ZHRoIG91dCBvZiB0aGUgY3VycmVudCBJL08KPiBwYXRoIGZvciBzZXF1ZW50aWFsIHNjYW4gaWYg eW91IHR1bmUgdGhlIGZpbGVzeXN0ZW0gZm9yIGxhcmdlIHJlYWRhaGVhZC4KPiBUaGlzIGlzIGEg Y2hlYXAgYWx0ZXJuYXRpdmUgdG8gb3ZlcmhhdWxpbmcgdGhlIGV4ZWN1dG9yIHRvIHVzZSBhc3lu Y2ggSS9PLgo+Cj4gIFN0aWxsLCB0aGVyZSBpcyBhIENQVSBsaW1pdCBoZXJlIJYgdGhpcyBpcyBu b3QgSS9PIGJvdW5kLCBpdCBpcyBDUFUgbGltaXRlZAo+IGFzIGV2aWRlbmNlZCBieSB0aGUgc2Vu c2l0aXZpdHkgdG8gcmVhZGFoZWFkIHNldHRpbmdzLiAgIElmIHRoZSBmaWxlc3lzdGVtCj4gY291 bGQgZG8gMUdCL3MsIHlvdSB3b3VsZG4ndCBnbyBhbnkgZmFzdGVyIHRoYW4gMjQ0TUIvcy4KPgo+ ICAtIEx1a2UK From pgsql-performance-owner@postgresql.org Fri Nov 18 14:10:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 57267DBAC8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:31:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55368-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:31:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id 2E7ABDBAAE for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:31:10 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 11:31:01 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 11:31:01 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 11:31:01 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 08:31:00 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Bill McGonigle" <bill@bfccomputing.com>, "Dave Cramer" <pg@fastcrypt.com> cc: pgsql-performance@postgresql.org Message-ID: <BFA341C4.14059%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsXA9ODu7eWyQrRSGPSXAUktgd9wAAWZZO In-Reply-To: <d555b0eedb008ce34e18463cceb73b04@bfccomputing.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 16:31:01.0848 (UTC) FILETIME=[76C23580:01C5EC5D] X-WSS-ID: 6F60DE4F21G13535249-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/363 X-Sequence-Number: 15620 Bill, On 11/18/05 7:55 AM, "Bill McGonigle" <bill@bfccomputing.com> wrote: > > There is some truth to it. For an app I'm currently running (full-text > search using tsearch2 on ~100MB of data) on: Do you mean 100GB? Sounds like you are more like a decision support /warehousing application. > Dev System: > Asus bare-bones bookshelf case/mobo > 3GHz P4 w/ HT > 800MHz memory Bus > Fedora Core 3 (nightly update) > 1GB RAM > 1 SATA Seagate disk (7200RPM, 8MB Cache) > $800 > worst-case query: 7.2 seconds About the same machine I posted results for, except I had two faster disks. > now, the machine I'm deploying to: > > Dell SomthingOrOther > (4) 2.4GHz Xeons > 533MHz memory bus > RedHat Enterprise 3.6 > 1GB RAM > (5) 150000 RPM Ultra SCSI 320 on an Adaptec RAID 5 controller >> $10000 > same worst-case query: 9.6 seconds Your problem here is the HW RAID controller - if you dump it and use the onboard SCSI channels and Linux RAID you will see a jump from 40MB/s to about 220MB/s in read performance and from 20MB/s to 110MB/s write performance. It will use less CPU too. > Now it's not apples-to-apples. There's a kernel 2.4 vs. 2.6 difference > and the memory bus is much faster and I'm not sure what kind of context > switching hit you get with the Xeon MP memory controller. On a > previous postgresql app I did I ran nearly identically spec'ed machines > except for the memory bus and saw about a 30% boost in performance just > with the 800MHz bus. I imagine the Opteron bus does even better. Memory bandwidth is so high on both that it's not a factor. Context switching / memory bus contention isn't either. > So the small machine is probably slower on disk but makes up for it in > single-threaded access to CPU and memory speed. But if this app were to > be scaled it would make much more sense to cluster several $800 > machines than it would to buy 'big-iron'. Yes it does - by a lot too. Also, having a multiprocessing executor gets all of each machine by having multiple CPUs scan simultaneously. - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 14:04:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9FD13DBABC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 12:33:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55292-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:33:57 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id DCCE0DBAB1 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 12:33:56 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Fri, 18 Nov 2005 11:33:43 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 11:33:36 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 11:33:36 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 08:33:35 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Alex Turner" <armtuk@gmail.com> cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA3425F.1405B%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsXdILENDsmFhREdqKawANk63kWA== In-Reply-To: <33c6269f0511180828m3bc7f41dp186b4573792bf6a0@mail.gmail.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 16:33:36.0640 (UTC) FILETIME=[D3059800:01C5EC5D] X-WSS-ID: 6F60DDC721G13536843-05-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/362 X-Sequence-Number: 15619 Alex, On 11/18/05 8:28 AM, "Alex Turner" <armtuk@gmail.com> wrote: > Ok - so I ran the same test on my system and get a total speed of 113MB/sec. > Why is this? Why is the system so limited to around just 110MB/sec? I > tuned read ahead up a bit, and my results improve a bit.. OK! Now we're on the same page. Finally someone who actually tests! Check the CPU usage while it's doing the scan. Know what it's doing? Memory copies. We've profiled it extensively. So - that's the suckage - throwing more CPU power helps a bit, but the underlying issue is poorly optimized code in the Postgres executor and lack of I/O asynchrony. - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 13:35:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A78EDDBAB9 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:31:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63310-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 17:31:58 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id F1906DBA9A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 13:31:56 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIHVTNL027900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 12:31:31 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAIHUwrB012673; Fri, 18 Nov 2005 12:30:58 -0500 (EST) Message-ID: <437E0FF5.5090203@rentec.com> Date: Fri, 18 Nov 2005 12:31:33 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA33EAC.1404E%llonergan@greenplum.com> In-Reply-To: <BFA33EAC.1404E%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAIHVTNL027900 at Fri Nov 18 12:31:31 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.027 required=5 tests=[AWL=0.027] X-Spam-Score: 0.027 X-Spam-Level: X-Archive-Number: 200511/361 X-Sequence-Number: 15618 Luke Lonergan wrote: > Alan, > > On 11/18/05 8:13 AM, "Alan Stange" <stange@rentec.com> wrote: > > I told you in my initial post that I was observing numbers in > excess of > what you claiming, but you seemed to think I didn't know how to > measure > an IO rate. > > Prove me wrong, post your data. > > I should note too that our system uses about 20% of a single cpu when > performing a table scan at >100MB/s of IO. I think you claimed the > system would be cpu bound at this low IO rate. > > > See above. Here's the output from one iteration of iostat -k 60 while the box is doing a select count(1) on a 238GB table. avg-cpu: %user %nice %sys %iowait %idle 0.99 0.00 17.97 32.40 48.64 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sdd 345.95 130732.53 0.00 7843952 0 We're reading 130MB/s for a full minute. About 20% of a single cpu was being used. The remainder being idle. We've done nothing fancy and achieved results you claim shouldn't be possible. This is a system that was re-installed yesterday, no tuning was done to the file systems, kernel or storage array. What am I doing wrong? 9 years ago I co-designed a petabyte data store with a goal of 1GB/s IO (for a DOE lab). And now I don't know what I'm doing, Cheers, -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 15:40:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66E38DBAE9 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 13:54:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66191-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 17:54:22 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 25362DB7B4 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 13:54:20 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 18 Nov 2005 12:54:15 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 12:54:08 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 12:54:07 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 09:54:07 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA3553F.1406D%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsZfZw6TioWM8ESuOgRPEpH6gXiQAAxu1v In-Reply-To: <437E0FF5.5090203@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 17:54:08.0402 (UTC) FILETIME=[12F9F720:01C5EC69] X-WSS-ID: 6F60CACD2RS9590108-05-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/369 X-Sequence-Number: 15626 Alan, On 11/18/05 9:31 AM, "Alan Stange" <stange@rentec.com> wrote: > Here's the output from one iteration of iostat -k 60 while the box is > doing a select count(1) on a 238GB table. > > avg-cpu: %user %nice %sys %iowait %idle > 0.99 0.00 17.97 32.40 48.64 > > Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn > sdd 345.95 130732.53 0.00 7843952 0 > > We're reading 130MB/s for a full minute. About 20% of a single cpu was > being used. The remainder being idle. Cool - thanks for the results. Is that % of one CPU, or of 2? Was the system otherwise idle? > We've done nothing fancy and achieved results you claim shouldn't be > possible. This is a system that was re-installed yesterday, no tuning > was done to the file systems, kernel or storage array. Are you happy with 130MB/s? How much did you pay for that? Is it more than $2,000, or double my 2003 PC? > What am I doing wrong? > > 9 years ago I co-designed a petabyte data store with a goal of 1GB/s IO > (for a DOE lab). And now I don't know what I'm doing, Cool. Would that be Sandia? We routinely sustain 2,000 MB/s from disk on 16x 2003 era machines on complex queries. - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 14:41:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A8BBD6D50 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 14:31:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68737-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 18:31:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id E3E2BDBAB3 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 14:30:56 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIIU1Qe000149 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 13:30:02 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAIITU9l017902; Fri, 18 Nov 2005 13:29:30 -0500 (EST) Message-ID: <437E1DAE.1070301@rentec.com> Date: Fri, 18 Nov 2005 13:30:06 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA3553F.1406D%llonergan@greenplum.com> In-Reply-To: <BFA3553F.1406D%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAIIU1Qe000149 at Fri Nov 18 13:30:02 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.021 required=5 tests=[AWL=0.021] X-Spam-Score: 0.021 X-Spam-Level: X-Archive-Number: 200511/365 X-Sequence-Number: 15622 Luke Lonergan wrote: > Alan, > > On 11/18/05 9:31 AM, "Alan Stange" <stange@rentec.com> wrote: > > >> Here's the output from one iteration of iostat -k 60 while the box is >> doing a select count(1) on a 238GB table. >> >> avg-cpu: %user %nice %sys %iowait %idle >> 0.99 0.00 17.97 32.40 48.64 >> >> Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn >> sdd 345.95 130732.53 0.00 7843952 0 >> >> We're reading 130MB/s for a full minute. About 20% of a single cpu was >> being used. The remainder being idle. >> > > Cool - thanks for the results. Is that % of one CPU, or of 2? Was the > system otherwise idle? > Actually, this was dual cpu and there was other activity during the full minute, but it was on other file devices, which I didn't include in the above output. Given that, and given what I see on the box now I'd raise the 20% to 30% just to be more conservative. It's all in the kernel either way; using a different scheduler or file system would change that result. Even better would be using direct IO to not flush everything else from memory and avoid some memory copies from kernel to user space. Note that almost none of the time is user time. Changing postgresql won't change the cpu useage. One IMHO obvious improvement would be to have vacuum and analyze only do direct IO. Now they appear to be very effective memory flushing tools. Table scans on tables larger than say 4x memory should probably also use direct IO for reads. > > >> We've done nothing fancy and achieved results you claim shouldn't be >> possible. This is a system that was re-installed yesterday, no tuning >> was done to the file systems, kernel or storage array. >> > > Are you happy with 130MB/s? How much did you pay for that? Is it more than > $2,000, or double my 2003 PC? > I don't know what the system cost. It was part of block of dual opterons from Sun that we got some time ago. I think the 130MB/s is slow given the hardware, but it's acceptable. I'm not too price sensitive; I care much more about reliability, uptime, etc. > > >> What am I doing wrong? >> >> 9 years ago I co-designed a petabyte data store with a goal of 1GB/s IO >> (for a DOE lab). And now I don't know what I'm doing, >> > Cool. Would that be Sandia? > > We routinely sustain 2,000 MB/s from disk on 16x 2003 era machines on > complex queries. Disk?! 4 StorageTek tape silos. That would be .002 TB/s. One has to change how you think when you have that much data. And hope you don't have a fire, because there's no backup. That work was while I was at BNL. I believe they are now at 4PB of tape and 150TB of disk. -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 15:31:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38581DBAE2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 14:52:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71206-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 18:52:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 26309DBAAF for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 14:52:43 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Fri, 18 Nov 2005 13:52:37 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 13:52:37 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 13:52:36 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 10:52:35 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA362F3.14099%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsbnv0jIiZ3fkOQmaD0q3VF1sjeQAAsEeu In-Reply-To: <437E1DAE.1070301@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 18:52:37.0123 (UTC) FILETIME=[3E564D30:01C5EC71] X-WSS-ID: 6F60FD7F2RS9631979-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/368 X-Sequence-Number: 15625 Alan, On 11/18/05 10:30 AM, "Alan Stange" <stange@rentec.com> wrote: > Actually, this was dual cpu and there was other activity during the full > minute, but it was on other file devices, which I didn't include in the > above output. Given that, and given what I see on the box now I'd > raise the 20% to 30% just to be more conservative. It's all in the > kernel either way; using a different scheduler or file system would > change that result. Even better would be using direct IO to not flush > everything else from memory and avoid some memory copies from kernel to > user space. Note that almost none of the time is user time. Changing > postgresql won't change the cpu useage. These are all things that help on the IO wait side possibly, however, there is a producer/consumer problem in postgres that goes something like this: - Read some (small number of, sometimes 1) 8k pages - Do some work on those pages, including lots of copies - repeat This back and forth without threading (like AIO, or a multiprocessing executor) causes cycling and inefficiency that limits throughput. Optimizing some of the memcopies and other garbage out, plus increasing the internal (postgres) readahead would probably double the disk bandwidth. But to be disk-bound (meaning that the disk subsystem is running at full speed), requires asynchronous I/O. We do this now with Bizgres MPP, and we get fully saturated disk channels on every machine. That means that even on one machine, we run many times faster than non-MPP postgres. > One IMHO obvious improvement would be to have vacuum and analyze only do > direct IO. Now they appear to be very effective memory flushing tools. > Table scans on tables larger than say 4x memory should probably also use > direct IO for reads. That's been suggested many times prior - I agree, but this also needs AIO to be maximally effective. > I don't know what the system cost. It was part of block of dual > opterons from Sun that we got some time ago. I think the 130MB/s is > slow given the hardware, but it's acceptable. I'm not too price > sensitive; I care much more about reliability, uptime, etc. Then I know what they cost - we have them too (V20z and V40z). You should be getting 400MB/s+ with external RAID. >>> What am I doing wrong? >>> >>> 9 years ago I co-designed a petabyte data store with a goal of 1GB/s IO >>> (for a DOE lab). And now I don't know what I'm doing, >>> >> Cool. Would that be Sandia? >> >> We routinely sustain 2,000 MB/s from disk on 16x 2003 era machines on >> complex queries. > Disk?! 4 StorageTek tape silos. That would be .002 TB/s. One has to > change how you think when you have that much data. And hope you don't > have a fire, because there's no backup. That work was while I was at > BNL. I believe they are now at 4PB of tape and 150TB of disk. We had 1.5 Petabytes on 2 STK Silos at NAVO from 1996-1998 where I ran R&D. We also had a Cray T932 an SGI Origin 3000 with 256 CPUs, a Cray T3E with 1280 CPUs, 2 Cray J916s with 1 TB of shared disk, a Cray C90-16, a Sun E10K, etc etc, along with clusters of Alpha machines and lots of SGIs. It's nice to work with a $40M annual budget. Later, working with FSL we implemented a weather forecasting cluster that ultimately became the #5 fastest computer on the TOP500 supercomputing list from 512 Alpha cluster nodes. That machine had a 10-way shared SAN, tape robotics and a Myrinet interconnect and ran 64-bit Linux (in 1998). - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 15:30:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 23C48DBAE2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:07:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73468-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 19:07:48 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 7E10DDB9B5 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 15:07:46 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EdBaB-0008En-00; Fri, 18 Nov 2005 14:07:35 -0500 To: stange@rentec.com Cc: Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA3553F.1406D%llonergan@greenplum.com> <437E1DAE.1070301@rentec.com> In-Reply-To: <437E1DAE.1070301@rentec.com> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 18 Nov 2005 14:07:34 -0500 Message-ID: <87oe4hpyfd.fsf@stark.xeocode.com> Lines: 58 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/367 X-Sequence-Number: 15624 Alan Stange <stange@rentec.com> writes: > Luke Lonergan wrote: > > Alan, > > > > On 11/18/05 9:31 AM, "Alan Stange" <stange@rentec.com> wrote: > > > > > >> Here's the output from one iteration of iostat -k 60 while the box is > >> doing a select count(1) on a 238GB table. > >> > >> avg-cpu: %user %nice %sys %iowait %idle > >> 0.99 0.00 17.97 32.40 48.64 > >> > >> Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn > >> sdd 345.95 130732.53 0.00 7843952 0 > >> > >> We're reading 130MB/s for a full minute. About 20% of a single cpu was > >> being used. The remainder being idle. > >> > > > > Cool - thanks for the results. Is that % of one CPU, or of 2? Was the > > system otherwise idle? > > > Actually, this was dual cpu I hate to agree with him but that looks like a dual machine with one CPU pegged. Yes most of the time is being spent in the kernel, but you're still basically cpu limited. That said, 130MB/s is nothing to sneeze at, that's maxing out two high end drives and quite respectable for a 3-disk stripe set, even reasonable for a 4-disk stripe set. If you're using 5 or more disks in RAID-0 or RAID 1+0 and only getting 130MB/s then it does seem likely the cpu is actually holding you back here. Still it doesn't show Postgres being nearly so CPU wasteful as the original poster claimed. > It's all in the kernel either way; using a different scheduler or file > system would change that result. Even better would be using direct IO to not > flush everything else from memory and avoid some memory copies from kernel > to user space. Note that almost none of the time is user time. Changing > postgresql won't change the cpu useage. Well changing to direct i/o would still be changing Postgres so that's unclear. And there are plenty of more mundane ways that Postgres is responsible for how efficiently or not the kernel is used. Just using fewer syscalls to do the same amount of reading would reduce cpu consumption. > One IMHO obvious improvement would be to have vacuum and analyze only do direct > IO. Now they appear to be very effective memory flushing tools. Table scans > on tables larger than say 4x memory should probably also use direct IO for > reads. -- greg From pgsql-performance-owner@postgresql.org Fri Nov 18 15:30:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF15FDBA3F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:25:02 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77967-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 19:25:02 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 6E4D7DBACA for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 15:24:58 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 18 Nov 2005 14:24:49 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 14:24:49 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 14:24:49 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 11:24:48 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Greg Stark" <gsstark@mit.edu>, stange@rentec.com cc: "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA36A80.140AE%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsc2f8fcfu6PTQRrGGWWqW2mECvgAAlU+z In-Reply-To: <87oe4hpyfd.fsf@stark.xeocode.com> MIME-Version: 1.0 X-OriginalArrivalTime: 18 Nov 2005 19:24:49.0694 (UTC) FILETIME=[BE3D3BE0:01C5EC75] X-WSS-ID: 6F60F50B31S14707789-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/366 X-Sequence-Number: 15623 Greg, On 11/18/05 11:07 AM, "Greg Stark" <gsstark@mit.edu> wrote: > That said, 130MB/s is nothing to sneeze at, that's maxing out two high end > drives and quite respectable for a 3-disk stripe set, even reasonable for a > 4-disk stripe set. If you're using 5 or more disks in RAID-0 or RAID 1+0 and > only getting 130MB/s then it does seem likely the cpu is actually holding you > back here. With an FC array, it's undoubtedly more like 14 drives, in which case 130MB/s is laughable. On the other hand, I wouldn't be surprised if it were a single 200MB/s Fibre Channel attachment. It does make you wonder why people keep recommending 15K RPM drives, like it would help *not*. > Still it doesn't show Postgres being nearly so CPU wasteful as the original > poster claimed. It's partly about waste, and partly about lack of a concurrent I/O mechanism. We've profiled it for the waste, we've implemented concurrent I/O to prove the other point. >> It's all in the kernel either way; using a different scheduler or file >> system would change that result. Even better would be using direct IO to not >> flush everything else from memory and avoid some memory copies from kernel >> to user space. Note that almost none of the time is user time. Changing >> postgresql won't change the cpu useage. > > Well changing to direct i/o would still be changing Postgres so that's > unclear. And there are plenty of more mundane ways that Postgres is > responsible for how efficiently or not the kernel is used. Just using fewer > syscalls to do the same amount of reading would reduce cpu consumption. Bingo. - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 15:42:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 58A19DB9B5 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:39:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79634-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 19:39:50 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 6F7F5DBAF8 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 15:39:47 -0400 (AST) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIJdPsN003091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 14:39:26 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id jAIJdUGC005577; Fri, 18 Nov 2005 14:39:31 -0500 (EST) Message-ID: <437E2DF2.50906@rentec.com> Date: Fri, 18 Nov 2005 14:39:30 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Greg Stark <gsstark@mit.edu> CC: Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA3553F.1406D%llonergan@greenplum.com> <437E1DAE.1070301@rentec.com> <87oe4hpyfd.fsf@stark.xeocode.com> In-Reply-To: <87oe4hpyfd.fsf@stark.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAIJdPsN003091 at Fri Nov 18 14:39:26 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.017 required=5 tests=[AWL=0.017] X-Spam-Score: 0.017 X-Spam-Level: X-Archive-Number: 200511/371 X-Sequence-Number: 15628 Greg Stark wrote: > Alan Stange <stange@rentec.com> writes: > > >> Luke Lonergan wrote: >> >>> Alan, >>> >>> On 11/18/05 9:31 AM, "Alan Stange" <stange@rentec.com> wrote: >>> >>> >>> >>>> Here's the output from one iteration of iostat -k 60 while the box is >>>> doing a select count(1) on a 238GB table. >>>> >>>> avg-cpu: %user %nice %sys %iowait %idle >>>> 0.99 0.00 17.97 32.40 48.64 >>>> >>>> Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn >>>> sdd 345.95 130732.53 0.00 7843952 0 >>>> >>>> We're reading 130MB/s for a full minute. About 20% of a single cpu was >>>> being used. The remainder being idle. >>>> >>>> >>> Cool - thanks for the results. Is that % of one CPU, or of 2? Was the >>> system otherwise idle? >>> >>> >> Actually, this was dual cpu >> > > I hate to agree with him but that looks like a dual machine with one CPU > pegged. Yes most of the time is being spent in the kernel, but you're still > basically cpu limited. > > That said, 130MB/s is nothing to sneeze at, that's maxing out two high end > drives and quite respectable for a 3-disk stripe set, even reasonable for a > 4-disk stripe set. If you're using 5 or more disks in RAID-0 or RAID 1+0 and > only getting 130MB/s then it does seem likely the cpu is actually holding you > back here. > > Still it doesn't show Postgres being nearly so CPU wasteful as the original > poster claimed. > Yes and no. The one cpu is clearly idle. The second cpu is 40% busy and 60% idle (aka iowait in the above numbers). Of that 40%, other things were happening as well during the 1 minute snapshot. During some iostat outputs that I didn't post the cpu time was ~ 20%. So, you can take your pick. The single cpu usage is somewhere between 20% and 40%. As I can't remove other users of the system, it's the best measurement that I can make right now. Either way, it's not close to being cpu bound. This is with Opteron 248, 2.2Ghz cpus. Note that the storage system has been a bit disappointing: it's an IBM Fast T600 with a 200MB/s fiber attachment. It could be better, but it's not been the bottleneck in our work, so we haven't put any energy into it. >> It's all in the kernel either way; using a different scheduler or file >> system would change that result. Even better would be using direct IO to not >> flush everything else from memory and avoid some memory copies from kernel >> to user space. Note that almost none of the time is user time. Changing >> postgresql won't change the cpu useage. >> > Well changing to direct i/o would still be changing Postgres so that's > unclear. And there are plenty of more mundane ways that Postgres is > responsible for how efficiently or not the kernel is used. Just using fewer > syscalls to do the same amount of reading would reduce cpu consumption. Absolutely. This is why we're using a 32KB block size and also switched to using O_SYNC for the WAL syncing method. That's many MB/s that don't need to be cached in the kernel (thus evicting other data), and we avoid all the fysnc/fdatasync syscalls. The purpose of direct IO isn't to make the vacuum or analyze faster, but to lessen their impact on queries with someone waiting for the results. That's our biggest hit: running a sequential scan on 240GB of data and flushing everything else out of memory. Now that I'm think about this a bit, a big chunk of time is probably being lost in TLB misses and other virtual memory events that would be avoided if a larger page size was being used. -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 15:42:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB093DBABC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 15:40:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79805-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 19:40:13 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 38A0DDBAAE for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 15:40:10 -0400 (AST) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAIJdi34003102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2005 14:39:45 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id jAIJdoYx005594; Fri, 18 Nov 2005 14:39:50 -0500 (EST) Message-ID: <437E2E06.5070306@rentec.com> Date: Fri, 18 Nov 2005 14:39:50 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA362F3.14099%llonergan@greenplum.com> In-Reply-To: <BFA362F3.14099%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAIJdi34003102 at Fri Nov 18 14:39:45 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.016 required=5 tests=[AWL=0.016] X-Spam-Score: 0.016 X-Spam-Level: X-Archive-Number: 200511/370 X-Sequence-Number: 15627 Luke Lonergan wrote: >> opterons from Sun that we got some time ago. I think the 130MB/s is >> slow given the hardware, but it's acceptable. I'm not too price >> sensitive; I care much more about reliability, uptime, etc. >> > I don't know what the system cost. It was part of block of dual > > Then I know what they cost - we have them too (V20z and V40z). You should > be getting 400MB/s+ with external RAID. Yes, but we don't. This is where I would normally begin a rant on how craptacular Linux can be at times. But, for the sake of this discussion, postgresql isn't reading the data any more slowly than does any other program. And we don't have the time to experiment with the box. I know it should be better, but it's good enough for our purposes at this time. -- Alan From pgsql-performance-owner@postgresql.org Fri Nov 18 16:29:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C00DDDBB5F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 16:29:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87345-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 20:29:20 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by svr1.postgresql.org (Postfix) with ESMTP id 32394DBB43 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 16:29:17 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=UMKgMxx0sApZ1H1VfjR1KLvvXrtPJQiRfG8prl+EsjGL1B0W3iWBtT2Qt2E1O8Wb; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from [71.243.20.20] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EdCrE-0004mC-TL; Fri, 18 Nov 2005 15:29:17 -0500 Message-Id: <6.2.5.6.0.20051118151319.01d16288@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Fri, 18 Nov 2005 15:29:11 -0500 To: "Luke Lonergan" <llonergan@greenplum.com>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <BFA32FA6.14027%llonergan@greenplum.com> References: <0F3B99E2-4575-42B8-8AAC-3FE4B231348C@fastcrypt.com> <BFA32FA6.14027%llonergan@greenplum.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc48f667b06784056006e7b606f77b12d1350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.20.20 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/380 X-Sequence-Number: 15637 Breaking the ~120MBps pg IO ceiling by any means=20 is an important result. Particularly when you=20 get a ~2x improvement. I'm curious how far we=20 can get using simple approaches like this. At 10:13 AM 11/18/2005, Luke Lonergan wrote: >Dave, > >On 11/18/05 5:00 AM, "Dave Cramer" <pg@fastcrypt.com> wrote: > > > > Now there's an interesting line drawn in the sand. I presume you have > > numbers to back this up ? > > > > This should draw some interesting posts. > >Part 2: The answer > >System A: >This system is running RedHat 3 Update 4, with a Fedora 2.6.10 Linux= kernel. > >On a single table with 15 columns (the Bizgres=20 >IVP) at a size double memory (2.12GB), Postgres=20 >8.0.3 with Bizgres enhancements takes 32 seconds=20 >to scan the table: that=92s 66 MB/s. Not the=20 >efficiency I=92d hope from the onboard SATA=20 >controller that I=92d like, I would have expected=20 >to get 85% of the 100MB/s raw read performance. Have you tried the large read ahead trick with=20 this system? It would be interesting to see how=20 much it would help. It might even be worth it to=20 do the experiment at all of [default, 2x default,=20 4x default, 8x default, etc] read ahead until=20 either a) you run out of resources to support the=20 desired read ahead, or b) performance levels=20 off. I can imagine the results being very enlightening. >System B: >This system is running an XFS filesystem, and=20 >has been tuned to use very large (16MB)=20 >readahead. It=92s running the Centos 4.1 distro,=20 >which uses a Linux 2.6.9 kernel. > >Same test as above, but with 17GB of data takes=20 >69.7 seconds to scan (!) That=92s 244.2MB/s,=20 >which is obviously double my earlier point of=20 >110-120MB/s. This system is running with a 16MB=20 >Linux readahead setting, let=92s try it with the=20 >default (I think) setting of 256KB =96 AHA! Now we get 171.4 seconds or= 99.3MB/s. The above experiment would seem useful here as well. >Summary: > ><cough, cough> OK =96 you can get more I/O=20 >bandwidth out of the current I/O path for=20 >sequential scan if you tune the filesystem for=20 >large readahead. This is a cheap alternative to=20 >overhauling the executor to use asynch I/O. > >Still, there is a CPU limit here =96 this is not=20 >I/O bound, it is CPU limited as evidenced by the=20 >sensitivity to readahead settings. If the=20 >filesystem could do 1GB/s, you wouldn=92t go any faster than 244MB/s. > >- Luke I respect your honesty in reporting results that=20 were different then your expectations or=20 previously taken stance. Alan Stange's comment=20 re: the use of direct IO along with your comments=20 re: async IO and mem copies plus the results of=20 these experiments could very well point us=20 directly at how to most easily solve pg's CPU boundness during IO. [HACKERS] are you watching this? Ron From pgsql-performance-owner@postgresql.org Fri Nov 18 19:46:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2ADB4DBAE6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 19:46:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08330-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 23:46:58 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [203.96.152.184]) by svr1.postgresql.org (Postfix) with ESMTP id 931F9DB9FA for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 19:46:53 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb2-src-1.paradise.net.nz [203.96.152.177]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQ600J49CQ8SS@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 19 Nov 2005 12:46:56 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-15.dsl.clear.net.nz [218.101.29.15]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 7BCC010DA585; Sat, 19 Nov 2005 12:46:55 +1300 (NZDT) Date: Sat, 19 Nov 2005 12:46:54 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFA32FA6.14027%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <437E67EE.4070605@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 8BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA32FA6.14027%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200511/384 X-Sequence-Number: 15641 Luke Lonergan wrote: > (mass snippage) > time psql -c "select count(*) from ivp.bigtable1" dgtestdb > [llonergan@modena2 IVP]$ cat sysout3 > count > ---------- > 80000000 > (1 row) > > > real 1m9.875s > user 0m0.000s > sys 0m0.004s > [llonergan@modena2 IVP]$ !du > du -sk dgtestdb/base > 17021260 dgtestdb/base > > > Summary: > > <cough, cough> OK � you can get more I/O bandwidth out of the current > I/O path for sequential scan if you tune the filesystem for large > readahead. This is a cheap alternative to overhauling the executor to > use asynch I/O. > > Still, there is a CPU limit here � this is not I/O bound, it is CPU > limited as evidenced by the sensitivity to readahead settings. If the > filesystem could do 1GB/s, you wouldn�t go any faster than 244MB/s. > > Luke, Interesting - but possibly only representative for a workload consisting entirely of one executor doing "SELECT ... FROM my_single_table". If you alter this to involve more complex joins (e.g 4. way star) and (maybe add a small number of concurrent executors too) - is it still the case? Cheers Mark From pgsql-performance-owner@postgresql.org Fri Nov 18 20:04:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C795DBB3F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 20:04:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10302-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 00:04:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 9A4DDDBB1E for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 20:04:05 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 18 Nov 2005 19:04:02 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 19:04:02 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 19:04:01 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 16:04:00 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz> cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA3ABF0.14124%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsmmQi55EBnDCuTAK/LsJ/SGHiVAAAloQR In-Reply-To: <437E67EE.4070605@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Nov 2005 00:04:02.0506 (UTC) FILETIME=[BFB17AA0:01C5EC9C] X-WSS-ID: 6F60B47831S14976722-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/385 X-Sequence-Number: 15642 Mark, On 11/18/05 3:46 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > If you alter this to involve more complex joins (e.g 4. way star) and > (maybe add a small number of concurrent executors too) - is it still the > case? 4-way star, same result, that's part of my point. With Bizgres MPP, the 4-way star uses 4 concurrent scanners, though not all are active all the time. And that's per segment instance - we normally use one segment instance per CPU, so our concurrency is NCPUs plus some. The trick is the "small number of concurrent executors" part. The only way to get this with normal postgres is to have concurrent users, and normally they are doing different things, scanning different parts of the disk. These are competing things, and for concurrency enhancement something like "sync scan" would be an effective optimization. But in reporting, business analytics and warehousing in general, there are reports that take hours to run. If you can knock that down by factors of 10 using parallelism, it's a big win. That's the reason that Teradata did $1.5 Billion in business last year. More importantly - that's the kind of work that everyone using internet data for analytics wants right now. - Luke From pgsql-performance-owner@postgresql.org Fri Nov 18 20:06:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D43C3DBB34 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 20:06:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11939-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 00:06:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 09D9FDBB3A for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 20:06:05 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Fri, 18 Nov 2005 19:06:01 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 18 Nov 2005 19:06:01 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Fri, 18 Nov 2005 19:06:01 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Fri, 18 Nov 2005 16:05:59 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz> cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA3AC67.14125%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXsmmQi55EBnDCuTAK/LsJ/SGHiVAAAqD/h In-Reply-To: <437E67EE.4070605@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Nov 2005 00:06:01.0725 (UTC) FILETIME=[06C0DAD0:01C5EC9D] X-WSS-ID: 6F60B3E331S14978187-01-01 Content-Type: multipart/alternative; boundary=B_3215174759_3942834 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.254 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.254 X-Spam-Level: * X-Archive-Number: 200511/386 X-Sequence-Number: 15643 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215174759_3942834 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Mark, On 11/18/05 3:46 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > If you alter this to involve more complex joins (e.g 4. way star) and > (maybe add a small number of concurrent executors too) - is it still the > case? I may not have listened to you - are you asking about whether the readahead works for these cases? I=B9ll be running some massive TPC-H benchmarks on these machines soon =AD we=B9l= l see then. - Luke --B_3215174759_3942834 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Mark,= <BR> <BR> On 11/18/05 3:46 PM, "Mark Kirkwood" <markir@paradise.net.nz&g= t; wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>If you alter this to involve more complex joins (e.g 4.= way star) and<BR> (maybe add a small number of concurrent executors too) - is it still the<BR= > case?<BR> </SPAN></FONT></BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STY= LE=3D'font-size:14.0px'><BR> I may not have listened to you - are you asking about whether the readahead= works for these cases?<BR> <BR> I’ll be running some massive TPC-H benchmarks on these machines soon = – we’ll see then.<BR> <BR> - Luke</SPAN></FONT> </BODY> </HTML> --B_3215174759_3942834-- From pgsql-performance-owner@postgresql.org Fri Nov 18 20:06:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7644AD82C0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 20:06:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10242-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 00:06:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C847FD6D50 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 20:06:19 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAJ06LXL013281; Fri, 18 Nov 2005 19:06:21 -0500 (EST) To: "Virag Saksena" <v_saks@hotmail.com> cc: pgsql-performance@postgresql.org Subject: Re: ERROR: no value found for parameter 1 with JDBC and Explain Analyze In-reply-to: <BAY103-F11ECB17126271926CB8DE1EC5D0@phx.gbl> References: <BAY103-F11ECB17126271926CB8DE1EC5D0@phx.gbl> Comments: In-reply-to "Virag Saksena" <v_saks@hotmail.com> message dated "Tue, 15 Nov 2005 10:06:33 +0000" Date: Fri, 18 Nov 2005 19:06:20 -0500 Message-ID: <13280.1132358780@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/387 X-Sequence-Number: 15644 "Virag Saksena" <v_saks@hotmail.com> writes: > ERROR: no value found for parameter 1 > Here is sample code which causes this exception ... > pst=prodconn.prepareStatement("explain analyze select count(*) from > jam_heaprel r where heap_id = ? and parentaddr = ?"); I don't think EXPLAIN can take parameters (most of the "utility" statements don't take parameters). The usual workaround is to use PREPARE: PREPARE foo(paramtype,paramtype) AS SELECT ...; EXPLAIN EXECUTE foo(x,y); This will generate the same parameterized plan as you'd get from the other way, so it's a reasonable approximation to the behavior with JDBC parameters. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 18 22:27:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5DEF9DBB20 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 22:27:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24899-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 02:27:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-3.paradise.net.nz (bm-3a.paradise.net.nz [203.96.152.182]) by svr1.postgresql.org (Postfix) with ESMTP id C02DADBAC8 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 22:27:47 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelb2-src-1.paradise.net.nz [203.96.152.177]) by linda-3.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQ6004RJK6FAK@linda-3.paradise.net.nz> for pgsql-performance@postgresql.org; Sat, 19 Nov 2005 15:27:51 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-15.dsl.clear.net.nz [218.101.29.15]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 2249BC3DC2F; Sat, 19 Nov 2005 15:27:51 +1300 (NZDT) Date: Sat, 19 Nov 2005 15:27:49 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFA3AC67.14125%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <437E8DA5.1050703@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 8BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA3AC67.14125%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.332 required=5 tests=[RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.332 X-Spam-Level: * X-Archive-Number: 200511/388 X-Sequence-Number: 15645 Luke Lonergan wrote: > Mark, > > On 11/18/05 3:46 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > > If you alter this to involve more complex joins (e.g 4. way star) and > (maybe add a small number of concurrent executors too) - is it still the > case? > > > I may not have listened to you - are you asking about whether the > readahead works for these cases? > > I�ll be running some massive TPC-H benchmarks on these machines soon � > we�ll see then. That too, meaning the business of 1 executor random reading a given relation file whilst another is sequentially scanning (some other) part of it.... Cheers Mark From pgsql-performance-owner@postgresql.org Fri Nov 18 23:24:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AA47FD82C0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 23:24:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32774-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 03:24:12 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 142B3D6D50 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 23:24:06 -0400 (AST) Received: from hotmail.com (bay106-f29.bay106.hotmail.com [65.54.161.39]) by svr2.postgresql.org (Postfix) with ESMTP id E47C1F0B37 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 03:24:10 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 18 Nov 2005 19:24:09 -0800 Message-ID: <BAY106-F29AAEBFDCAA6E044ECFAC6B7510@phx.gbl> Received: from 65.54.161.200 by by106fd.bay106.hotmail.msn.com with HTTP; Sat, 19 Nov 2005 03:24:08 GMT X-Originating-IP: [61.230.36.176] X-Originating-Email: [anonpermutation@hotmail.com] X-Sender: anonpermutation@hotmail.com From: "anon permutation" <anonpermutation@hotmail.com> To: pgsql-performance@postgresql.org Subject: What is the max number of database I can create in an instance of pgsql? Date: Sat, 19 Nov 2005 03:24:08 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 19 Nov 2005 03:24:09.0058 (UTC) FILETIME=[B427EC20:01C5ECB8] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200511/389 X-Sequence-Number: 15646 Hi, We want to create a database for each one of our departments, but we only want to have one instance of postgresql running. There are about 10-20 departments. I can easily use createdb to create these databases. However, what is the max number of database I can create before performance goes down? Assuming each database is performing well alone, how would putting 10-20 of them together in one instance affect postgres? In terms of getting a new server for this project, how do I gauge how powerful of a server should I get? Thanks. From pgsql-performance-owner@postgresql.org Fri Nov 18 23:52:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 78AF6DB790 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 18 Nov 2005 23:52:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42379-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 03:52:57 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [151.155.5.143]) by svr1.postgresql.org (Postfix) with ESMTP id F1665D82C0 for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 23:52:50 -0400 (AST) Received: from [172.16.1.187] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.6 $ on Linux via secured & encrypted transport (TLS); Fri, 18 Nov 2005 20:49:46 -0700 In-Reply-To: <BAY106-F29AAEBFDCAA6E044ECFAC6B7510@phx.gbl> References: <BAY106-F29AAEBFDCAA6E044ECFAC6B7510@phx.gbl> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <EEBF2C76-224F-4AB4-985E-2525A5DAA2EF@myrealbox.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann <grzm@myrealbox.com> Subject: Re: What is the max number of database I can create in an instance of pgsql? Date: Sat, 19 Nov 2005 12:49:43 +0900 To: "anon permutation" <anonpermutation@hotmail.com> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.969 required=5 tests=[AWL=-0.363, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.969 X-Spam-Level: X-Archive-Number: 200511/390 X-Sequence-Number: 15647 On Nov 19, 2005, at 12:24 , anon permutation wrote: > However, what is the max number of database I can create before > performance goes down? > > Assuming each database is performing well alone, how would putting > 10-20 of them together in one instance affect postgres? > > In terms of getting a new server for this project, how do I gauge > how powerful of a server should I get? I'm sure those wiser than me will chime in with specifics. I think you should be think of usage not in terms of number of databases but in terms of connections rates, database size (numbers of tables and tuples) and the types of queries that will be run. While there may be a little overhead in from having a number of databases in the cluster, I think this is probably going to be insignificant in comparison to these other factors. A better idea of what the usage will guide you in choosing your hardware. Michael Glaesemann grzm myrealbox com From pgsql-performance-owner@postgresql.org Sat Nov 19 00:55:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6FE6CDBB8B for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 00:55:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58539-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 04:55:29 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.207]) by svr1.postgresql.org (Postfix) with ESMTP id E9840DBB87 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 00:55:28 -0400 (AST) Received: by xproxy.gmail.com with SMTP id h30so326787wxd for <pgsql-performance@postgresql.org>; Fri, 18 Nov 2005 20:55:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fON/xGlwmOrWOcX/8FqDBoLr1B1fDf9WIiVa1XYGiIPTeWE3L/Penxcq+Rj/EBz5jxr1mHEyNXDKJCriGo/zo9rCz3atbADVoAVhK4xQir8mjyao6vZ3iizw+ZJq9BUNHf52j1Tt0t/+O6PSQ60W+KKfSPRZqY/AofQLGIQXZIw= Received: by 10.65.15.4 with SMTP id s4mr609076qbi; Fri, 18 Nov 2005 20:55:26 -0800 (PST) Received: by 10.65.180.2 with HTTP; Fri, 18 Nov 2005 20:55:26 -0800 (PST) Message-ID: <c2d9e70e0511182055y79b1e914ybed284840474b632@mail.gmail.com> Date: Fri, 18 Nov 2005 23:55:26 -0500 From: Jaime Casanova <systemguards@gmail.com> To: anon permutation <anonpermutation@hotmail.com> Subject: Re: What is the max number of database I can create in an instance of pgsql? Cc: pgsql-performance@postgresql.org In-Reply-To: <BAY106-F29AAEBFDCAA6E044ECFAC6B7510@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <BAY106-F29AAEBFDCAA6E044ECFAC6B7510@phx.gbl> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.4 required=5 tests=[AWL=0.400] X-Spam-Score: 0.4 X-Spam-Level: X-Archive-Number: 200511/391 X-Sequence-Number: 15648 On 11/18/05, anon permutation <anonpermutation@hotmail.com> wrote: > > Hi, > > We want to create a database for each one of our departments, but we only > want to have one instance of postgresql running. There are about 10-20 > departments. I can easily use createdb to create these databases. Howev= er, > After of doing this, you have to think if you will want to make querys across the info of some or all databases (and you will) if that is the case the better you can do is create schemas instead of databases... > what is the max number of database I can create before performance goes > down? > the problem isn't about number of databases but concurrent users... after all you will have the same resources for 1 or 100 databases, the important thing is the number of users, the amount of data normal users will process in a normal day, and complexity of your queries. > Assuming each database is performing well alone, how would putting 10-20 = of > > them together in one instance affect postgres? > > In terms of getting a new server for this project, how do I gauge how > powerful of a server should I get? > > Thanks. > > -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Sat Nov 19 06:51:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 078FBDBBF9 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 06:51:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06609-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 10:51:51 +0000 (GMT) X-Greylist: delayed 03:05:18.766441 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 34B15DBBD3 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 06:51:47 -0400 (AST) Received: from alexwang.com (alexwang.com [220.132.178.72]) by svr2.postgresql.org (Postfix) with ESMTP id 34773F0B8E for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 07:46:27 +0000 (GMT) Received: from alexxp ([192.168.0.2]) (authenticated bits=0) by alexwang.com (8.13.5/8.13.5) with ESMTP id jAJ7kmej017555 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 15:46:49 +0800 (CST) Message-ID: <002601c5ecdd$503279e0$0200a8c0@alexxp> From: "Alex Wang" <alex@alexwang.com> To: <pgsql-performance@postgresql.org> Subject: VERY slow after many updates Date: Sat, 19 Nov 2005 15:46:06 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="big5"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-twbsd-MailScanner-Information: Please contact the ISP for more information X-twbsd-MailScanner: Found to be clean X-twbsd-MailScanner-From: alex@alexwang.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/392 X-Sequence-Number: 15649 I am using PostgreSQL in an embedded system which has only 32 or 64 MB RAM (run on PPC 266 MHz or ARM 266MHz CPU). I have a table to keep downlaod tasks. There is a daemon keep looking up the table and fork a new process to download data from internet. Daemon: . Check the table every 5 seconds . Fork a download process to download if there is new task Downlaod process (there are 5 download process max): . Update the download rate and downloaded size every 3 seconds. At begining, everything just fine. The speed is good. But after 24 hours, the speed to access database become very very slow. Even I stop all processes, restart PostgreSQL and use psql to select data, this speed is still very very slow (a SQL command takes more than 2 seconds). It is a small table. There are only 8 records in the table. The only way to solve it is remove all database, run initdb, create new database and insert new records. I tried to run vacummdb but still very slow. Any idea to make it faster? Thanks, Alex -- Here is the table schema: create table download_queue ( task_id SERIAL, username varchar(128), pid int, url text, filename varchar(1024), status int, created_time int, started_time int, total_size int8, current_size int8, current_rate int, CONSTRAINT download_queue_pkey PRIMARY KEY(task_id) ); CREATE INDEX download_queue_user_index ON download_queue USING BTREE (username); -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Sat Nov 19 07:12:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 303AAD82C0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 07:12:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07464-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 11:12:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 57656DBB2D for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 07:12:10 -0400 (AST) Received: from [192.168.1.110] (unknown [192.168.1.110]) by mail.ecircle.de (READY) with ESMTP id 017949541EC; Sat, 19 Nov 2005 12:12:13 +0100 (CET) Subject: Re: VERY slow after many updates From: Csaba Nagy <nagy@ecircle-ag.com> To: Alex Wang <alex@alexwang.com> Cc: postgres performance list <pgsql-performance@postgresql.org> In-Reply-To: <002601c5ecdd$503279e0$0200a8c0@alexxp> References: <002601c5ecdd$503279e0$0200a8c0@alexxp> Content-Type: text/plain Message-Id: <1132398732.10890.480.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Sat, 19 Nov 2005 12:12:12 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/393 X-Sequence-Number: 15650 Alex, I suppose the table is a kind of 'queue' table, where you insert/get/delete continuously, and the life of the records is short. Considering that in postgres a delete will still leave you the record in the table's file and in the indexes, just mark it as dead, your table's actual size can grow quite a lot even if the number of live records will stay small (you will have a lot of dead tuples, the more tasks processed, the more dead tuples). So I guess you should vacuum this table very often, so that the dead tuples are reused. I'm not an expert on this, but it might be good to vacuum after each n deletions, where n is ~ half the average size of the queue you expect to have. From time to time you might want to do a vacuum full on it and a reindex. Right now I guess a vacuum full + reindex will help you. I think it's best to do: vacuum download_queue; vacuum full download_queue; reindex download_queue; I think the non-full vacuum which is less obtrusive than the full one will do at least some of the work and it will bring all needed things in FS cache, so the full vacuum to be as fast as possible (vacuum full locks exclusively the table). At least I do it this way with good results for small queue-like tables... BTW, I wonder if the download_queue_user_index index is helping you at all on that table ? Do you expect it to grow bigger than 1000 ? Otherwise it has no point to index it. HTH, Csaba. On Sat, 2005-11-19 at 08:46, Alex Wang wrote: > I am using PostgreSQL in an embedded system which has only 32 or 64 MB RAM > (run on PPC 266 MHz or ARM 266MHz CPU). I have a table to keep downlaod > tasks. There is a daemon keep looking up the table and fork a new process to > download data from internet. > > Daemon: > . Check the table every 5 seconds > . Fork a download process to download if there is new task > Downlaod process (there are 5 download process max): > . Update the download rate and downloaded size every 3 seconds. > > At begining, everything just fine. The speed is good. But after 24 hours, > the speed to access database become very very slow. Even I stop all > processes, restart PostgreSQL and use psql to select data, this speed is > still very very slow (a SQL command takes more than 2 seconds). It is a > small table. There are only 8 records in the table. > > The only way to solve it is remove all database, run initdb, create new > database and insert new records. I tried to run vacummdb but still very > slow. > > Any idea to make it faster? > > Thanks, > Alex > > -- > Here is the table schema: > create table download_queue ( > task_id SERIAL, > username varchar(128), > pid int, > url text, > filename varchar(1024), > status int, > created_time int, > started_time int, > total_size int8, > current_size int8, > current_rate int, > CONSTRAINT download_queue_pkey PRIMARY KEY(task_id) > ); > CREATE INDEX download_queue_user_index ON download_queue USING BTREE > (username); > > From pgsql-performance-owner@postgresql.org Sat Nov 19 08:05:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2256FDBBC3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 08:05:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12555-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 12:05:31 +0000 (GMT) X-Greylist: delayed 04:19:02.469402 by SQLgrey- Received: from alexwang.com (alexwang.com [220.132.178.72]) by svr1.postgresql.org (Postfix) with ESMTP id 0DFB0DBBEE for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 08:05:26 -0400 (AST) Received: from alexxp ([192.168.0.2]) (authenticated bits=0) by alexwang.com (8.13.5/8.13.5) with ESMTP id jAJC5nio018695; Sat, 19 Nov 2005 20:05:50 +0800 (CST) Message-ID: <005201c5ed01$7f15c310$0200a8c0@alexxp> From: "Alex Wang" <alex@alexwang.com> To: "Csaba Nagy" <nagy@ecircle-ag.com> Cc: "postgres performance list" <pgsql-performance@postgresql.org> References: <002601c5ecdd$503279e0$0200a8c0@alexxp> <1132398732.10890.480.camel@coppola.muc.ecircle.de> Subject: Re: VERY slow after many updates Date: Sat, 19 Nov 2005 20:05:00 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="big5"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-twbsd-MailScanner-Information: Please contact the ISP for more information X-twbsd-MailScanner: Found to be clean X-twbsd-MailScanner-From: alex@alexwang.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.932 required=5 tests=[AWL=-1.932, RCVD_IN_NJABL_DUL=1.713, RCVD_IN_WHOIS_INVALID=2.151] X-Spam-Score: 1.932 X-Spam-Level: * X-Archive-Number: 200511/394 X-Sequence-Number: 15651 Hi Csaba, Thanks for your reply. Yes, it's a "queue" table. But I did not perform many insert/delete before it becomes slow. After insert 10 records, I just do get/update continuously. After 24 hour, the whole database become very slow (not only the download_queue table but other tables, too). But you are right. Full vacuum fixes the problem. Thank you very much! I expect there will be less than 1000 records in the table. The index does obvous improvement on "SELECT task_id, username FROM download_queue WHERE username > '%s'" even there are only 100 records. Thanks, Alex ----- Original Message ----- From: "Csaba Nagy" <nagy@ecircle-ag.com> To: "Alex Wang" <alex@alexwang.com> Cc: "postgres performance list" <pgsql-performance@postgresql.org> Sent: Saturday, November 19, 2005 7:12 PM Subject: Re: [PERFORM] VERY slow after many updates > Alex, > > I suppose the table is a kind of 'queue' table, where you > insert/get/delete continuously, and the life of the records is short. > Considering that in postgres a delete will still leave you the record in > the table's file and in the indexes, just mark it as dead, your table's > actual size can grow quite a lot even if the number of live records will > stay small (you will have a lot of dead tuples, the more tasks > processed, the more dead tuples). So I guess you should vacuum this > table very often, so that the dead tuples are reused. I'm not an expert > on this, but it might be good to vacuum after each n deletions, where n > is ~ half the average size of the queue you expect to have. From time to > time you might want to do a vacuum full on it and a reindex. > > Right now I guess a vacuum full + reindex will help you. I think it's > best to do: > > vacuum download_queue; > vacuum full download_queue; > reindex download_queue; > > I think the non-full vacuum which is less obtrusive than the full one > will do at least some of the work and it will bring all needed things in > FS cache, so the full vacuum to be as fast as possible (vacuum full > locks exclusively the table). At least I do it this way with good > results for small queue-like tables... > > BTW, I wonder if the download_queue_user_index index is helping you at > all on that table ? Do you expect it to grow bigger than 1000 ? > Otherwise it has no point to index it. > > HTH, > Csaba. > > On Sat, 2005-11-19 at 08:46, Alex Wang wrote: >> I am using PostgreSQL in an embedded system which has only 32 or 64 MB >> RAM >> (run on PPC 266 MHz or ARM 266MHz CPU). I have a table to keep downlaod >> tasks. There is a daemon keep looking up the table and fork a new process >> to >> download data from internet. >> >> Daemon: >> . Check the table every 5 seconds >> . Fork a download process to download if there is new task >> Downlaod process (there are 5 download process max): >> . Update the download rate and downloaded size every 3 seconds. >> >> At begining, everything just fine. The speed is good. But after 24 hours, >> the speed to access database become very very slow. Even I stop all >> processes, restart PostgreSQL and use psql to select data, this speed is >> still very very slow (a SQL command takes more than 2 seconds). It is a >> small table. There are only 8 records in the table. >> >> The only way to solve it is remove all database, run initdb, create new >> database and insert new records. I tried to run vacummdb but still very >> slow. >> >> Any idea to make it faster? >> >> Thanks, >> Alex >> >> -- >> Here is the table schema: >> create table download_queue ( >> task_id SERIAL, >> username varchar(128), >> pid int, >> url text, >> filename varchar(1024), >> status int, >> created_time int, >> started_time int, >> total_size int8, >> current_size int8, >> current_rate int, >> CONSTRAINT download_queue_pkey PRIMARY KEY(task_id) >> ); >> CREATE INDEX download_queue_user_index ON download_queue USING BTREE >> (username); >> >> > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Sat Nov 19 08:12:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 95232DBC08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 08:12:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14318-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 12:12:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 593E9DBBBE for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 08:12:49 -0400 (AST) Received: from [192.168.1.110] (unknown [192.168.1.110]) by mail.ecircle.de (READY) with ESMTP id 945C19541ED; Sat, 19 Nov 2005 13:12:52 +0100 (CET) Subject: Re: VERY slow after many updates From: Csaba Nagy <nagy@ecircle-ag.com> To: Alex Wang <alex@alexwang.com> Cc: postgres performance list <pgsql-performance@postgresql.org> In-Reply-To: <005201c5ed01$7f15c310$0200a8c0@alexxp> References: <002601c5ecdd$503279e0$0200a8c0@alexxp> <1132398732.10890.480.camel@coppola.muc.ecircle.de> <005201c5ed01$7f15c310$0200a8c0@alexxp> Content-Type: text/plain Message-Id: <1132402372.10890.487.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Sat, 19 Nov 2005 13:12:52 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/395 X-Sequence-Number: 15652 Just for clarification, update is actually equal to delete+insert in Postgres. So if you update rows, it's the same as you would delete the row and insert a new version. So the table is bloating also in this situation. I think there is an added problem when you update, namely to get to a row, postgres will traverse all dead rows matching the criteria... so even if you have an index, getting 1 row which was updated 10000 times will access 10000 rows only to find 1 which is still alive. So in this case vacuuming should happen even more often, to eliminate the dead rows. And the index was probably only helping because the table was really bloated, so if you vacuum it often enough you will be better off without the index if the row count will stay low. Cheers, Csaba. On Sat, 2005-11-19 at 13:05, Alex Wang wrote: > Hi Csaba, > > Thanks for your reply. > > Yes, it's a "queue" table. But I did not perform many insert/delete before > it becomes slow. After insert 10 records, I just do get/update continuously. > After 24 hour, the whole database become very slow (not only the > download_queue table but other tables, too). But you are right. Full vacuum > fixes the problem. Thank you very much! > > I expect there will be less than 1000 records in the table. The index does > obvous improvement on "SELECT task_id, username FROM download_queue WHERE > username > '%s'" even there are only 100 records. > > Thanks, > Alex > > ----- Original Message ----- > From: "Csaba Nagy" <nagy@ecircle-ag.com> > To: "Alex Wang" <alex@alexwang.com> > Cc: "postgres performance list" <pgsql-performance@postgresql.org> > Sent: Saturday, November 19, 2005 7:12 PM > Subject: Re: [PERFORM] VERY slow after many updates > > > > Alex, > > > > I suppose the table is a kind of 'queue' table, where you > > insert/get/delete continuously, and the life of the records is short. > > Considering that in postgres a delete will still leave you the record in > > the table's file and in the indexes, just mark it as dead, your table's > > actual size can grow quite a lot even if the number of live records will > > stay small (you will have a lot of dead tuples, the more tasks > > processed, the more dead tuples). So I guess you should vacuum this > > table very often, so that the dead tuples are reused. I'm not an expert > > on this, but it might be good to vacuum after each n deletions, where n > > is ~ half the average size of the queue you expect to have. From time to > > time you might want to do a vacuum full on it and a reindex. > > > > Right now I guess a vacuum full + reindex will help you. I think it's > > best to do: > > > > vacuum download_queue; > > vacuum full download_queue; > > reindex download_queue; > > > > I think the non-full vacuum which is less obtrusive than the full one > > will do at least some of the work and it will bring all needed things in > > FS cache, so the full vacuum to be as fast as possible (vacuum full > > locks exclusively the table). At least I do it this way with good > > results for small queue-like tables... > > > > BTW, I wonder if the download_queue_user_index index is helping you at > > all on that table ? Do you expect it to grow bigger than 1000 ? > > Otherwise it has no point to index it. > > > > HTH, > > Csaba. > > > > On Sat, 2005-11-19 at 08:46, Alex Wang wrote: > >> I am using PostgreSQL in an embedded system which has only 32 or 64 MB > >> RAM > >> (run on PPC 266 MHz or ARM 266MHz CPU). I have a table to keep downlaod > >> tasks. There is a daemon keep looking up the table and fork a new process > >> to > >> download data from internet. > >> > >> Daemon: > >> . Check the table every 5 seconds > >> . Fork a download process to download if there is new task > >> Downlaod process (there are 5 download process max): > >> . Update the download rate and downloaded size every 3 seconds. > >> > >> At begining, everything just fine. The speed is good. But after 24 hours, > >> the speed to access database become very very slow. Even I stop all > >> processes, restart PostgreSQL and use psql to select data, this speed is > >> still very very slow (a SQL command takes more than 2 seconds). It is a > >> small table. There are only 8 records in the table. > >> > >> The only way to solve it is remove all database, run initdb, create new > >> database and insert new records. I tried to run vacummdb but still very > >> slow. > >> > >> Any idea to make it faster? > >> > >> Thanks, > >> Alex > >> > >> -- > >> Here is the table schema: > >> create table download_queue ( > >> task_id SERIAL, > >> username varchar(128), > >> pid int, > >> url text, > >> filename varchar(1024), > >> status int, > >> created_time int, > >> started_time int, > >> total_size int8, > >> current_size int8, > >> current_rate int, > >> CONSTRAINT download_queue_pkey PRIMARY KEY(task_id) > >> ); > >> CREATE INDEX download_queue_user_index ON download_queue USING BTREE > >> (username); > >> > >> > > > > > > -- > > This message has been scanned for viruses and > > dangerous content by MailScanner, and is > > believed to be clean. > > > From pgsql-performance-owner@postgresql.org Sat Nov 19 08:18:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 05FFCDBC0F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 08:18:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14318-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 12:18:26 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pharmaline.de (mail.pharmaline.de [62.153.135.34]) by svr1.postgresql.org (Postfix) with ESMTP id 4EDBADBC09 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 08:18:19 -0400 (AST) Received: from [192.168.0.5] (84.60.170.103) by pharmaline.de with ESMTP (Eudora Internet Mail Server 3.2.6); Sat, 19 Nov 2005 12:18:24 +0100 In-Reply-To: <005201c5ed01$7f15c310$0200a8c0@alexxp> References: <002601c5ecdd$503279e0$0200a8c0@alexxp> <1132398732.10890.480.camel@coppola.muc.ecircle.de> <005201c5ed01$7f15c310$0200a8c0@alexxp> Mime-Version: 1.0 (Apple Message framework v746.2) X-Priority: 3 Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-6--523322015; protocol="application/pkcs7-signature" Message-Id: <AC098147-E4DC-4313-AFB3-196F1B81B96E@pharmaline.de> Cc: Alex Wang <alex@alexwang.com> From: Guido Neitzer <guido.neitzer@pharmaline.de> Subject: Re: VERY slow after many updates Date: Sat, 19 Nov 2005 13:18:19 +0100 To: postgres performance list <pgsql-performance@postgresql.org> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.236 required=5 tests=[RCVD_IN_SORBS_WEB=1.236] X-Spam-Score: 1.236 X-Spam-Level: * X-Archive-Number: 200511/396 X-Sequence-Number: 15653 --Apple-Mail-6--523322015 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 19.11.2005, at 13:05 Uhr, Alex Wang wrote: > Yes, it's a "queue" table. But I did not perform many insert/delete > before it becomes slow. After insert 10 records, I just do get/ > update continuously. When PostgreSQL updates a row, it creates a new row with the updated values. So you should be aware, that the DB gets bigger and bigger when you only update your rows. Vacuum full reclaims that used space. The concepts are described in detail in the manual in chapter 12. cug -- PharmaLine Essen, GERMANY and Big Nerd Ranch Europe - PostgreSQL Training, Dec. 2005, Rome, Italy http://www.bignerdranch.com/classes/postgresql.shtml --Apple-Mail-6--523322015 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUzCCAwww ggJ1oAMCAQICAw4DazANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwMjExMDkwNzMwWhcNMDYwMjExMDkwNzMwWjBpMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSowKAYJKoZIhvcNAQkBFhtndWlkby5uZWl0emVyQHBo YXJtYWxpbmUuZGUxGjAYBgkqhkiG9w0BCQEWC2N1Z0BtYWMuY29tMIIBIjANBgkqhkiG9w0BAQEF AAOCAQ8AMIIBCgKCAQEA5/WRLVRqtqJ+f/HOn9G513YNybt/lglgrEjo281eSXV0O1boJcCA7FuA B+Wc7BiltSkLc4nvJSegJh0RydSOKt3MywBg+N8BkgxcSWf9jYJ/JUx4uTBWAdd4Hk1+XPGHpYzQ Ric2AofRqhW8IQX/unprQ/BnAMiiuukaaGB8dqtoXDBI0RYlwHYuOTyrviEdU7jt4kgrBYu4TK01 qqKsxkr2Q7WhNT9p9w7Fu8rZF+VuJPwbZPIsfWuPZbN/7HRKoaKLG04UG1CmiqiN9JQl4tR81G4k 8WkSTPy0JruJHfOm584a1JposZwtwmcOo1l5iDJtnzSB4PvdFnFYVkJ9IQIDAQABo0UwQzAzBgNV HREELDAqgRtndWlkby5uZWl0emVyQHBoYXJtYWxpbmUuZGWBC2N1Z0BtYWMuY29tMAwGA1UdEwEB /wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAgg9T+k6d3YQITWeSYwDSPTAGN0z/BMVhrOlzF7cP4srd jU4L0RLiqFMz9D2tCMFV5P0z1FIxjSqXBpt7xkzSE8sYplMUMLBRMIV4sJbPAbdqGiB+MGLSzh7V N95dP7LwrRjFqury6j0RQ3OG6oqStCpfcMmWuAHT7gRNwjeAaQYwggM/MIICqKADAgECAgENMA0G CSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYD VQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0 aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29uYWwgRnJl ZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5jb20wHhcN MDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftOucqZWh5o wHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9xVsuvPAsH 5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAeZBlyYLf7 AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8v Y3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8EBAMCAQYw KQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3DQEBBQUA A4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9reFhYsPZ Ohl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAaWzVNd+NW IXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMc VGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZy ZWVtYWlsIElzc3VpbmcgQ0ECAw4DazAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMxCwYJKoZI hvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTExMTkxMjE4MjBaMCMGCSqGSIb3DQEJBDEWBBQ8SPYd PS5AeeZG8RNRFodt7MYSujB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQK ExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwg RnJlZW1haWwgSXNzdWluZyBDQQIDDgNrMHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYDVQQGEwJa QTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3Rl IFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw4DazANBgkqhkiG9w0BAQEFAASCAQApEWmc hGbhvBJ9xFRmxrOgGpn5P5AS+48DtP6reJrg588JSF/hbC3LKqDwecATC/rsdpQYq0aBA/jPShox e5UmBsTf9+O/bu0PzwaAXDjrokp6XVXhky+U6DdWvqRa0i1lr9f6kSHCXYr9w1oyi5KnSH7JHTm2 1qceY8YFhX4QqgqxcoAew5QvEgWR+eGiglsixVfqkv4Y4kbwUoVbLnTI1lP8AjeVjKErnSr8QM0G K1Gvj340+p7w36A9RziZEFaoRjVMS1YaW8V10MX9MmqhbnR7mVN54W90jTq4fTrzJYVd/h/PRj5k MjDwLSTb4OQIWvhi+61L4gKOk4yqDc6yAAAAAAAA --Apple-Mail-6--523322015-- From pgsql-performance-owner@postgresql.org Sat Nov 19 08:30:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7389DDBB80 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 08:30:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13970-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 12:30:24 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from alexwang.com (alexwang.com [220.132.178.72]) by svr1.postgresql.org (Postfix) with ESMTP id 03C7ADBC17 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 08:30:18 -0400 (AST) Received: from alexxp ([192.168.0.2]) (authenticated bits=0) by alexwang.com (8.13.5/8.13.5) with ESMTP id jAJCUX2x018898; Sat, 19 Nov 2005 20:30:38 +0800 (CST) Message-ID: <006b01c5ed04$f640ef70$0200a8c0@alexxp> From: "Alex Wang" <alex@alexwang.com> To: "Csaba Nagy" <nagy@ecircle-ag.com> Cc: "postgres performance list" <pgsql-performance@postgresql.org> References: <002601c5ecdd$503279e0$0200a8c0@alexxp> <1132398732.10890.480.camel@coppola.muc.ecircle.de> <005201c5ed01$7f15c310$0200a8c0@alexxp> <1132402372.10890.487.camel@coppola.muc.ecircle.de> Subject: Re: VERY slow after many updates Date: Sat, 19 Nov 2005 20:29:47 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="big5"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-twbsd-MailScanner-Information: Please contact the ISP for more information X-twbsd-MailScanner: Found to be clean X-twbsd-MailScanner-From: alex@alexwang.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.415 required=5 tests=[AWL=-1.449, RCVD_IN_NJABL_DUL=1.713, RCVD_IN_WHOIS_INVALID=2.151] X-Spam-Score: 2.415 X-Spam-Level: ** X-Archive-Number: 200511/397 X-Sequence-Number: 15654 Great infomation. I didn't know that update is equal to delete+insert in Postgres. I would be more careful on designing the database access method in this case. Thanks, Alex ----- Original Message ----- From: "Csaba Nagy" <nagy@ecircle-ag.com> To: "Alex Wang" <alex@alexwang.com> Cc: "postgres performance list" <pgsql-performance@postgresql.org> Sent: Saturday, November 19, 2005 8:12 PM Subject: Re: [PERFORM] VERY slow after many updates > Just for clarification, update is actually equal to delete+insert in > Postgres. So if you update rows, it's the same as you would delete the > row and insert a new version. So the table is bloating also in this > situation. > I think there is an added problem when you update, namely to get to a > row, postgres will traverse all dead rows matching the criteria... so > even if you have an index, getting 1 row which was updated 10000 times > will access 10000 rows only to find 1 which is still alive. So in this > case vacuuming should happen even more often, to eliminate the dead > rows. > And the index was probably only helping because the table was really > bloated, so if you vacuum it often enough you will be better off without > the index if the row count will stay low. > > Cheers, > Csaba. > > > On Sat, 2005-11-19 at 13:05, Alex Wang wrote: >> Hi Csaba, >> >> Thanks for your reply. >> >> Yes, it's a "queue" table. But I did not perform many insert/delete >> before >> it becomes slow. After insert 10 records, I just do get/update >> continuously. >> After 24 hour, the whole database become very slow (not only the >> download_queue table but other tables, too). But you are right. Full >> vacuum >> fixes the problem. Thank you very much! >> >> I expect there will be less than 1000 records in the table. The index >> does >> obvous improvement on "SELECT task_id, username FROM download_queue WHERE >> username > '%s'" even there are only 100 records. >> >> Thanks, >> Alex >> >> ----- Original Message ----- >> From: "Csaba Nagy" <nagy@ecircle-ag.com> >> To: "Alex Wang" <alex@alexwang.com> >> Cc: "postgres performance list" <pgsql-performance@postgresql.org> >> Sent: Saturday, November 19, 2005 7:12 PM >> Subject: Re: [PERFORM] VERY slow after many updates >> >> >> > Alex, >> > >> > I suppose the table is a kind of 'queue' table, where you >> > insert/get/delete continuously, and the life of the records is short. >> > Considering that in postgres a delete will still leave you the record >> > in >> > the table's file and in the indexes, just mark it as dead, your table's >> > actual size can grow quite a lot even if the number of live records >> > will >> > stay small (you will have a lot of dead tuples, the more tasks >> > processed, the more dead tuples). So I guess you should vacuum this >> > table very often, so that the dead tuples are reused. I'm not an expert >> > on this, but it might be good to vacuum after each n deletions, where n >> > is ~ half the average size of the queue you expect to have. From time >> > to >> > time you might want to do a vacuum full on it and a reindex. >> > >> > Right now I guess a vacuum full + reindex will help you. I think it's >> > best to do: >> > >> > vacuum download_queue; >> > vacuum full download_queue; >> > reindex download_queue; >> > >> > I think the non-full vacuum which is less obtrusive than the full one >> > will do at least some of the work and it will bring all needed things >> > in >> > FS cache, so the full vacuum to be as fast as possible (vacuum full >> > locks exclusively the table). At least I do it this way with good >> > results for small queue-like tables... >> > >> > BTW, I wonder if the download_queue_user_index index is helping you at >> > all on that table ? Do you expect it to grow bigger than 1000 ? >> > Otherwise it has no point to index it. >> > >> > HTH, >> > Csaba. >> > >> > On Sat, 2005-11-19 at 08:46, Alex Wang wrote: >> >> I am using PostgreSQL in an embedded system which has only 32 or 64 MB >> >> RAM >> >> (run on PPC 266 MHz or ARM 266MHz CPU). I have a table to keep >> >> downlaod >> >> tasks. There is a daemon keep looking up the table and fork a new >> >> process >> >> to >> >> download data from internet. >> >> >> >> Daemon: >> >> . Check the table every 5 seconds >> >> . Fork a download process to download if there is new task >> >> Downlaod process (there are 5 download process max): >> >> . Update the download rate and downloaded size every 3 seconds. >> >> >> >> At begining, everything just fine. The speed is good. But after 24 >> >> hours, >> >> the speed to access database become very very slow. Even I stop all >> >> processes, restart PostgreSQL and use psql to select data, this speed >> >> is >> >> still very very slow (a SQL command takes more than 2 seconds). It is >> >> a >> >> small table. There are only 8 records in the table. >> >> >> >> The only way to solve it is remove all database, run initdb, create >> >> new >> >> database and insert new records. I tried to run vacummdb but still >> >> very >> >> slow. >> >> >> >> Any idea to make it faster? >> >> >> >> Thanks, >> >> Alex >> >> >> >> -- >> >> Here is the table schema: >> >> create table download_queue ( >> >> task_id SERIAL, >> >> username varchar(128), >> >> pid int, >> >> url text, >> >> filename varchar(1024), >> >> status int, >> >> created_time int, >> >> started_time int, >> >> total_size int8, >> >> current_size int8, >> >> current_rate int, >> >> CONSTRAINT download_queue_pkey PRIMARY KEY(task_id) >> >> ); >> >> CREATE INDEX download_queue_user_index ON download_queue USING BTREE >> >> (username); >> >> >> >> >> > >> > >> > -- >> > This message has been scanned for viruses and >> > dangerous content by MailScanner, and is >> > believed to be clean. >> > >> > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Sat Nov 19 09:45:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 397ADDBC24 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 09:45:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27656-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 13:45:11 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id A1BEEDB7FA for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 09:45:06 -0400 (AST) Received: from worleyco.com (unknown [70.158.54.226]) by svr2.postgresql.org (Postfix) with ESMTP id 7D97CF0B2C for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 13:45:10 +0000 (GMT) Received: from [192.168.4.32] (unknown [192.168.4.32]) by worleyco.com (Postfix) with ESMTP id 73B5E12E718 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 07:45:09 -0600 (CST) Message-ID: <437F2C66.3030603@hardgeus.com> Date: Sat, 19 Nov 2005 07:45:10 -0600 From: John McCawley <nospam@hardgeus.com> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: What is the max number of database I can create in References: <BAY106-F29AAEBFDCAA6E044ECFAC6B7510@phx.gbl> <EEBF2C76-224F-4AB4-985E-2525A5DAA2EF@myrealbox.com> In-Reply-To: <EEBF2C76-224F-4AB4-985E-2525A5DAA2EF@myrealbox.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/398 X-Sequence-Number: 15655 >> However, what is the max number of database I can create before >> performance goes down? > I know I'm not directly answering your question, but you might want to consider why you're splitting things up into different logical databases. If security is a big concern, you can create different database users that own the different departments' tables, and each of your apps can login as the corresponding users. Everyone loves reports. Once you've got data in your database, people will ask for a billion reports...Whether or not they know it now, most likely they're going to want reports that cross the department boundaries (gross revenue, employee listings etc.) and that will be very difficult if you have multiple databases. From pgsql-performance-owner@postgresql.org Sat Nov 19 12:13:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 63F68DBC43 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 12:13:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40790-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 16:13:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by svr1.postgresql.org (Postfix) with ESMTP id 5748ADBC19 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 12:13:27 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Sat, 19 Nov 2005 11:13:10 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sat, 19 Nov 2005 11:13:10 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Sat, 19 Nov 2005 11:13:10 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sat, 19 Nov 2005 08:13:09 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com, "Greg Stark" <gsstark@mit.edu> cc: "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA48F15.14182%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXseIujtrf4zfrUS8uGzWRjlVpIrQAq5YQU In-Reply-To: <437E2DF2.50906@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Nov 2005 16:13:10.0720 (UTC) FILETIME=[22BACC00:01C5ED24] X-WSS-ID: 6F61909C2RS10459626-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/399 X-Sequence-Number: 15656 Alan, On 11/18/05 11:39 AM, "Alan Stange" <stange@rentec.com> wrote: > Yes and no. The one cpu is clearly idle. The second cpu is 40% busy > and 60% idle (aka iowait in the above numbers). The "aka iowait" is the problem here - iowait is not idle (otherwise it would be in the "idle" column). Iowait is time spent waiting on blocking io calls. As another poster pointed out, you have a two CPU system, and during your scan, as predicted, one CPU went 100% busy on the seq scan. During iowait periods, the CPU can be context switched to other users, but as I pointed out earlier, that's not useful for getting response on decision support queries. Thanks for your data, it exemplifies many of the points brought up: - Lots of disks and expensive I/O hardware does not help improve performance on large table queries because I/O bandwidth does not scale beyond 110-120MB/s on the fastest CPUs - OLTP performance optimizations are different than decision support Regards, - Luke From pgsql-performance-owner@postgresql.org Sat Nov 19 12:15:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 102E6DBBA2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 12:15:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37611-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 16:15:43 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 4B92ADBB96 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 12:15:42 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sat, 19 Nov 2005 11:15:31 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sat, 19 Nov 2005 11:15:31 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Sat, 19 Nov 2005 11:15:30 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sat, 19 Nov 2005 08:15:29 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz> cc: "Dave Cramer" <pg@fastcrypt.com>, "Greg Stark" <gsstark@mit.edu>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA48FA1.14183%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXssN0ZViVaQXB4RgWzT+CnPb8m7gAc5gMJ In-Reply-To: <437E8DA5.1050703@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 19 Nov 2005 16:15:31.0170 (UTC) FILETIME=[7671C420:01C5ED24] X-WSS-ID: 6F61902931S15625257-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/400 X-Sequence-Number: 15657 Mark, On 11/18/05 6:27 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > That too, meaning the business of 1 executor random reading a given > relation file whilst another is sequentially scanning (some other) part > of it.... I think it should actually improve things - each I/O will read 16MB into the I/O cache, then the next scanner will seek for 10ms to get the next 16MB into cache, etc. It should minimize the seek/data ratio nicely. As long as the tables are contiguous it should rock and roll. - Luke From pgsql-performance-owner@postgresql.org Sat Nov 19 13:57:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 77A92DBC53 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 13:57:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48748-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 17:57:08 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 09D06DBC69 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 13:57:06 -0400 (AST) Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by svr2.postgresql.org (Postfix) with ESMTP id F3BEBF0B09 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 17:57:06 +0000 (GMT) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jAJI5gOJ002071 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 10:05:42 -0800 Message-ID: <437F66CF.7080402@modgraph-usa.com> Date: Sat, 19 Nov 2005 09:54:23 -0800 From: "Craig A. James" <cjames@modgraph-usa.com> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Storage/Performance and splitting a table References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> In-Reply-To: <20051118034631.GA70159@winnie.fuhr.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/401 X-Sequence-Number: 15658 In a recent thread, several people pointed out that UPDATE = DELETE+INSERT. This got me to wondering. I have a table that, roughly, looks like this: create table doc ( id integer primary key, document text, keywords tsvector ); where "keywords" has a GIST index. There are about 10 million rows in the table, and an average of 20 keywords per document. I have two questions. First, I occasionally rebuild the keywords, after which the VACUUM FULL ANALYZE takes a LONG time - like 24 hours. Given the UPDATE = DELETE+INSERT, it sounds like I'd be better off with something like this: create table doc ( id integer primary key, document text, ); create table keywords ( id integer primary key, keywords tsvector ); Then I could just drop the GIST index, truncate the keywords table, rebuild the keywords, and reindex. My suspicion is that VACUUM FULL ANALYZE would be quick -- there would be no garbage to collect, so all it would to do is the ANALYZE part. My second question: With the doc and keywords split into two tables, would the tsearch2/GIST performance be faster? The second schema's "keywords" table has just pure keywords (no documents); does that translate to fewer blocks being read during a tsearch2/GIST query? Or are the "document" and "keywords" columns of the first schema already stored separately on disk so that the size of the "document" data doesn't affect the "keywords" search performance? Thanks, Craig From pgsql-performance-owner@postgresql.org Sat Nov 19 15:03:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CBB1FDBB64 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 15:03:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75019-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 19:03:08 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by svr1.postgresql.org (Postfix) with ESMTP id 43AFFDBB5E for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 15:03:05 -0400 (AST) Received: from osgiliath.mathom.us ([68.239.91.220]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQ700B15U94XYC8@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Sat, 19 Nov 2005 13:03:05 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 4385460F531 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 14:03:05 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 28339-05-3 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 14:03:05 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 209DF600635; Sat, 19 Nov 2005 14:03:05 -0500 (EST) Date: Sat, 19 Nov 2005 14:03:04 -0500 From: Michael Stone <mstone+postgres@mathom.us> Subject: Re: Storage/Performance and splitting a table In-reply-to: <437F66CF.7080402@modgraph-usa.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051119190304.GJ7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> <437F66CF.7080402@modgraph-usa.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/402 X-Sequence-Number: 15659 On Sat, Nov 19, 2005 at 09:54:23AM -0800, Craig A. James wrote: >First, I occasionally rebuild the keywords, after which the VACUUM FULL >ANALYZE takes a LONG time - like 24 hours. You know you just need vacuum, not vacuum full, right? Mike Stone From pgsql-performance-owner@postgresql.org Sat Nov 19 16:45:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53A4CDBCA8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 16:45:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84851-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 20:45:28 +0000 (GMT) X-Greylist: delayed 02:48:21.611924 by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by svr1.postgresql.org (Postfix) with ESMTP id AC900DBCB5 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 16:45:25 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jAJKsAZs002212 for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 12:54:10 -0800 Message-ID: <437F8E4A.8000603@modgraph-usa.com> Date: Sat, 19 Nov 2005 12:42:50 -0800 From: "Craig A. James" <cjames@modgraph-usa.com> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Perl DBD and an alarming problem References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> In-Reply-To: <20051118034631.GA70159@winnie.fuhr.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.032 required=5 tests=[AWL=0.032] X-Spam-Score: 0.032 X-Spam-Level: X-Archive-Number: 200511/403 X-Sequence-Number: 15660 >> When I set statement_timeout in the config file, it just didn't >> do anything - it never timed out (PG 8.0.3). > >... but did you reload the server after you [changed statement_timeout]? Mystery solved. I have two servers; I was reconfiguring one and restarting the other. Duh. Thanks, Craig From pgsql-performance-owner@postgresql.org Sat Nov 19 17:29:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9D8B2DBAA1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 17:29:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14645-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 21:29:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [203.96.152.181]) by svr1.postgresql.org (Postfix) with ESMTP id EF878DBA5F for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 17:28:57 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQ800EA810AX5@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Sun, 20 Nov 2005 10:28:58 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-89.dsl.clear.net.nz [218.101.29.89]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id E46A51222A64; Sun, 20 Nov 2005 10:28:57 +1300 (NZDT) Date: Sun, 20 Nov 2005 10:28:57 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFA3ABF0.14124%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: Dave Cramer <pg@fastcrypt.com>, Greg Stark <gsstark@mit.edu>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <437F9919.20305@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA3ABF0.14124%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.666 required=5 tests=[AWL=0.666] X-Spam-Score: 0.666 X-Spam-Level: X-Archive-Number: 200511/404 X-Sequence-Number: 15661 Luke Lonergan wrote: > Mark, > > On 11/18/05 3:46 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > > >>If you alter this to involve more complex joins (e.g 4. way star) and >>(maybe add a small number of concurrent executors too) - is it still the >>case? > > > 4-way star, same result, that's part of my point. With Bizgres MPP, the > 4-way star uses 4 concurrent scanners, though not all are active all the > time. And that's per segment instance - we normally use one segment > instance per CPU, so our concurrency is NCPUs plus some. > Luke - I don't think I was clear enough about what I was asking, sorry. I added the more "complex joins" comment because: - I am happy that seqscan is cpu bound after ~110M/s (It's cpu bound on my old P3 system even earlier than that....) - I am curious if the *other* access methods (indexscan, nested loop, hash, merge, bitmap) also suffer then same fate. I'm guessing from your comment that you have tested this too, but I think its worth clarifying! With respect to Bizgres MPP, scan parallelism is a great addition... very nice! (BTW - is that in 0.8, or are we talking a new product variant?) regards Mark From pgsql-performance-owner@postgresql.org Sat Nov 19 22:45:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 514C7DB9FC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 19 Nov 2005 22:45:23 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46667-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 02:45:26 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 8D5E6DB9EB for <pgsql-performance@postgresql.org>; Sat, 19 Nov 2005 22:45:20 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAK2iqcu017133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 19 Nov 2005 21:44:53 -0500 (EST) X-Source: non-mednet Received: from [172.16.160.106] (stangesun.rentec.com [172.16.160.106]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAK2iGLq006668; Sat, 19 Nov 2005 21:44:17 -0500 (EST) Message-ID: <437FE2E4.5040600@rentec.com> Date: Sat, 19 Nov 2005 21:43:48 -0500 From: Alan Stange <stange@rentec.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA48F15.14182%llonergan@greenplum.com> In-Reply-To: <BFA48F15.14182%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAK2iqcu017133 at Sat Nov 19 21:44:53 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.015 required=5 tests=[AWL=0.015] X-Spam-Score: 0.015 X-Spam-Level: X-Archive-Number: 200511/405 X-Sequence-Number: 15662 Luke Lonergan wrote: > Alan, > > On 11/18/05 11:39 AM, "Alan Stange" <stange@rentec.com> wrote: > > >> Yes and no. The one cpu is clearly idle. The second cpu is 40% busy >> and 60% idle (aka iowait in the above numbers). >> > > The "aka iowait" is the problem here - iowait is not idle (otherwise it > would be in the "idle" column). > > Iowait is time spent waiting on blocking io calls. As another poster > pointed out, you have a two CPU system, and during your scan, as predicted, > one CPU went 100% busy on the seq scan. During iowait periods, the CPU can > be context switched to other users, but as I pointed out earlier, that's not > useful for getting response on decision support queries. > iowait time is idle time. Period. This point has been debated endlessly for Solaris and other OS's as well. Here's the man page: %iowait Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. If the system had some other cpu bound work to perform you wouldn't ever see any iowait time. Anyone claiming the cpu was 100% busy on the sequential scan using the one set of numbers I posted is misunderstanding the actual metrics. > Thanks for your data, it exemplifies many of the points brought up: > - Lots of disks and expensive I/O hardware does not help improve performance > on large table queries because I/O bandwidth does not scale beyond > 110-120MB/s on the fastest CPUs > I don't think that is the conclusion from anecdotal numbers I posted. This file subsystem doesn't perform as well as expected for any tool. Bonnie, dd, star, etc., don't get a better data rate either. In fact, the storage system wasn't built for performance; it was build to reliably hold a big chunk of data. Even so, postgresql is reading at 130MB/s on it, using about 30% of a single cpu, almost all of which was system time. I would get the same 130MB/s on a system with cpus that were substantially slower; the limitation isn't the cpus, or postgresql. It's the IO system that is poorly configured for this test, not postgresqls ability to use it. In fact, given the numbers I posted, it's clear this system could handily generate more than 120 MB/s using a single cpu given a better IO subsystem; it has cpu time to spare. A simple test can be done: build the database in /dev/shm and time the scans. It's the same read() system call being used and now one has made the IO system "infinitely fast". The claim is being made that standard postgresql is unable to generate more than 120MB/s of IO on any IO system due to an inefficient use of the kernel API and excessive memory copies, etc. Having the database be on a ram based file system is an example of "expensive IO hardware" and all else would be the same. Hmmm, now that I think about this, I could throw a medium sized table onto /dev/shm using tablespaces on one of our 8GB linux boxes. So why is this experiment not valid, or what is it about the above assertion that I am missing? Anyway, if one cares about high speed sequential IO, then one should use a much larger block size to start. Using 8KB IOs is inappropriate for such a configuration. We happen to be using 32KB blocks on our largest database and it's been the best move for us. -- Alan From pgsql-performance-owner@postgresql.org Sun Nov 20 00:44:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B1C7DBAA1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 00:44:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65216-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 04:44:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 7A87BDB9EB for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 00:44:45 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAK4iRR6019192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 19 Nov 2005 23:44:28 -0500 (EST) X-Source: non-mednet Received: from [172.16.160.106] (stangesun.rentec.com [172.16.160.106]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAK4huxL014736; Sat, 19 Nov 2005 23:43:56 -0500 (EST) Message-ID: <437FFEF0.9090409@rentec.com> Date: Sat, 19 Nov 2005 23:43:28 -0500 From: Alan Stange <stange@rentec.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA48F15.14182%llonergan@greenplum.com> In-Reply-To: <BFA48F15.14182%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAK4iRR6019192 at Sat Nov 19 23:44:28 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.013 required=5 tests=[AWL=0.013] X-Spam-Score: 0.013 X-Spam-Level: X-Archive-Number: 200511/406 X-Sequence-Number: 15663 Another data point. We had some down time on our system today to complete some maintenance work. It took the opportunity to rebuild the 700GB file system using XFS instead of Reiser. One iostat output for 30 seconds is avg-cpu: %user %nice %sys %iowait %idle 1.58 0.00 19.69 31.94 46.78 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sdd 343.73 175035.73 277.55 5251072 8326 while doing a select count(1) on the same large table as before. Subsequent iostat output all showed that this data rate was being maintained. The system is otherwise mostly idle during this measurement. The sequential read rate is 175MB/s. The system is the same as earlier, one cpu is idle and the second is ~40% busy doing the scan and ~60% idle. This is postgresql 8.1rc1, 32KB block size. No tuning except for using a 1024KB read ahead. The peak speed of the attached storage is 200MB/s (a 2Gb/s fiber channel controller). I see no reason why this configuration wouldn't generate higher IO rates if a faster IO connection were available. Can you explain again why you think there's an IO ceiling of 120MB/s because I really don't understand? -- Alan From pgsql-performance-owner@postgresql.org Sun Nov 20 04:56:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5E3E1D70DD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 04:56:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24299-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 08:56:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz [203.96.152.183]) by svr1.postgresql.org (Postfix) with ESMTP id DB76AD6EEA for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 04:56:03 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb2-src-1.paradise.net.nz [203.96.152.177]) by linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQ800FNCWTGCJ@linda-4.paradise.net.nz> for pgsql-performance@postgresql.org; Sun, 20 Nov 2005 21:56:04 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-89.dsl.clear.net.nz [218.101.29.89]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 343DDFBDC83; Sun, 20 Nov 2005 21:56:04 +1300 (NZDT) Date: Sun, 20 Nov 2005 21:55:59 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <437F9919.20305@paradise.net.nz> To: Mark Kirkwood <markir@paradise.net.nz> Cc: Luke Lonergan <llonergan@greenplum.com>, pgsql-performance@postgresql.org, stange@rentec.com, gsstark@mit.edu, pg@fastcrypt.com, icub3d@gmail.com Message-id: <43803A1F.9030708@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA3ABF0.14124%llonergan@greenplum.com> <437F9919.20305@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.499 required=5 tests=[AWL=0.499] X-Spam-Score: 0.499 X-Spam-Level: X-Archive-Number: 200511/407 X-Sequence-Number: 15664 Mark Kirkwood wrote: > > - I am happy that seqscan is cpu bound after ~110M/s (It's cpu bound on > my old P3 system even earlier than that....) Ahem - after reading Alan's postings I am not so sure, ISTM that there is some more investigation required here too :-). From pgsql-performance-owner@postgresql.org Sun Nov 20 08:55:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AEE62D7331 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 08:55:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76131-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 12:55:18 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id B8EFFD6810 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 08:55:13 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D248C31059; Sun, 20 Nov 2005 13:55:16 +0100 (MET) From: William Yu <wyu@talisys.com> X-Newsgroups: pgsql.performance Subject: Re: Hardware/OS recommendations for large databases ( Date: Sun, 20 Nov 2005 04:55:14 -0800 Organization: Hub.Org Networking Services Lines: 24 Message-ID: <dlprnd$25d0$1@news.hub.org> References: <BFA48F15.14182%llonergan@greenplum.com> <437FE2E4.5040600@rentec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <437FE2E4.5040600@rentec.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/408 X-Sequence-Number: 15665 Alan Stange wrote: > Luke Lonergan wrote: >> The "aka iowait" is the problem here - iowait is not idle (otherwise it >> would be in the "idle" column). >> >> Iowait is time spent waiting on blocking io calls. As another poster >> pointed out, you have a two CPU system, and during your scan, as > > iowait time is idle time. Period. This point has been debated > endlessly for Solaris and other OS's as well. I'm sure the the theory is nice but here's my experience with iowait just a minute ago. I run Linux/XFce as my desktop -- decided I wanted to lookup some stuff in Wikipedia under Mozilla and my computer system became completely unusable for nearly a minute while who knows what Mozilla was doing. (Probably loading all the language packs.) I could not even switch to IRC (already loaded) to chat with other people while Mozilla was chewing up all my disk I/O. So I went to another computer, connected to mine remotely (slow...) and checked top. 90% in the "wa" column which I assume is the iowait column. It may be idle in theory but it's not a very useful idle -- wasn't able to switch to any programs already running, couldn't click on the XFce launchbar to run any new programs. From pgsql-performance-owner@postgresql.org Sun Nov 20 09:25:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D396FD76A6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 09:25:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79129-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 13:25:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id CDF4CD735B for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 09:05:24 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Edosn-0003oP-MP for pgsql-performance@postgresql.org; Sun, 20 Nov 2005 14:05:27 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Edos2-0008Bd-00 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 14:04:38 +0100 Date: Sun, 20 Nov 2005 14:04:38 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( Message-ID: <20051120130438.GA31206@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <437E2DF2.50906@rentec.com> <BFA48F15.14182%llonergan@greenplum.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <BFA48F15.14182%llonergan@greenplum.com> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/409 X-Sequence-Number: 15666 On Sat, Nov 19, 2005 at 08:13:09AM -0800, Luke Lonergan wrote: > Iowait is time spent waiting on blocking io calls. To be picky, iowait is time spent in the idle task while the I/O queue is not empty. It does not matter if the I/O is blocking or not (from userspace's point of view), and if the I/O was blocking (say, PIO) from the kernel's point of view, it would be counted in system. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Sun Nov 20 09:43:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 02056D77D6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 09:43:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80852-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 13:43:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 696ADD735B for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 09:43:13 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAKDh985005224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Nov 2005 08:43:10 -0500 (EST) X-Source: non-mednet Received: from [172.16.160.106] (stangesun.rentec.com [172.16.160.106]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAKDgbxH026842; Sun, 20 Nov 2005 08:42:38 -0500 (EST) Message-ID: <43807D31.6050008@rentec.com> Date: Sun, 20 Nov 2005 08:42:09 -0500 From: Alan Stange <stange@rentec.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: William Yu <wyu@talisys.com> CC: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA48F15.14182%llonergan@greenplum.com> <437FE2E4.5040600@rentec.com> <dlprnd$25d0$1@news.hub.org> In-Reply-To: <dlprnd$25d0$1@news.hub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAKDh985005224 at Sun Nov 20 08:43:10 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.011 required=5 tests=[AWL=0.011] X-Spam-Score: 0.011 X-Spam-Level: X-Archive-Number: 200511/410 X-Sequence-Number: 15667 William Yu wrote: > Alan Stange wrote: >> Luke Lonergan wrote: >>> The "aka iowait" is the problem here - iowait is not idle (otherwise it >>> would be in the "idle" column). >>> >>> Iowait is time spent waiting on blocking io calls. As another poster >>> pointed out, you have a two CPU system, and during your scan, as >> >> iowait time is idle time. Period. This point has been debated >> endlessly for Solaris and other OS's as well. > > I'm sure the the theory is nice but here's my experience with iowait > just a minute ago. I run Linux/XFce as my desktop -- decided I wanted > to lookup some stuff in Wikipedia under Mozilla and my computer system > became completely unusable for nearly a minute while who knows what > Mozilla was doing. (Probably loading all the language packs.) I could > not even switch to IRC (already loaded) to chat with other people > while Mozilla was chewing up all my disk I/O. > > So I went to another computer, connected to mine remotely (slow...) > and checked top. 90% in the "wa" column which I assume is the iowait > column. It may be idle in theory but it's not a very useful idle -- > wasn't able to switch to any programs already running, couldn't click > on the XFce launchbar to run any new programs. So, you have a sucky computer. I'm sorry, but iowait is still idle time, whether you believe it or not. -- Alan From pgsql-performance-owner@postgresql.org Sun Nov 20 10:22:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 74ACDD781A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 10:22:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83439-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 14:22:48 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id DE239D77D6 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 10:22:42 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Edq5Z-0003EU-00; Sun, 20 Nov 2005 09:22:41 -0500 To: Alan Stange <stange@rentec.com> Cc: Luke Lonergan <llonergan@greenplum.com>, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA48F15.14182%llonergan@greenplum.com> <437FE2E4.5040600@rentec.com> In-Reply-To: <437FE2E4.5040600@rentec.com> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 20 Nov 2005 09:22:41 -0500 Message-ID: <87y83jo0um.fsf@stark.xeocode.com> Lines: 34 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/411 X-Sequence-Number: 15668 Alan Stange <stange@rentec.com> writes: > > Iowait is time spent waiting on blocking io calls. As another poster > > pointed out, you have a two CPU system, and during your scan, as predicted, > > one CPU went 100% busy on the seq scan. During iowait periods, the CPU can > > be context switched to other users, but as I pointed out earlier, that's not > > useful for getting response on decision support queries. I don't think that's true. If the syscall was preemptable then it wouldn't show up under "iowait", but rather "idle". The time spent in iowait is time in uninterruptable sleeps where no other process can be scheduled. > iowait time is idle time. Period. This point has been debated endlessly for > Solaris and other OS's as well. > > Here's the man page: > %iowait > Show the percentage of time that the CPU or CPUs were > idle during which the system had an outstanding disk I/O > request. > > If the system had some other cpu bound work to perform you wouldn't ever see > any iowait time. Anyone claiming the cpu was 100% busy on the sequential scan > using the one set of numbers I posted is misunderstanding the actual metrics. That's easy to test. rerun the test with another process running a simple C program like "main() {while(1);}" (or two invocations of that on your system because of the extra processor). I bet you'll see about half the percentage of iowait because postres will get half as much opportunity to schedule i/o. If what you are saying were true then you should get 0% iowait. -- greg From pgsql-performance-owner@postgresql.org Sun Nov 20 10:30:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 826CDD78D2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 10:30:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84004-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 14:30:25 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id C8329D70A1 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 10:30:19 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EdqCz-0002Bi-QQ for pgsql-performance@postgresql.org; Sun, 20 Nov 2005 15:30:23 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EdqCF-0008Pe-00 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 15:29:35 +0100 Date: Sun, 20 Nov 2005 15:29:35 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( Message-ID: <20051120142935.GA32311@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <BFA48F15.14182%llonergan@greenplum.com> <437FE2E4.5040600@rentec.com> <87y83jo0um.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87y83jo0um.fsf@stark.xeocode.com> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/412 X-Sequence-Number: 15669 On Sun, Nov 20, 2005 at 09:22:41AM -0500, Greg Stark wrote: > I don't think that's true. If the syscall was preemptable then it wouldn't > show up under "iowait", but rather "idle". The time spent in iowait is time in > uninterruptable sleeps where no other process can be scheduled. You are confusing userspace with kernel space. When a process is stuck in uninterruptable sleep, it means _that process_ can't be interrupted (say, by a signal). The kernel can preempt it without problems. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Sun Nov 20 14:10:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B26FD7D62 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 14:10:35 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14460-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 18:10:34 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id C9764D7A41 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 14:10:31 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAKIA7El011087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Nov 2005 13:10:08 -0500 (EST) X-Source: non-mednet Received: from [172.16.160.106] (stangesun.rentec.com [172.16.160.106]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jAKI9Y7u014332; Sun, 20 Nov 2005 13:09:35 -0500 (EST) Message-ID: <4380BBC2.7060109@rentec.com> Date: Sun, 20 Nov 2005 13:09:06 -0500 From: Alan Stange <stange@rentec.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Greg Stark <gsstark@mit.edu> CC: Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA48F15.14182%llonergan@greenplum.com> <437FE2E4.5040600@rentec.com> <87y83jo0um.fsf@stark.xeocode.com> In-Reply-To: <87y83jo0um.fsf@stark.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAKIA7El011087 at Sun Nov 20 13:10:08 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.01 required=5 tests=[AWL=0.010] X-Spam-Score: 0.01 X-Spam-Level: X-Archive-Number: 200511/413 X-Sequence-Number: 15670 Greg Stark wrote: > Alan Stange <stange@rentec.com> writes: > > >>> Iowait is time spent waiting on blocking io calls. As another poster >>> pointed out, you have a two CPU system, and during your scan, as predicted, >>> one CPU went 100% busy on the seq scan. During iowait periods, the CPU can >>> be context switched to other users, but as I pointed out earlier, that's not >>> useful for getting response on decision support queries. >>> > > I don't think that's true. If the syscall was preemptable then it wouldn't > show up under "iowait", but rather "idle". The time spent in iowait is time in > uninterruptable sleeps where no other process can be scheduled. > That would be wrong. The time spent in iowait is idle time. The iowait stat would be 0 on a machine with a compute bound runnable process available for each cpu. Come on people, read the man page or look at the source code. Just stop making stuff up. > >> iowait time is idle time. Period. This point has been debated endlessly for >> Solaris and other OS's as well. >> >> Here's the man page: >> %iowait >> Show the percentage of time that the CPU or CPUs were >> idle during which the system had an outstanding disk I/O >> request. >> >> If the system had some other cpu bound work to perform you wouldn't ever see >> any iowait time. Anyone claiming the cpu was 100% busy on the sequential scan >> using the one set of numbers I posted is misunderstanding the actual metrics. >> > > That's easy to test. rerun the test with another process running a simple C > program like "main() {while(1);}" (or two invocations of that on your system > because of the extra processor). I bet you'll see about half the percentage of > iowait because postres will get half as much opportunity to schedule i/o. If > what you are saying were true then you should get 0% iowait. Yes, I did this once about 10 years ago. But instead of saying "I bet" and guessing at the result, you should try it yourself. Without guessing, I can tell you that the iowait time will go to 0%. You can do this loop in the shell, so there's no code to write. Also, it helps to do this with the shell running at a lower priority. -- Alan From pgsql-performance-owner@postgresql.org Sun Nov 20 17:48:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 77082D6E94 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 17:48:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52416-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 21:48:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-68-15-5-150.sd.sd.cox.net [68.15.5.150]) by svr1.postgresql.org (Postfix) with ESMTP id 8C16AD6833 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 17:48:48 -0400 (AST) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id jAKLvekp027710 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 13:57:40 -0800 Message-ID: <4380EEA2.4010002@modgraph-usa.com> Date: Sun, 20 Nov 2005 13:46:10 -0800 From: "Craig A. James" <cjames@modgraph-usa.com> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: pgsql-performance@postgresql.org Subject: Hyperthreading slows processes? References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> <437F66CF.7080402@modgraph-usa.com> <20051119190304.GJ7330@mathom.us> In-Reply-To: <20051119190304.GJ7330@mathom.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.118 required=5 tests=[AWL=-0.071, MISSING_HEADERS=0.189] X-Spam-Score: 0.118 X-Spam-Level: X-Archive-Number: 200511/414 X-Sequence-Number: 15671 This article on ZDNet claims that hyperthreading can *hurt* performance, due to contention in the L1/L2 cache by a second process: http://news.zdnet.co.uk/0,39020330,39237341,00.htm Has anyone tested this on Postgres yet? (And based on a recent somewhat caustic thread about performance on this forum, I'm going to avoid speculation, and let those who actually *know* answer! ;-) Craig From pgsql-performance-owner@postgresql.org Sun Nov 20 20:11:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1DA06D7080 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 20:11:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81489-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 00:11:25 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [203.96.152.184]) by svr1.postgresql.org (Postfix) with ESMTP id 75618D6E94 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 20:11:21 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelb2-src-1.paradise.net.nz [203.96.152.177]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQA00JIY36U82@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 21 Nov 2005 13:11:18 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-198.dsl.clear.net.nz [218.101.28.198]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 42EB9D5DD5B; Mon, 21 Nov 2005 13:11:17 +1300 (NZDT) Date: Mon, 21 Nov 2005 13:11:15 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <437FFEF0.9090409@rentec.com> To: Alan Stange <stange@rentec.com> Cc: Luke Lonergan <llonergan@greenplum.com>, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <438110A3.20506@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA48F15.14182%llonergan@greenplum.com> <437FFEF0.9090409@rentec.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.4 required=5 tests=[AWL=0.400] X-Spam-Score: 0.4 X-Spam-Level: X-Archive-Number: 200511/415 X-Sequence-Number: 15672 Alan Stange wrote: > Another data point. > We had some down time on our system today to complete some maintenance > work. It took the opportunity to rebuild the 700GB file system using > XFS instead of Reiser. > > One iostat output for 30 seconds is > > avg-cpu: %user %nice %sys %iowait %idle > 1.58 0.00 19.69 31.94 46.78 > > Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn > sdd 343.73 175035.73 277.55 5251072 8326 > > while doing a select count(1) on the same large table as before. > Subsequent iostat output all showed that this data rate was being > maintained. The system is otherwise mostly idle during this measurement. > > The sequential read rate is 175MB/s. The system is the same as earlier, > one cpu is idle and the second is ~40% busy doing the scan and ~60% > idle. This is postgresql 8.1rc1, 32KB block size. No tuning except > for using a 1024KB read ahead. > > The peak speed of the attached storage is 200MB/s (a 2Gb/s fiber channel > controller). I see no reason why this configuration wouldn't generate > higher IO rates if a faster IO connection were available. > > Can you explain again why you think there's an IO ceiling of 120MB/s > because I really don't understand? > I think what is going on here is that Luke's observation of the 120 Mb/s rate is taken from data using 8K block size - it looks like we can get higher rates with 32K. A quick test on my P3 system seems to support this (the numbers are a bit feeble, but the difference is interesting): The test is SELECT 1 FROM table, stopping Pg and unmounting the file system after each test. 8K blocksize: 25 s elapsed 48 % idle from vmstat (dual cpu system) 70 % busy from gstat (Freebsd GEOM io monitor) 181819 pages in relation 56 Mb/s effective IO throughput 32K blocksize: 23 s elapsed 44 % idle from vmstat 80 % busy from gstat 45249 pages in relation 60 Mb/s effective IO throughput I re-ran these several times - very repeatable (+/- 0.25 seconds). This is Freebsd 6.0 with the readahead set to 16 blocks, UFS2 filesystem created with 32K blocksize (both cases). It might be interesting to see the effect of using 16K (the default) with the 8K Pg block size, I would expect this to widen the gap. Cheers Mark From pgsql-performance-owner@postgresql.org Sun Nov 20 21:24:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99159D855B for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 21:24:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89289-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 01:24:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 7C431D6E94 for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 21:24:25 -0400 (AST) Received: (qmail 1699 invoked from network); 21 Nov 2005 01:24:26 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 21 Nov 2005 01:24:26 -0000 In-Reply-To: <4380EEA2.4010002@modgraph-usa.com> References: <BF9F6C0E.13B4A%llonergan@greenplum.com> <1132136225.5711.4.camel@Panoramix> <437B9DA9.2030806@modgraph-usa.com> <20051117002344.GA55377@winnie.fuhr.org> <437CF055.6020602@modgraph-usa.com> <20051117232857.GA49910@winnie.fuhr.org> <437D3085.9040207@modgraph-usa.com> <20051118034631.GA70159@winnie.fuhr.org> <437F66CF.7080402@modgraph-usa.com> <20051119190304.GJ7330@mathom.us> <4380EEA2.4010002@modgraph-usa.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <C875A76F-AC09-4207-97D6-DE7969244146@fastcrypt.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer <pg@fastcrypt.com> Subject: Re: Hyperthreading slows processes? Date: Sun, 20 Nov 2005 20:24:24 -0500 To: Craig A. James <cjames@modgraph-usa.com> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.014 required=5 tests=[AWL=0.014] X-Spam-Score: 0.014 X-Spam-Level: X-Archive-Number: 200511/416 X-Sequence-Number: 15673 Yeah, it's pretty much a known issue for postgres Dave On 20-Nov-05, at 4:46 PM, Craig A. James wrote: > This article on ZDNet claims that hyperthreading can *hurt* > performance, due to contention in the L1/L2 cache by a second process: > > http://news.zdnet.co.uk/0,39020330,39237341,00.htm > > Has anyone tested this on Postgres yet? (And based on a recent > somewhat caustic thread about performance on this forum, I'm going > to avoid speculation, and let those who actually *know* answer! ;-) > > Craig > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Sun Nov 20 21:41:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E03D4D8216 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 20 Nov 2005 21:41:14 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90856-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 01:41:17 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id 49577D7FCE for <pgsql-performance@postgresql.org>; Sun, 20 Nov 2005 21:41:11 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQA00APC7C9QN@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 21 Nov 2005 14:40:57 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-198.dsl.clear.net.nz [218.101.28.198]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 9D245129F391; Mon, 21 Nov 2005 14:40:56 +1300 (NZDT) Date: Mon, 21 Nov 2005 14:40:54 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <438110A3.20506@paradise.net.nz> To: Mark Kirkwood <markir@paradise.net.nz> Cc: Alan Stange <stange@rentec.com>, Luke Lonergan <llonergan@greenplum.com>, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <438125A6.2040200@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA48F15.14182%llonergan@greenplum.com> <437FFEF0.9090409@rentec.com> <438110A3.20506@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.333 required=5 tests=[AWL=0.333] X-Spam-Score: 0.333 X-Spam-Level: X-Archive-Number: 200511/417 X-Sequence-Number: 15674 Mark Kirkwood wrote: > The test is SELECT 1 FROM table That should read "The test is SELECT count(1) FROM table...." From pgsql-performance-owner@postgresql.org Mon Nov 21 04:13:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A8BAD78B8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 04:13:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81741-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 08:13:11 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id 19771D94E5 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 04:13:07 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Mon, 21 Nov 2005 03:12:58 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 21 Nov 2005 03:12:58 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 21 Nov 2005 03:12:57 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 21 Nov 2005 00:12:55 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Alan Stange" <stange@rentec.com> cc: "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA6C187.1425C%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXtjSIct5lGn9A0TIO+AtPmVX3wYQA5j3wv In-Reply-To: <437FFEF0.9090409@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 21 Nov 2005 08:12:58.0110 (UTC) FILETIME=[61E6E9E0:01C5EE73] X-WSS-ID: 6F9F5E002BW10867735-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/418 X-Sequence-Number: 15675 Alan, On 11/19/05 8:43 PM, "Alan Stange" <stange@rentec.com> wrote: > Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn > sdd 343.73 175035.73 277.55 5251072 8326 > > while doing a select count(1) on the same large table as before. > Subsequent iostat output all showed that this data rate was being > maintained. The system is otherwise mostly idle during this measurement. Yes - interesting. Note the other result using XFS that I posted earlier where I got 240+MB/s. XFS has more aggressive readahead, which is why I used it. > Can you explain again why you think there's an IO ceiling of 120MB/s > because I really don't understand? OK - slower this time: We've seen between 110MB/s and 120MB/s on a wide variety of fast CPU machines with fast I/O subsystems that can sustain 250MB/s+ using dd, but which all are capped at 120MB/s when doing sequential scans with different versions of Postgres. Understand my point: It doesn't matter that there is idle or iowait on the CPU, the postgres executor is not able to drive the I/O rate for two reasons: there is a lot of CPU used for the scan (the 40% you reported) and a lack of asynchrony (the iowait time). That means that by speeding up the CPU you only reduce the first part, but you don't fix the second and v.v. With more aggressive readahead, the second problem (the I/O asynchrony) is handled better by the Linux kernel and filesystem. That's what we're seeing with XFS. - Luke From pgsql-performance-owner@postgresql.org Mon Nov 21 10:57:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50540D9E93 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 10:57:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33574-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 14:57:11 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6B417D9BAB for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 10:57:05 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jALEuk8u001612; Mon, 21 Nov 2005 09:56:46 -0500 (EST) To: "Luke Lonergan" <llonergan@greenplum.com> cc: "Alan Stange" <stange@rentec.com>, "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFA6C187.1425C%llonergan@greenplum.com> References: <BFA6C187.1425C%llonergan@greenplum.com> Comments: In-reply-to "Luke Lonergan" <llonergan@greenplum.com> message dated "Mon, 21 Nov 2005 00:12:55 -0800" Date: Mon, 21 Nov 2005 09:56:46 -0500 Message-ID: <1611.1132585006@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/419 X-Sequence-Number: 15676 "Luke Lonergan" <llonergan@greenplum.com> writes: > OK - slower this time: > We've seen between 110MB/s and 120MB/s on a wide variety of fast CPU > machines with fast I/O subsystems that can sustain 250MB/s+ using dd, but > which all are capped at 120MB/s when doing sequential scans with different > versions of Postgres. Luke, sometime it would be nice if you would post your raw evidence and let other people do their own analysis. I for one have gotten tired of reading sweeping generalizations unbacked by any data. I find the notion of a magic 120MB/s barrier, independent of either CPU or disk speed, to be pretty dubious to say the least. I would like to know exactly what the "wide variety" of data points you haven't shown us are. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Nov 21 10:58:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E677D9FAD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 10:58:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30986-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 14:58:32 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 74A56D9E93 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 10:58:25 -0400 (AST) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jALEvqFu007190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Nov 2005 09:57:53 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id jALEvLFM025534; Mon, 21 Nov 2005 09:57:21 -0500 (EST) Message-ID: <4381E077.80009@rentec.com> Date: Mon, 21 Nov 2005 09:57:59 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA6C187.1425C%llonergan@greenplum.com> In-Reply-To: <BFA6C187.1425C%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jALEvqFu007190 at Mon Nov 21 09:57:53 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.009] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200511/420 X-Sequence-Number: 15677 Luke Lonergan wrote: > OK - slower this time: > We've seen between 110MB/s and 120MB/s on a wide variety of fast CPU > machines with fast I/O subsystems that can sustain 250MB/s+ using dd, but > which all are capped at 120MB/s when doing sequential scans with different > versions of Postgres. > Postgresql issues the exact same sequence of read() calls as does dd. So why is dd so much faster? I'd be careful with the dd read of a 16GB file on an 8GB system. Make sure you umount the file system first, to make sure all of the file is flushed from memory. Some systems use a freebehind on sequential reads to avoid flushing memory...and you'd find that 1/2 of your 16GB file is still in memory. The same point also holds for the writes: when dd finishes not all the data is on disk. You need to issue a sync() call to make that happen. Use lmdd to ensure that the data is actually all written. In other words, I think your dd results are possibly misleading. It's trivial to demonstrate: $ time dd if=/dev/zero of=/fidb1/bigfile bs=8k count=800000 800000+0 records in 800000+0 records out real 0m13.780s user 0m0.134s sys 0m13.510s Oops. I just wrote 470MB/s to a file system that has peak write speed of 200MB/s peak. Now, you might say that you wrote a 16GB file on an 8 GB machine so this isn't an issue. It does make your dd numbers look fast as some of the data will be unwritten. I'd also suggest running dd on the same files as postgresql. I suspect you'd find that the layout of the postgresql files isn't that good as they are grown bit by bit, unlike the file created by simply dd'ing a large file. > Understand my point: It doesn't matter that there is idle or iowait on the > CPU, the postgres executor is not able to drive the I/O rate for two > reasons: there is a lot of CPU used for the scan (the 40% you reported) and > a lack of asynchrony (the iowait time). That means that by speeding up the > CPU you only reduce the first part, but you don't fix the second and v.v. > > With more aggressive readahead, the second problem (the I/O asynchrony) is > handled better by the Linux kernel and filesystem. That's what we're seeing > with XFS. I think your point doesn't hold up. Every time you make it, I come away posting another result showing it to be incorrect. The point your making doesn't match my experience with *any* storage or program I've ever used, including postgresql. Your point suggests that the storage system is idle and that postgresql is broken because it isn't able to use the resources available...even when the cpu is very idle. How can that make sense? The issue here is that the storage system is very active doing reads on the files...which might be somewhat poorly allocated on disk because postgresql grows the tables bit by bit. I had the same readahead in Reiser and in XFS. The XFS performance was better because XFS does a better job of large file allocation on disk, thus resulting in many fewer seeks (generated by the file system itself) to read the files back in. As an example, some file systems like UFS purposely scatter large files across cylinder groups to avoid forcing large seeks on small files; one can tune this behavior so that large files are more tightly allocated. Of course, because this is engineering, I have another obligatory data point: This time it's a 4.2GB table using 137,138 32KB pages with nearly 41 million rows. A "select count(1)" on the table completes in 14.6 seconds, for an average read rate of 320 MB/s. One cpu was idle, the other averaged 32% system time and 68 user time for the 14 second period. This is on a 2.2Ghz Opteron. A faster cpu would show increased performance as I really am cpu bound finally. Postgresql is clearly able to issue the relevant sequential read() system calls and sink the resulting data without a problem if the file system is capable of providing the data. It can do this up to a speed of ~300MB/s on this class of system. Now it should be fairly simple to tweak the few spots where some excess memory copies are being done and up this result substantially. I hope postgresql is always using the libc memcpy as that's going to be a lot faster then some private routine. -- Alan From pgsql-performance-owner@postgresql.org Mon Nov 21 19:07:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 85216DB0AC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:07:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88439-07-4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 23:07:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 05766DAAA1 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 19:07:17 -0400 (AST) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr2.postgresql.org (Postfix) with ESMTP id 11F76F0D54 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 16:43:59 +0000 (GMT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 21 Nov 2005 10:43:38 -0600 Subject: Re: VERY slow after many updates From: Scott Marlowe <smarlowe@g2switchworks.com> To: Alex Wang <alex@alexwang.com> Cc: Csaba Nagy <nagy@ecircle-ag.com>, postgres performance list <pgsql-performance@postgresql.org> In-Reply-To: <006b01c5ed04$f640ef70$0200a8c0@alexxp> References: <002601c5ecdd$503279e0$0200a8c0@alexxp> <1132398732.10890.480.camel@coppola.muc.ecircle.de> <005201c5ed01$7f15c310$0200a8c0@alexxp> <1132402372.10890.487.camel@coppola.muc.ecircle.de> <006b01c5ed04$f640ef70$0200a8c0@alexxp> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132591417.28788.7.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 21 Nov 2005 10:43:38 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/428 X-Sequence-Number: 15685 On Sat, 2005-11-19 at 06:29, Alex Wang wrote: > Great infomation. I didn't know that update is equal to delete+insert in > Postgres. I would be more careful on designing the database access method in > this case. Just make sure you have regular vacuums scheduled (or run them from within your app) and you're fine. From pgsql-performance-owner@postgresql.org Mon Nov 21 17:11:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D881ADA7ED for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 17:10:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62444-09-3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 21:10:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id B4DACDA82E for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 17:10:37 -0400 (AST) Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr2.postgresql.org (Postfix) with ESMTP id 6DAC7F0F2E for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 18:07:49 +0000 (GMT) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Mon, 21 Nov 2005 13:07:17 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 21 Nov 2005 13:06:49 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 21 Nov 2005 13:06:48 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 21 Nov 2005 10:06:48 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com Cc: "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA74CB8.142B5%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXurAsgqp4BO+ENQDCiqsk4EGAnLAAGkvat In-Reply-To: <4381E077.80009@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 21 Nov 2005 18:06:49.0402 (UTC) FILETIME=[57CE99A0:01C5EEC6] X-WSS-ID: 6F9CD359328245027-18-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.562 required=5 tests=[AWL=0.309, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.562 X-Spam-Level: * X-Archive-Number: 200511/425 X-Sequence-Number: 15682 Alan, On 11/21/05 6:57 AM, "Alan Stange" <stange@rentec.com> wrote: > $ time dd if=/dev/zero of=/fidb1/bigfile bs=8k count=800000 > 800000+0 records in > 800000+0 records out > > real 0m13.780s > user 0m0.134s > sys 0m13.510s > > Oops. I just wrote 470MB/s to a file system that has peak write speed > of 200MB/s peak. How much RAM on this machine? > Now, you might say that you wrote a 16GB file on an 8 GB machine so this > isn't an issue. It does make your dd numbers look fast as some of the > data will be unwritten. This simple test, at 2x memory correlates very closely to Bonnie++ numbers for sequential scan. What's more, we see close to the same peak in practice with multiple scanners. Furthermore, if you run two of them simultaneously (on two filesystems), you can also see the I/O limited. > I'd also suggest running dd on the same files as postgresql. I suspect > you'd find that the layout of the postgresql files isn't that good as > they are grown bit by bit, unlike the file created by simply dd'ing a > large file. Can happen if you're not careful with filesystems (see above). There's nothing "wrong" with the dd test. > I think your point doesn't hold up. Every time you make it, I come away > posting another result showing it to be incorrect. Prove it - your Reiserfs number was about the same. I also posted an XFS number that was substantially higher than 110-120. > The point your making doesn't match my experience with *any* storage or > program I've ever used, including postgresql. Your point suggests that > the storage system is idle and that postgresql is broken because it > isn't able to use the resources available...even when the cpu is very > idle. How can that make sense? The issue here is that the storage > system is very active doing reads on the files...which might be somewhat > poorly allocated on disk because postgresql grows the tables bit by bit. Then you've made my point - if the problem is contiguity of files on disk, then larger allocation blocks would help on the CPU side. The objective is clear: given a high performance filesystem, how much of the available bandwidth can Postgres achieve? I think what we're seeing is that XFS is dramatically improving that objective. > I had the same readahead in Reiser and in XFS. The XFS performance was > better because XFS does a better job of large file allocation on disk, > thus resulting in many fewer seeks (generated by the file system itself) > to read the files back in. As an example, some file systems like UFS > purposely scatter large files across cylinder groups to avoid forcing > large seeks on small files; one can tune this behavior so that large > files are more tightly allocated. Our other tests have used ext3, reiser and Solaris 10 UFS, so this might make some sense. > Of course, because this is engineering, I have another obligatory data > point: This time it's a 4.2GB table using 137,138 32KB pages with > nearly 41 million rows. > > A "select count(1)" on the table completes in 14.6 seconds, for an > average read rate of 320 MB/s. So, assuming that the net memory scan rate is about 2GB/s, and two copies (one from FS cache to buffer cache, one from buffer cache to the agg node), you have a 700MB/s filesystem with the equivalent of DirectIO (no FS cache) because you are reading directly from the I/O cache. You got half of that because the I/O processing in the executor is limited to 320MB/s on that fast CPU. My point is this: if you were to decrease the filesystem speed to say 400MB/s and still use the equivalent of DirectIO, I thinkPostgres would not deliver 320MB/s, but rather something like 220MB/s due to the producer/consumer arch of the executor. If you get that part, then we're on the same track, otherwise we disagree. > One cpu was idle, the other averaged 32% system time and 68 user time > for the 14 second period. This is on a 2.2Ghz Opteron. A faster cpu > would show increased performance as I really am cpu bound finally. Yep, with the equivalent of DirectIO you are. - Luke From pgsql-performance-owner@postgresql.org Mon Nov 21 17:27:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 19227DAEFB for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 17:27:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64347-10-6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 21:27:45 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 69F7EDAA8D for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 17:27:25 -0400 (AST) Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr2.postgresql.org (Postfix) with ESMTP id B9E02F0F7A for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 18:16:05 +0000 (GMT) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 21 Nov 2005 13:14:33 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 21 Nov 2005 13:14:30 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 21 Nov 2005 13:14:29 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 21 Nov 2005 10:14:29 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Tom Lane" <tgl@sss.pgh.pa.us> Cc: "Alan Stange" <stange@rentec.com>, "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA74E85.142B8%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXuq9ofs/zrYpYQQESePaNtiZGFLgAG4+iw In-Reply-To: <1611.1132585006@sss.pgh.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 21 Nov 2005 18:14:30.0315 (UTC) FILETIME=[6A8857B0:01C5EEC7] X-WSS-ID: 6F9CD10F2UO356963-04-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.18 required=5 tests=[AWL=-0.309, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.18 X-Spam-Level: ** X-Archive-Number: 200511/426 X-Sequence-Number: 15683 Tom, On 11/21/05 6:56 AM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote: > "Luke Lonergan" <llonergan@greenplum.com> writes: >> OK - slower this time: > >> We've seen between 110MB/s and 120MB/s on a wide variety of fast CPU >> machines with fast I/O subsystems that can sustain 250MB/s+ using dd, but >> which all are capped at 120MB/s when doing sequential scans with different >> versions of Postgres. > > Luke, sometime it would be nice if you would post your raw evidence > and let other people do their own analysis. I for one have gotten > tired of reading sweeping generalizations unbacked by any data. This has partly been a challenge to get others to post their results. > I find the notion of a magic 120MB/s barrier, independent of either > CPU or disk speed, to be pretty dubious to say the least. I would > like to know exactly what the "wide variety" of data points you > haven't shown us are. I'll try to put up some of them, they've occurred over the last 3 years on various platforms including: - Dual 3.2GHz Xeon, 2 x Adaptec U320 SCSI attached to 6 x 10K RPM disks, Linux 2.6.4(?) - 2.6.10 kernel, ext2/3 and Reiser filesystems 120-130MB/s Postgres seq scan rate on 7.4 and 8.0. - Dual 1.8 GHz Opteron, 2 x LSI U320 SCSI attached to 6 x 10K RPM disks, Linux 2.6.10 kernel, ext2/3 and Reiser filesystems 110-120MB/s Postgres seq scan rate on 8.0 - Same machine as above running Solaris 10, with UFS filesystem. When I/O caching is tuned, we reach the same 110-120MB/s Postgres seq scan rate - Sam machine as above with 7 x 15K RPM 144GB disks in an external disk tray, same scan rate Only when we got these new SATA systems and tried out XFS with large readahead have we been able to break past the 120-130MB/s. After Alan's post, it seems that XFS might be a big part of that. I think we'll test ext2/3 against XFS on the same machine to find out. It may have to wait a week, as many of us are on vacation. - Luke From pgsql-performance-owner@postgresql.org Mon Nov 21 15:01:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 009DFD975D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 15:01:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98299-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:01:38 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 48EFFD9676 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 15:01:36 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EeGus-0005YC-00; Mon, 21 Nov 2005 14:01:26 -0500 To: stange@rentec.com Cc: Luke Lonergan <llonergan@greenplum.com>, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA6C187.1425C%llonergan@greenplum.com> <4381E077.80009@rentec.com> In-Reply-To: <4381E077.80009@rentec.com> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 21 Nov 2005 14:01:26 -0500 Message-ID: <87ek59omex.fsf@stark.xeocode.com> Lines: 35 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/421 X-Sequence-Number: 15678 Alan Stange <stange@rentec.com> writes: > The point your making doesn't match my experience with *any* storage or program > I've ever used, including postgresql. Your point suggests that the storage > system is idle and that postgresql is broken because it isn't able to use the > resources available...even when the cpu is very idle. How can that make sense? Well I think what he's saying is that Postgres is issuing a read, then waiting for the data to return. Then it does some processing, and goes back to issue another read. The CPU is idle half the time because Postgres isn't capable of doing any work while waiting for i/o, and the i/o system is idle half the time while the CPU intensive part happens. (Consider as a pathological example a program that reads 8k then sleeps for 10ms, and loops doing that 1,000 times. Now consider the same program optimized to read 8M asynchronously and sleep for 10s. By the time it's finished sleeping it has probably read in all 8M. Whereas the program that read 8k in little chunks interleaved with small sleeps would probably take twice as long and appear to be entirely i/o-bound with 50% iowait and 50% idle.) It's a reasonable theory and it's not inconsistent with the results you sent. But it's not exactly proven either. Nor is it clear how to improve matters. Adding additional threads to handle the i/o adds an enormous amount of complexity and creates lots of opportunity for other contention that could easily eat all of the gains. I also fear that heading in that direction could push Postgres even further from the niche of software that works fine even on low end hardware into the realm of software that only works on high end hardware. It's already suffering a bit from that. -- greg From pgsql-performance-owner@postgresql.org Mon Nov 21 15:52:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 67466D8EEC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 15:52:23 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07241-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:52:23 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by svr1.postgresql.org (Postfix) with ESMTP id E147CDA246 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 15:52:19 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 21 Nov 2005 16:53:35 -0300 X-IronPort-AV: i="3.97,357,1125892800"; d="scan'208"; a="30194701:sNHT11881021634" Received: from alvh.no-ip.org (216.155.78.23) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 435015970050D685; Mon, 21 Nov 2005 16:51:19 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 460BCCC023C; Mon, 21 Nov 2005 16:51:47 -0300 (CLST) Date: Mon, 21 Nov 2005 16:51:47 -0300 From: Alvaro Herrera <alvherre@alvh.no-ip.org> To: Greg Stark <gsstark@mit.edu> Cc: stange@rentec.com, Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( Message-ID: <20051121195147.GC26621@surnet.cl> Mail-Followup-To: Greg Stark <gsstark@mit.edu>, stange@rentec.com, Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org References: <BFA6C187.1425C%llonergan@greenplum.com> <4381E077.80009@rentec.com> <87ek59omex.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ek59omex.fsf@stark.xeocode.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.782 required=5 tests=[AWL=-0.464, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 1.782 X-Spam-Level: * X-Archive-Number: 200511/422 X-Sequence-Number: 15679 Greg Stark wrote: > I also fear that heading in that direction could push Postgres even further > from the niche of software that works fine even on low end hardware into the > realm of software that only works on high end hardware. It's already suffering > a bit from that. What's high end hardware for you? I do development on a Celeron 533 machine with 448 MB of RAM and I find it to work well (for a "slow" value of "well", certainly.) If you're talking about embedded hardware, that's another matter entirely and I don't think we really support the idea of running Postgres on one of those things. There's certainly true in that the memory requirements have increased a bit, but I don't think it really qualifies as "high end" even on 8.1. -- Alvaro Herrera Developer, http://www.PostgreSQL.org Jude: I wish humans laid eggs Ringlord: Why would you want humans to lay eggs? Jude: So I can eat them From pgsql-performance-owner@postgresql.org Mon Nov 21 15:58:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F978DA1EC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 15:58:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03726-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:58:37 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from bfccomputing.com (bfccomputing.com [217.160.248.65]) by svr1.postgresql.org (Postfix) with ESMTP id 2620DD984A for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 15:58:35 -0400 (AST) Received: from [10.0.0.202] (68-169-200-61.sbtnvt.adelphia.net [68.169.200.61]) by bfccomputing.com (Postfix) with ESMTP id 0C792E8608; Mon, 21 Nov 2005 14:58:20 -0500 (EST) In-Reply-To: <87ek59omex.fsf@stark.xeocode.com> References: <BFA6C187.1425C%llonergan@greenplum.com> <4381E077.80009@rentec.com> <87ek59omex.fsf@stark.xeocode.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <8c110ae5a3902fba586f3353b25fc54f@bfccomputing.com> Content-Transfer-Encoding: 7bit Cc: stange@rentec.com, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org, Luke Lonergan <llonergan@greenplum.com> From: Bill McGonigle <bill@bfccomputing.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Mon, 21 Nov 2005 14:58:18 -0500 To: Greg Stark <gsstark@mit.edu> X-Mailer: Apple Mail (2.623) X-bfccomputing-MailScanner-Information: Please contact the ISP for more information X-bfccomputing-MailScanner: Found to be clean X-bfccomputing-MailScanner-SpamCheck: X-MailScanner-From: bill@bfccomputing.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/423 X-Sequence-Number: 15680 Would it be worth first agreeing on a common set of criteria to measure? I see many data points going back and forth but not much agreement on what's worth measuring and how to measure. I'm not necessarily trying to herd cats, but it sure would be swell to have the several knowledgeable minds here come up with something that could uniformly tested on a range of machines, possibly even integrated into pg_bench or something. Disagreements on criteria or methodology should be methodically testable. Then I have dreams of a new pg_autotune that would know about these kinds of system-level settings. I haven't been on this list for long, and only using postgres for a handful of years, so forgive it if this has been hashed out before. -Bill ----- Bill McGonigle, Owner Work: 603.448.4440 BFC Computing, LLC Home: 603.448.1668 bill@bfccomputing.com Mobile: 603.252.2606 http://www.bfccomputing.com/ Pager: 603.442.1833 Jabber: flowerpt@gmail.com Text: bill+text@bfccomputing.com Blog: http://blog.bfccomputing.com/ From pgsql-performance-owner@postgresql.org Mon Nov 21 15:59:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 324F8DA179 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 15:59:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09401-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:59:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by svr1.postgresql.org (Postfix) with ESMTP id 6B800DA015 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 15:59:38 -0400 (AST) Received: from osgiliath.mathom.us ([68.239.91.220]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQB00AJJM6NH4N1@vms048.mailsrvcs.net> for pgsql-performance@postgresql.org; Mon, 21 Nov 2005 13:59:12 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 71D066005A5 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 14:59:09 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32155-04 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 14:59:09 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 4C5D96003BD; Mon, 21 Nov 2005 14:59:09 -0500 (EST) Date: Mon, 21 Nov 2005 14:59:09 -0500 From: Michael Stone <mstone+postgres@mathom.us> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <87ek59omex.fsf@stark.xeocode.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051121195909.GP7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <BFA6C187.1425C%llonergan@greenplum.com> <4381E077.80009@rentec.com> <87ek59omex.fsf@stark.xeocode.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/424 X-Sequence-Number: 15681 On Mon, Nov 21, 2005 at 02:01:26PM -0500, Greg Stark wrote: >I also fear that heading in that direction could push Postgres even further >from the niche of software that works fine even on low end hardware into the >realm of software that only works on high end hardware. It's already suffering >a bit from that. Well, there are are alread a bunch of open source DB's that can handle the low end. postgres is the closest thing to being able to handle the high end. Mike Stone From pgsql-performance-owner@postgresql.org Mon Nov 21 17:54:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6278DDA1B6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 17:54:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72766-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 21:54:41 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 72F17D975D for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 17:54:35 -0400 (AST) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jALLrYNC024278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Nov 2005 16:53:35 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id jALLrdxi029235; Mon, 21 Nov 2005 16:53:40 -0500 (EST) Message-ID: <438241E5.2010701@rentec.com> Date: Mon, 21 Nov 2005 16:53:41 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA74CB8.142B5%llonergan@greenplum.com> In-Reply-To: <BFA74CB8.142B5%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jALLrYNC024278 at Mon Nov 21 16:53:35 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/427 X-Sequence-Number: 15684 Luke, it's time to back yourself up with some numbers. You're claiming the need for a significant rewrite of portions of postgresql and you haven't done the work to make that case. You've apparently made some mistakes on the use of dd to benchmark a storage system. Use lmdd and umount the file system before the read and post your results. Using a file 2x the size of memory doesn't work corectly. You can quote any other numbers you want, but until you use lmdd correctly you should be ignored. Ideally, since postgresql uses 1GB files, you'll want to use 1GB files for dd as well. Luke Lonergan wrote: > Alan, > > On 11/21/05 6:57 AM, "Alan Stange" <stange@rentec.com> wrote: > > >> $ time dd if=/dev/zero of=/fidb1/bigfile bs=8k count=800000 >> 800000+0 records in >> 800000+0 records out >> >> real 0m13.780s >> user 0m0.134s >> sys 0m13.510s >> >> Oops. I just wrote 470MB/s to a file system that has peak write speed >> of 200MB/s peak. >> > How much RAM on this machine? > Doesn't matter. The result will always be wrong without a call to sync() or fsync() before the close() if you're trying to measure the speed of the disk subsystem. Add that sync() and the result will be correct for any memory size. Just for completeness: Solaris implicitly calls sync() as part of close. Bonnie used to get this wrong, so quoting Bonnie isn't any good. Note that on some systems using 2x memory for these tests is almost OK. For example, Solaris used to have a hiwater mark that would throttle processes and not allow more than a few 100K of writes to be outstanding on a file. Linux/XFS clearly allows a lot of write data to be outstanding. It's best to understand the tools and know what they do and why they can be wrong than simply quoting some other tool that makes the same mistakes. I find that postgresql is able to achieve about 175MB/s on average from a system capable of delivering 200MB/s peak and it does this with a lot of cpu time to spare. Maybe dd can do a little better and deliver 185MB/s. If I were to double the speed of my IO system, I might find that a single postgresql instance can sink about 300MB/s of data (based on the last numbers I posted). That's why I have multi-cpu opterons and more than one query/client as they soak up the remaining IO capacity. It is guaranteed that postgresql will hit some threshold of performance in the future and possible rewrites of some core functionality will be needed, but no numbers posted here so far have made the case that postgresql is in trouble now. In the mean time, build balanced systems with cpus that match the capabilities of the storage subsystems, use 32KB block sizes for large memory databases that are doing lots of sequential scans, use file systems tuned for large files, use opterons, etc. As always, one has to post some numbers. Here's an example of how dd doesn't do what you might expect: mite02:~ # lmdd if=internal of=/fidb2/bigfile bs=8k count=2k 16.7772 MB in 0.0235 secs, 714.5931 MB/sec mite02:~ # lmdd if=internal of=/fidb2/bigfile bs=8k count=2k sync=1 16.7772 MB in 0.1410 secs, 118.9696 MB/sec Both numbers are "correct". But one measures the kernels ability to absorb 2000 8KB writes with no guarantee that the data is on disk and the second measures the disk subsystems ability to write 16MB of data. dd is equivalent to the first result. You can't use the first type of result and complain that postgresql is slow. If you wrote 16G of data on a machine with 8G memory then your dd result is possibly too fast by a factor of two as 8G of the data might not be on disk yet. We won't know until you post some results. Cheers, -- Alan From pgsql-performance-owner@postgresql.org Mon Nov 21 19:44:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8ABFEDA810 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:44:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94647-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 23:44:45 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id 6B07BDA800 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 19:44:39 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Mon, 21 Nov 2005 18:44:37 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 21 Nov 2005 18:44:37 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 21 Nov 2005 18:44:36 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 21 Nov 2005 15:44:35 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA79BE3.14369%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXu5hMWI9Vj4K+JQRCllSxfoX/kHQAD3P3t In-Reply-To: <438241E5.2010701@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 21 Nov 2005 23:44:37.0181 (UTC) FILETIME=[88583ED0:01C5EEF5] X-WSS-ID: 6F9C846F19O432430-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.283 required=5 tests=[AWL=-0.206, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.283 X-Spam-Level: ** X-Archive-Number: 200511/429 X-Sequence-Number: 15686 Alan, Unless noted otherwise all results posted are for block device readahead set to 16M using "blockdev --setra=16384 <block_device>". All are using the 2.6.9-11 Centos 4.1 kernel. For those who don't have lmdd, here is a comparison of two results on an ext2 filesystem: ============================================================================ [root@modena1 dbfast1]# time bash -c "(dd if=/dev/zero of=/dbfast1/bigfile bs=8k count=800000 && sync)" 800000+0 records in 800000+0 records out real 0m33.057s user 0m0.116s sys 0m13.577s [root@modena1 dbfast1]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k count=800000 sync=1 6553.6000 MB in 31.2957 secs, 209.4092 MB/sec real 0m33.032s user 0m0.087s sys 0m13.129s ============================================================================ So lmdd with sync=1 is apparently equivalent to a sync after a dd. I use 2x memory with dd for the *READ* performance testing, but let's make sure things are synced on both sides for this set of comparisons. First, let's test ext2 versus "ext3, data=ordered", versus reiserfs versus xfs: From pgsql-performance-owner@postgresql.org Mon Nov 21 19:54:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7C0A8DA55B for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 19:54:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97565-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 21 Nov 2005 23:54:46 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by svr1.postgresql.org (Postfix) with ESMTP id B96B6DA51C for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 19:54:41 -0400 (AST) Received: from osgiliath.mathom.us ([68.239.91.220]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IQB00GNKX385262@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Mon, 21 Nov 2005 17:54:44 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id E5B726003F3 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 18:54:44 -0500 (EST) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02255-05 for <pgsql-performance@postgresql.org>; Mon, 21 Nov 2005 18:54:44 -0500 (EST) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id C0E606002E7; Mon, 21 Nov 2005 18:54:44 -0500 (EST) Date: Mon, 21 Nov 2005 18:54:44 -0500 From: Michael Stone <mstone+postgres@mathom.us> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFA74E85.142B8%llonergan@greenplum.com> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20051121235444.GR7330@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <1611.1132585006@sss.pgh.pa.us> <BFA74E85.142B8%llonergan@greenplum.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/430 X-Sequence-Number: 15687 On Mon, Nov 21, 2005 at 10:14:29AM -0800, Luke Lonergan wrote: >This has partly been a challenge to get others to post their results. You'll find that people respond better if you don't play games with them. From pgsql-performance-owner@postgresql.org Tue Nov 22 00:36:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D58DEDA246 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 00:36:18 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73679-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 04:36:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id D76EDD9BFC for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 00:36:15 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Mon, 21 Nov 2005 23:36:04 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 21 Nov 2005 23:35:28 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 21 Nov 2005 23:35:27 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 21 Nov 2005 20:35:26 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA7E00E.143DB%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXu5hMWI9Vj4K+JQRCllSxfoX/kHQAOBWQB In-Reply-To: <438241E5.2010701@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 22 Nov 2005 04:35:28.0691 (UTC) FILETIME=[2A415830:01C5EF1E] X-WSS-ID: 6F9C7FBE19O537613-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.335 required=5 tests=[AWL=-0.154, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.335 X-Spam-Level: ** X-Archive-Number: 200511/431 X-Sequence-Number: 15688 Alan, Looks like Postgres gets sensible scan rate scaling as the filesystem speed increases, as shown below. I'll drop my 120MB/s observation - perhaps CPUs got faster since I last tested this. The scaling looks like 64% of the I/O subsystem speed is available to the executor - so as the I/O subsystem increases in scan rate, so does Postgres' executor scan speed. So that leaves the question - why not more than 64% of the I/O scan rate? And why is it a flat 64% as the I/O subsystem increases in speed from 333-400MB/s? - Luke ================= Results =================== Unless noted otherwise all results posted are for block device readahead set to 16M using "blockdev --setra=16384 <block_device>". All are using the 2.6.9-11 Centos 4.1 kernel. For those who don't have lmdd, here is a comparison of two results on an ext2 filesystem: ============================================================================ [root@modena1 dbfast1]# time bash -c "(dd if=/dev/zero of=/dbfast1/bigfile bs=8k count=800000 && sync)" 800000+0 records in 800000+0 records out real 0m33.057s user 0m0.116s sys 0m13.577s [root@modena1 dbfast1]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k count=800000 sync=1 6553.6000 MB in 31.2957 secs, 209.4092 MB/sec real 0m33.032s user 0m0.087s sys 0m13.129s ============================================================================ So lmdd with sync=1 is equivalent to a sync after a dd. I use 2x memory with dd for the *READ* performance testing, but let's make sure things are synced on both write and read for this set of comparisons. First, let's test ext2 versus "ext3, data=ordered", versus xfs: ============================================================================ 16GB write, then read ============================================================================ ----------------------- ext2: ----------------------- [root@modena1 dbfast1]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k count=2000000 sync=1 16384.0000 MB in 144.2670 secs, 113.5672 MB/sec [root@modena1 dbfast1]# time lmdd if=/dbfast1/bigfile of=/dev/null bs=8k count=2000000 sync=1 16384.0000 MB in 49.3766 secs, 331.8170 MB/sec ----------------------- ext3, data=ordered: ----------------------- [root@modena1 ~]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k count=2000000 sync=1 16384.0000 MB in 137.1607 secs, 119.4511 MB/sec [root@modena1 ~]# time lmdd if=/dbfast1/bigfile of=/dev/null bs=8k count=2000000 sync=1 16384.0000 MB in 48.7398 secs, 336.1527 MB/sec ----------------------- xfs: ----------------------- [root@modena1 ~]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k count=2000000 sync=1 16384.0000 MB in 52.6141 secs, 311.3994 MB/sec [root@modena1 ~]# time lmdd if=/dbfast1/bigfile of=/dev/null bs=8k count=2000000 sync=1 16384.0000 MB in 40.2807 secs, 406.7453 MB/sec ============================================================================ I'm liking xfs! Something about the way files are layed out, as Alan suggested seems to dramatically improve write performance and perhaps consequently the read also improves. There doesn't seem to be a difference between ext3 and ext2, as expected. Now on to the Postgres 8 tests. We'll do a 16GB table size to ensure that we aren't reading from the read cache. I'll write this file through Postgres COPY to be sure that the file layout is as Postgres creates it. The alternative would be to use COPY once, then tar/untar onto different filesystems, but that may not duplicate the real world results. These tests will use Bizgres 0_8_1, which is an augmented 8.0.3. None of the augmentations act to improve the executor I/O though, so for these purposes it should be the same as 8.0.3. ============================================================================ 26GB of DBT-3 data from the lineitem table ============================================================================ llonergan=# select relpages from pg_class where relname='lineitem'; relpages ---------- 3159138 (1 row) 3159138*8192/1000000 25879 Million Bytes, or 25.9GB ----------------------- xfs: ----------------------- llonergan=# \timing Timing is on. llonergan=# select count(1) from lineitem; count ----------- 119994608 (1 row) Time: 394908.501 ms llonergan=# select count(1) from lineitem; count ----------- 119994608 (1 row) Time: 99425.223 ms llonergan=# select count(1) from lineitem; count ----------- 119994608 (1 row) Time: 99187.205 ms ----------------------- ext2: ----------------------- llonergan=# select relpages from pg_class where relname='lineitem'; relpages ---------- 3159138 (1 row) llonergan=# \timing Timing is on. llonergan=# select count(1) from lineitem; count ----------- 119994608 (1 row) Time: 395286.475 ms llonergan=# select count(1) from lineitem; count ----------- 119994608 (1 row) Time: 195756.381 ms llonergan=# select count(1) from lineitem; count ----------- 119994608 (1 row) Time: 122822.090 ms ============================================================================ Analysis of Postgres 8.0.3 results ============================================================================ ext2 xfs Write Speed 114 311 Read Speed 332 407 Postgres Seq Scan Speed 212 263 Scan % of lmdd Read Speed 63.9% 64.6% Well - looks like we get linear scaling with disk/file subsystem speedup. - Luke From pgsql-performance-owner@postgresql.org Tue Nov 22 01:10:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5E3CCDA994 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 01:10:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80198-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 05:10:29 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id 75114DA987 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 01:10:28 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQC00EW2BPFBP@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 22 Nov 2005 18:10:28 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-59.dsl.clear.net.nz [218.101.28.59]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 2E104DB4AD3; Tue, 22 Nov 2005 18:10:27 +1300 (NZDT) Date: Tue, 22 Nov 2005 18:10:24 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFA7E00E.143DB%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: stange@rentec.com, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <4382A840.3030401@paradise.net.nz> MIME-version: 1.0 Content-type: multipart/mixed; boundary=------------030902030501050304090108 X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFA7E00E.143DB%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.222 required=5 tests=[AWL=0.222] X-Spam-Score: 0.222 X-Spam-Level: X-Archive-Number: 200511/432 X-Sequence-Number: 15689 This is a multi-part message in MIME format. --------------030902030501050304090108 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Luke Lonergan wrote: > So that leaves the question - why not more than 64% of the I/O scan rate? > And why is it a flat 64% as the I/O subsystem increases in speed from > 333-400MB/s? > It might be interesting to see what effect reducing the cpu consumption entailed by the count aggregation has - by (say) writing a little bit of code to heap scan the desired relation (sample attached). Cheers Mark --------------030902030501050304090108 Content-Type: text/plain; name="fastcount.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fastcount.c" /* * fastcount.c * * Do a count that uses considerably less CPU time than an aggregate. */ #include "postgres.h" #include "funcapi.h" #include "access/heapam.h" #include "catalog/namespace.h" #include "utils/builtins.h" extern Datum fastcount(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(fastcount); Datum fastcount(PG_FUNCTION_ARGS) { text *relname = PG_GETARG_TEXT_P(0); RangeVar *relrv; Relation rel; HeapScanDesc scan; HeapTuple tuple; int64 result = 0; /* Use the name to get a suitable range variable and open the relation. */ relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname)); rel = heap_openrv(relrv, AccessShareLock); /* Start a heap scan on the relation. */ scan = heap_beginscan(rel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { result++; } /* End the scan and close up the relation. */ heap_endscan(scan); heap_close(rel, AccessShareLock); PG_RETURN_INT64(result); } --------------030902030501050304090108-- From pgsql-performance-owner@postgresql.org Tue Nov 22 03:20:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E3F7BDA7DE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 03:20:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07741-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 07:20:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0E17EDA269 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 03:20:50 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id CC1C431059; Tue, 22 Nov 2005 08:20:50 +0100 (MET) From: "Qingqing Zhou" <zhouqq@cs.toronto.edu> X-Newsgroups: pgsql.performance Subject: Re: weird performances problem Date: Tue, 22 Nov 2005 02:21:12 -0500 Organization: Hub.Org Networking Services Lines: 39 Message-ID: <dlugsf$25o5$1@news.hub.org> References: <437CC21D.8070402@openwide.fr> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.086 required=5 tests=[AWL=0.086] X-Spam-Score: 0.086 X-Spam-Level: X-Archive-Number: 200511/433 X-Sequence-Number: 15690 "Guillaume Smet" <guillaume.smet@openwide.fr> wrote > [root@bd root]# iostat 10 > > Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn > sda 7.20 0.00 92.00 0 920 > sda1 0.00 0.00 0.00 0 0 > sda2 6.40 0.00 78.40 0 784 > sda3 0.00 0.00 0.00 0 0 > sda4 0.00 0.00 0.00 0 0 > sda5 0.00 0.00 0.00 0 0 > sda6 0.80 0.00 13.60 0 136 > sdb 5.00 0.00 165.60 0 1656 > sdb1 5.00 0.00 165.60 0 1656 > > Nested Loop (cost=0.00..13.52 rows=2 width=1119) (actual > time=155.286..155.305 rows=1 loops=1) > -> Index Scan using pk_newslang on newslang nl (cost=0.00..3.87 rows=1 > width=1004) (actual time=44.575..44.579 rows=1 loops=1) > Index Cond: (((codelang)::text = 'FRA'::text) AND (3498704 = > numnews)) > -> Nested Loop Left Join (cost=0.00..9.61 rows=2 width=119) (actual > time=110.648..110.660 rows=1 loops=1) > -> Index Scan using pk_news on news n (cost=0.00..3.31 rows=2 > width=98) (actual time=0.169..0.174 rows=1 loops=1) > Index Cond: (numnews = 3498704) > -> Index Scan using pk_photo on photo p (cost=0.00..3.14 rows=1 > width=25) (actual time=110.451..110.454 rows=1 loops=1) > Index Cond: (p.numphoto = "outer".numphoto) > Total runtime: 155.514 ms > Someone is doing a massive *write* at this time, which makes your query *read* quite slow. Can you find out which process is doing write? Regards, Qingqing From pgsql-performance-owner@postgresql.org Tue Nov 22 05:49:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 346D4DADF9 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 05:49:25 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61542-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 09:49:26 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id B3B83DACD9 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 05:49:21 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id E8A4D5E1C; Tue, 22 Nov 2005 10:49:22 +0100 (CET) Message-ID: <4382E9A2.5080102@openwide.fr> Date: Tue, 22 Nov 2005 10:49:22 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Sullivan <ajs@crankycanuck.ca> CC: pgsql-performance@postgresql.org Subject: Re: weird performances problem References: <437CC21D.8070402@openwide.fr> <20051117221314.GC26696@phlogiston.dyndns.org> <437D13AA.4010309@openwide.fr> <20051118161312.GC28967@phlogiston.dyndns.org> In-Reply-To: <20051118161312.GC28967@phlogiston.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/434 X-Sequence-Number: 15691 Andrew, > I would be very suspicious of that much memory for sort. Please see > the docs for what that does. That is the amount that _each sort_ can > allocate before spilling to disk. > If some set of your users are > causing complicated queries with, say, four sorts apiece, then each > user is potentially allocating 4x that much memory. That's going to > wreak havoc on your disk buffers (which are tricky to monitor on most > systems, and impossible on some). Yes, we have effectively complicated queries. That's why we put the sort_mem so high. I'll see if we can put it lower for the next few days to see if it improves our performances. Thanks for your help. -- Guillaume From pgsql-performance-owner@postgresql.org Tue Nov 22 05:56:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A27FD7DB4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 05:56:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69385-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 09:56:43 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 6B657D6833 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 05:56:39 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 735955D39; Tue, 22 Nov 2005 10:56:41 +0100 (CET) Message-ID: <4382EB58.3020804@openwide.fr> Date: Tue, 22 Nov 2005 10:56:40 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Qingqing Zhou <zhouqq@cs.toronto.edu> CC: pgsql-performance@postgresql.org Subject: Re: weird performances problem References: <437CC21D.8070402@openwide.fr> <dlugsf$25o5$1@news.hub.org> In-Reply-To: <dlugsf$25o5$1@news.hub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/435 X-Sequence-Number: 15692 Qingqing Zhou wrote: > Someone is doing a massive *write* at this time, which makes your query > *read* quite slow. Can you find out which process is doing write? Indexes should be in memory so I don't expect a massive write to slow down the select queries. sdb is the RAID10 array dedicated to our data so the postgresql process is the only one to write on it. I'll check which write queries are running because there should really be a few updates/inserts on our db during the day. On a four days log analysis, I have the following: SELECT 403,964 INSERT 574 UPDATE 393 DELETE 26 So it's not really normal to have a massive write during the day. Thanks for your help -- Guillaume From pgsql-performance-owner@postgresql.org Tue Nov 22 08:53:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8E0CEDB00C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 08:53:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26433-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 12:53:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth07.mail.atl.earthlink.net (smtpauth07.mail.atl.earthlink.net [209.86.89.67]) by svr1.postgresql.org (Postfix) with ESMTP id 63538DB00A for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 08:53:49 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=pMhVfQxkvuym0UWtg42XkhhcOCtc6pqsdfgse4EnLbEE3ZkKf+1oCg1SA4Ob/fb2; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [71.243.20.20] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth07.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EeXeh-0005Ec-Ka; Tue, 22 Nov 2005 07:53:51 -0500 Message-Id: <6.2.5.6.0.20051122074454.040fae60@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 22 Nov 2005 07:53:46 -0500 To: Guillaume Smet <guillaume.smet@openwide.fr>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: weird performances problem In-Reply-To: <4382EB58.3020804@openwide.fr> References: <437CC21D.8070402@openwide.fr> <dlugsf$25o5$1@news.hub.org> <4382EB58.3020804@openwide.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bca2db04e142f8bedb9902a761ab5391f8350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.20.20 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/436 X-Sequence-Number: 15693 If I understand your HW config correctly, all of the pg stuff is on the same RAID 10 set? If so, give WAL its own dedicated RAID 10 set. This looks like the old problem of everything stalling while WAL is being committed to HD. This concept works for other tables as well. If you have a tables that both want services at the same time, disk arm contention will drag performance into the floor when they are on the same HW set. Profile your HD access and put tables that want to be accessed at the same time on different HD sets. Even if you have to buy more HW to do it. Ron At 04:56 AM 11/22/2005, Guillaume Smet wrote: >Qingqing Zhou wrote: >>Someone is doing a massive *write* at this time, which makes your >>query *read* quite slow. Can you find out which process is doing write? > >Indexes should be in memory so I don't expect a massive write to >slow down the select queries. sdb is the RAID10 array dedicated to >our data so the postgresql process is the only one to write on it. >I'll check which write queries are running because there should >really be a few updates/inserts on our db during the day. > >On a four days log analysis, I have the following: >SELECT 403,964 >INSERT 574 >UPDATE 393 >DELETE 26 >So it's not really normal to have a massive write during the day. > >Thanks for your help > >-- >Guillaume > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Tue Nov 22 09:29:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 56814DAFFF for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 09:29:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34544-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 13:29:35 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 7713DDAFE3 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 09:29:30 -0400 (AST) Received: from europa.cosmos.opusvl.com (europa.cosmos.opusvl.com [213.106.249.125]) by svr2.postgresql.org (Postfix) with ESMTP id 3AC91F0BA2 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 13:29:34 +0000 (GMT) Received: from localhost.localdomain ([127.0.0.1]) by europa.cosmos.opusvl.com with esmtp (Exim 4.30) id 1EeYDB-0001vy-ET; Tue, 22 Nov 2005 13:29:29 +0000 Message-ID: <43831D39.4030407@opusvl.com> Date: Tue, 22 Nov 2005 13:29:29 +0000 From: Rich Doughty <rich@opusvl.com> Organization: Opus VL User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: Re: Strange query plan invloving a view References: <437BD7A2.608@opusvl.com> <29531.1132250815@sss.pgh.pa.us> In-Reply-To: <29531.1132250815@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/437 X-Sequence-Number: 15694 Tom Lane wrote: > Rich Doughty <rich@opusvl.com> writes: > >>However, the following query (which i believe should be equivalent) > > >>SELECT * >>FROM >> tokens.ta_tokenhist h INNER JOIN >> tokens.ta_tokens t ON h.token_id = t.token_id LEFT JOIN >> tokens.ta_tokenhist i ON t.token_id = i.token_id AND >> i.status = 'issued' LEFT JOIN >> tokens.ta_tokenhist s ON t.token_id = s.token_id AND >> s.status = 'sold' LEFT JOIN >> tokens.ta_tokenhist r ON t.token_id = r.token_id AND >> r.status = 'redeemed' >>WHERE >> h.sarreport_id = 9 >>; > > > No, that's not equivalent at all, because the implicit parenthesization > is left-to-right; therefore you've injected the constraint to a few rows > of ta_tokenhist (and therefore only a few rows of ta_tokens) into the > bottom of the LEFT JOIN stack. In the other case the constraint is at > the wrong end of the join stack, and so the full view output gets formed > before anything gets thrown away. > > Some day the Postgres planner will probably be smart enough to rearrange > the join order despite the presence of outer joins ... but today is not > that day. thanks for the reply. is there any way i can achieve what i need to by using views, or should i just use a normal query? i'd prefer to use a view but i just can't get round the performance hit. -- - Rich Doughty From pgsql-performance-owner@postgresql.org Tue Nov 22 10:29:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A109CDAFD1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 10:29:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49335-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:29:42 +0000 (GMT) X-Greylist: delayed 00:06:37.484839 by SQLgrey- Received: from zeus.infor.pl (62-29-138-135.infor.pl [62.29.138.135]) by svr1.postgresql.org (Postfix) with ESMTP id B57BDDAFBD for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 10:29:36 -0400 (AST) Received: (qmail 2655 invoked by uid 0); 22 Nov 2005 14:23:01 -0000 Received: from 127.0.0.1 by zeus (envelope-from <marek.dabrowski@infor.pl>, uid 501) with qmail-scanner-1.23 (avp: 5.0.2.0. spamassassin: 2.63. Clear:RC:1(127.0.0.1):. Processed in 1.799493 secs); 22 lis 2005 14:23:01 -0000 Received: from unknown (HELO [192.168.1.7]) ([127.0.0.1]) (envelope-sender <marek.dabrowski@infor.pl>) by zeus.infor.pl (qmail-ldap-1.03) with SMTP for <pgsql-performance@postgresql.org>; 22 Nov 2005 14:22:59 -0000 Message-ID: <438329C3.9060603@infor.pl> Date: Tue, 22 Nov 2005 15:22:59 +0100 From: Marek Dabrowski <marek.dabrowski@infor.pl> User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pgsql-Performance <pgsql-performance@postgresql.org> Subject: System queue Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/440 X-Sequence-Number: 15697 Hello On my serwer Linux Fedora, HP DL360G3 with 2x3.06 GHz 4GB RAM working postgresql 7.4.6. Cpu utilization is about 40-50% but system process queue is long - about 6 task. Do you have nay sugestion/solution? Regards Marek From pgsql-performance-owner@postgresql.org Tue Nov 22 10:27:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 667F8DAFCD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 10:27:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50067-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:27:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 1329ADAFA5 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 10:27:26 -0400 (AST) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAMEQVuS028174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Nov 2005 09:26:33 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id jAMEQagR006112; Tue, 22 Nov 2005 09:26:36 -0500 (EST) Message-ID: <43832A9E.3030801@rentec.com> Date: Tue, 22 Nov 2005 09:26:38 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA7E00E.143DB%llonergan@greenplum.com> In-Reply-To: <BFA7E00E.143DB%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAMEQVuS028174 at Tue Nov 22 09:26:33 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.008 required=5 tests=[AWL=0.008] X-Spam-Score: 0.008 X-Spam-Level: X-Archive-Number: 200511/439 X-Sequence-Number: 15696 Luke, - XFS will probably generate better data rates with larger files. You really need to use the same file size as does postgresql. Why compare the speed to reading a 16G file and the speed to reading a 1G file. They won't be the same. If need be, write some code that does the test or modify lmdd to read a sequence of 1G files. Will this make a difference? You don't know until you do it. Any time you cross a couple of 2^ powers in computing, you should expect some differences. - you did umount the file system before reading the 16G file back in? Because if you didn't then your read numbers are possibly garbage. When the read began, 8G of the file was in memory. You'd be very naive to think that somehow the read of the first 8GB somehow flushed that cached data out of memory. After all, why would the kernel flush pages from file X when you're in the middle of a sequential read of...file X? I'm not sure how Linux handles this, but Solaris would've found the 8G still in memory. - What was the hardware and disk configuration on which these numbers were generated? For example, if you have a U320 controller, how did the read rate become larger than 320MB/s? - how did the results change from before? Just posting the new results is misleading given all the boasting we've had to read about your past results. - there are two results below for writing to ext2: one at 209 MB/s and one at 113MB/s. Why are they different? - what was the cpu usage during these tests? We see postgresql doing 200+MB/s of IO. You've claimed many times that the machine would be compute bound at lower IO rates, so how much idle time does the cpu still have? - You wrote: "We'll do a 16GB table size to ensure that we aren't reading from the read cache. " Do you really believe that?? You have to umount the file system before each test to ensure you're really measuring the disk IO rate. If I'm reading your results correctly, it looks like you have three results for ext and xfs, each of which is faster than the prior one. If I'm reading this correctly, then it looks like one is clearly reading from the read cache. - Gee, it's so nice of you to drop your 120MB/s observation. I guess my reading at 300MB/s wasn't convincing enough. Yeah, I think it was the cpus too... - I wouldn't focus on the flat 64% of the data rate number. It'll probably be different on other systems. I'm all for testing and testing. It seems you still cut a corner without umounting the file system first. Maybe I'm a little too old school on this, but I wouldn't spend a dime until you've done the measurements correctly. Good Luck. -- Alan Luke Lonergan wrote: > Alan, > > Looks like Postgres gets sensible scan rate scaling as the filesystem speed > increases, as shown below. I'll drop my 120MB/s observation - perhaps CPUs > got faster since I last tested this. > > The scaling looks like 64% of the I/O subsystem speed is available to the > executor - so as the I/O subsystem increases in scan rate, so does Postgres' > executor scan speed. > > So that leaves the question - why not more than 64% of the I/O scan rate? > And why is it a flat 64% as the I/O subsystem increases in speed from > 333-400MB/s? > > - Luke > > ================= Results =================== > > Unless noted otherwise all results posted are for block device readahead set > to 16M using "blockdev --setra=16384 <block_device>". All are using the > 2.6.9-11 Centos 4.1 kernel. > > For those who don't have lmdd, here is a comparison of two results on an > ext2 filesystem: > > ============================================================================ > [root@modena1 dbfast1]# time bash -c "(dd if=/dev/zero of=/dbfast1/bigfile > bs=8k count=800000 && sync)" > 800000+0 records in > 800000+0 records out > > real 0m33.057s > user 0m0.116s > sys 0m13.577s > > [root@modena1 dbfast1]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k > count=800000 sync=1 > 6553.6000 MB in 31.2957 secs, 209.4092 MB/sec > > real 0m33.032s > user 0m0.087s > sys 0m13.129s > ============================================================================ > > So lmdd with sync=1 is equivalent to a sync after a dd. > > I use 2x memory with dd for the *READ* performance testing, but let's make > sure things are synced on both write and read for this set of comparisons. > > First, let's test ext2 versus "ext3, data=ordered", versus xfs: > > ============================================================================ > 16GB write, then read > ============================================================================ > ----------------------- > ext2: > ----------------------- > [root@modena1 dbfast1]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k > count=2000000 sync=1 > 16384.0000 MB in 144.2670 secs, 113.5672 MB/sec > > [root@modena1 dbfast1]# time lmdd if=/dbfast1/bigfile of=/dev/null bs=8k > count=2000000 sync=1 > 16384.0000 MB in 49.3766 secs, 331.8170 MB/sec > > ----------------------- > ext3, data=ordered: > ----------------------- > [root@modena1 ~]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k > count=2000000 sync=1 > 16384.0000 MB in 137.1607 secs, 119.4511 MB/sec > > [root@modena1 ~]# time lmdd if=/dbfast1/bigfile of=/dev/null bs=8k > count=2000000 sync=1 > 16384.0000 MB in 48.7398 secs, 336.1527 MB/sec > > ----------------------- > xfs: > ----------------------- > [root@modena1 ~]# time lmdd if=/dev/zero of=/dbfast1/bigfile bs=8k > count=2000000 sync=1 > 16384.0000 MB in 52.6141 secs, 311.3994 MB/sec > > [root@modena1 ~]# time lmdd if=/dbfast1/bigfile of=/dev/null bs=8k > count=2000000 sync=1 > 16384.0000 MB in 40.2807 secs, 406.7453 MB/sec > ============================================================================ > > I'm liking xfs! Something about the way files are layed out, as Alan > suggested seems to dramatically improve write performance and perhaps > consequently the read also improves. There doesn't seem to be a difference > between ext3 and ext2, as expected. > > Now on to the Postgres 8 tests. We'll do a 16GB table size to ensure that > we aren't reading from the read cache. I'll write this file through > Postgres COPY to be sure that the file layout is as Postgres creates it. The > alternative would be to use COPY once, then tar/untar onto different > filesystems, but that may not duplicate the real world results. > > These tests will use Bizgres 0_8_1, which is an augmented 8.0.3. None of > the augmentations act to improve the executor I/O though, so for these > purposes it should be the same as 8.0.3. > > ============================================================================ > 26GB of DBT-3 data from the lineitem table > ============================================================================ > llonergan=# select relpages from pg_class where relname='lineitem'; > relpages > ---------- > 3159138 > (1 row) > > 3159138*8192/1000000 > 25879 Million Bytes, or 25.9GB > > ----------------------- > xfs: > ----------------------- > llonergan=# \timing > Timing is on. > llonergan=# select count(1) from lineitem; > count > ----------- > 119994608 > (1 row) > > Time: 394908.501 ms > llonergan=# select count(1) from lineitem; > count > ----------- > 119994608 > (1 row) > > Time: 99425.223 ms > llonergan=# select count(1) from lineitem; > count > ----------- > 119994608 > (1 row) > > Time: 99187.205 ms > > ----------------------- > ext2: > ----------------------- > llonergan=# select relpages from pg_class where relname='lineitem'; > relpages > ---------- > 3159138 > (1 row) > > llonergan=# \timing > Timing is on. > llonergan=# select count(1) from lineitem; > count > ----------- > 119994608 > (1 row) > > Time: 395286.475 ms > llonergan=# select count(1) from lineitem; > count > ----------- > 119994608 > (1 row) > > Time: 195756.381 ms > llonergan=# select count(1) from lineitem; > count > ----------- > 119994608 > (1 row) > > Time: 122822.090 ms > ============================================================================ > Analysis of Postgres 8.0.3 results > ============================================================================ > ext2 xfs > Write Speed 114 311 > Read Speed 332 407 > Postgres Seq Scan Speed 212 263 > Scan % of lmdd Read Speed 63.9% 64.6% > > Well - looks like we get linear scaling with disk/file subsystem speedup. > > - Luke > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Tue Nov 22 10:26:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 95371DAFCD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 10:26:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49335-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:26:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 3A868DAFA5 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 10:26:40 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 420555CEC; Tue, 22 Nov 2005 15:26:44 +0100 (CET) Message-ID: <43832AA3.6080606@openwide.fr> Date: Tue, 22 Nov 2005 15:26:43 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ron <rjpeace@earthlink.net> CC: pgsql-performance@postgresql.org Subject: Re: weird performances problem References: <437CC21D.8070402@openwide.fr> <dlugsf$25o5$1@news.hub.org> <4382EB58.3020804@openwide.fr> <6.2.5.6.0.20051122074454.040fae60@earthlink.net> In-Reply-To: <6.2.5.6.0.20051122074454.040fae60@earthlink.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/438 X-Sequence-Number: 15695 Ron wrote: > If I understand your HW config correctly, all of the pg stuff is on the > same RAID 10 set? No, the system and the WAL are on a RAID 1 array and the data on their own RAID 10 array. As I said earlier, there's only a few writes in the database so I'm not really sure the WAL can be a limitation: IIRC, it's only used for writes isn't it? Don't you think we should have some io wait if the database was waiting for the WAL? We _never_ have any io wait on this server but our CPUs are still 30-40% idle. A typical top we have on this server is: 15:22:39 up 24 days, 13:30, 2 users, load average: 3.86, 3.96, 3.99 156 processes: 153 sleeping, 3 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 50.6% 0.0% 4.7% 0.0% 0.6% 0.0% 43.8% cpu00 47.4% 0.0% 3.1% 0.3% 1.5% 0.0% 47.4% cpu01 43.7% 0.0% 3.7% 0.0% 0.5% 0.0% 51.8% cpu02 58.9% 0.0% 7.7% 0.0% 0.1% 0.0% 33.0% cpu03 52.5% 0.0% 4.1% 0.0% 0.1% 0.0% 43.0% Mem: 3857224k av, 3307416k used, 549808k free, 0k shrd, 80640k buff 2224424k actv, 482552k in_d, 49416k in_c Swap: 4281272k av, 10032k used, 4271240k free 2602424k cached As you can see, we don't swap, we have free memory, we have all our data cached (our database size is 1.5 GB). Context switch are between 10,000 and 20,000 per seconds. > This concept works for other tables as well. If you have a tables that > both want services at the same time, disk arm contention will drag > performance into the floor when they are on the same HW set. > Profile your HD access and put tables that want to be accessed at the > same time on different HD sets. Even if you have to buy more HW to do it. I use iostat and I can only see a little write activity and no read activity on both raid arrays. -- Guillaume From pgsql-performance-owner@postgresql.org Tue Nov 22 10:37:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 37A10D7E62 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 10:37:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50821-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:37:56 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 7C475DAFA6 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 10:37:49 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 686FA5D23; Tue, 22 Nov 2005 15:37:53 +0100 (CET) Message-ID: <43832D40.7020309@openwide.fr> Date: Tue, 22 Nov 2005 15:37:52 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Claus Guttesen <kometen@gmail.com> CC: Andrew Sullivan <ajs@crankycanuck.ca>, pgsql-performance@postgresql.org Subject: Re: weird performances problem References: <437CC21D.8070402@openwide.fr> <20051117221314.GC26696@phlogiston.dyndns.org> <437D13AA.4010309@openwide.fr> <b41c75520511171615g7c0fe923l@mail.gmail.com> In-Reply-To: <b41c75520511171615g7c0fe923l@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/441 X-Sequence-Number: 15698 Claus and Andrew, Claus Guttesen wrote: > Isn't sort_mem quite high? Remember that sort_mem size is allocated > for each sort, not for each connection. Mine is 4096 (4 MB). My > effective_cache_size is set to 27462. I tested sort mem from 4096 to 32768 (4096, 8192, 16384, 32768) this afternoon and 32768 is definitely the best value for us. We still have free memory using it, we don't have any swap and queries are generally faster (I log all queries taking more than 500ms and the log is growing far faster with lower values of sort_mem). > What OS are you running? # cat /etc/redhat-release CentOS release 3.6 (Final) so it's a RHEL 3 upd 6. # uname -a Linux our.host 2.4.21-37.ELsmp #1 SMP Wed Sep 28 14:05:46 EDT 2005 i686 i686 i386 GNU/Linux # cat /proc/cpuinfo 4x processor : 3 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) MP CPU 2.20GHz stepping : 6 cpu MHz : 2192.976 cache size : 512 KB # cat /proc/meminfo total: used: free: shared: buffers: cached: Mem: 3949797376 3478376448 471420928 0 83410944 2679156736 Swap: 4384022528 9797632 4374224896 MemTotal: 3857224 kB MemFree: 460372 kB MemShared: 0 kB Buffers: 81456 kB Cached: 2610764 kB HTH Regards, -- Guillaume From pgsql-performance-owner@postgresql.org Tue Nov 22 10:49:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9451CDAFCD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 10:49:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50566-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:49:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth06.mail.atl.earthlink.net (smtpauth06.mail.atl.earthlink.net [209.86.89.66]) by svr1.postgresql.org (Postfix) with ESMTP id A3E8DDA86D for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 10:49:21 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=QB/IVAHZCzsnDfOt3xlb8+yjYTfEdFwHVkBl6s7wtIAgGZPR1fH7gR4ZbJ5xGvsX; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [71.243.20.20] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth06.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EeZSW-0007yg-NV; Tue, 22 Nov 2005 09:49:24 -0500 Message-Id: <6.2.5.6.0.20051122093227.040fd900@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 22 Nov 2005 09:49:17 -0500 To: Guillaume Smet <guillaume.smet@openwide.fr>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: weird performances problem In-Reply-To: <43832AA3.6080606@openwide.fr> References: <437CC21D.8070402@openwide.fr> <dlugsf$25o5$1@news.hub.org> <4382EB58.3020804@openwide.fr> <6.2.5.6.0.20051122074454.040fae60@earthlink.net> <43832AA3.6080606@openwide.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc3363ff9f20874929048a1cebca4dcf46350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.20.20 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/442 X-Sequence-Number: 15699 At 09:26 AM 11/22/2005, Guillaume Smet wrote: >Ron wrote: >>If I understand your HW config correctly, all of the pg stuff is on >>the same RAID 10 set? > >No, the system and the WAL are on a RAID 1 array and the data on >their own RAID 10 array. As has been noted many times around here, put the WAL on its own dedicated HD's. You don't want any head movement on those HD's. >As I said earlier, there's only a few writes in the database so I'm >not really sure the WAL can be a limitation: IIRC, it's only used >for writes isn't it? When you reach a WAL checkpoint, pg commits WAL data to HD... ...and does almost nothing else until said commit is done. >Don't you think we should have some io wait if the database was >waiting for the WAL? We _never_ have any io wait on this server but >our CPUs are still 30-40% idle. _Something_ is doing long bursts of write IO on sdb and sdb1 every 30 minutes or so according to your previous posts. Profile your DBMS and find out what. >A typical top we have on this server is: > 15:22:39 up 24 days, 13:30, 2 users, load average: 3.86, 3.96, 3.99 >156 processes: 153 sleeping, 3 running, 0 zombie, 0 stopped >CPU states: cpu user nice system irq softirq iowait idle > total 50.6% 0.0% 4.7% 0.0% 0.6% 0.0% 43.8% > cpu00 47.4% 0.0% 3.1% 0.3% 1.5% 0.0% 47.4% > cpu01 43.7% 0.0% 3.7% 0.0% 0.5% 0.0% 51.8% > cpu02 58.9% 0.0% 7.7% 0.0% 0.1% 0.0% 33.0% > cpu03 52.5% 0.0% 4.1% 0.0% 0.1% 0.0% 43.0% >Mem: 3857224k av, 3307416k used, 549808k free, 0k shrd, 80640k buff > 2224424k actv, 482552k in_d, 49416k in_c >Swap: 4281272k av, 10032k used, 4271240k >free 2602424k cached > >As you can see, we don't swap, we have free memory, we have all our >data cached (our database size is 1.5 GB). > >Context switch are between 10,000 and 20,000 per seconds. That's actually a reasonably high CS rate. Again, why? >>This concept works for other tables as well. If you have tables >>that both want services at the same time, disk arm contention will >>drag performance into the floor when they are on the same HW set. >>Profile your HD access and put tables that want to be accessed at >>the same time on different HD sets. Even if you have to buy more HW to do it. > >I use iostat and I can only see a little write activity and no read >activity on both raid arrays. Remember it's not just the overall amount, it's _when_and _where_ the write activity takes place. If you have almost no write activity, but whenever it happens it all happens to the same place by multiple things contending for the same HDs, your performance during that time will be poor. Since the behavior you are describing fits that cause very well, I'd see if you can verify that's what's going on. Ron From pgsql-performance-owner@postgresql.org Tue Nov 22 11:26:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6161EDAFFF for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 11:26:16 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62230-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 15:26:19 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 8C28ADAFE3 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 11:26:13 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 63E965D2E; Tue, 22 Nov 2005 16:26:18 +0100 (CET) Message-ID: <43833899.5080408@openwide.fr> Date: Tue, 22 Nov 2005 16:26:17 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ron <rjpeace@earthlink.net> CC: pgsql-performance@postgresql.org Subject: Re: weird performances problem References: <437CC21D.8070402@openwide.fr> <dlugsf$25o5$1@news.hub.org> <4382EB58.3020804@openwide.fr> <6.2.5.6.0.20051122074454.040fae60@earthlink.net> <43832AA3.6080606@openwide.fr> <6.2.5.6.0.20051122093227.040fd900@earthlink.net> In-Reply-To: <6.2.5.6.0.20051122093227.040fd900@earthlink.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/443 X-Sequence-Number: 15700 Ron, First of all, thanks for your time. > As has been noted many times around here, put the WAL on its own > dedicated HD's. You don't want any head movement on those HD's. Yep, I know that. That's just we supposed it was not so important if it was nearly a readonly database which is wrong according to you. > _Something_ is doing long bursts of write IO on sdb and sdb1 every 30 > minutes or so according to your previous posts. It's not every 30 minutes. It's a 20-30 minutes slow down 3-4 times a day when we have a high load. Anyway apart from this problem which is temporary, we have cpu idle all the day when we don't have any io wait (and nearly no write) and the server is enough loaded to use all the 4 cpus. I don't think it's normal. It's not a very good idea but do you think we can put fsync to off during a few minutes to check if the WAL is effectively our problem? A simple reload of the configuration seems to take it into account. So can we disable it temporarily even when the database is running? If it is the case, I think we'll test it and if it solved our problem, we'll ask our customer to buy two new disks to have a specific RAID 1 array for the pg_xlog. > That's actually a reasonably high CS rate. Again, why? I'm not so surprised considering what I read before about Xeon multiprocessors, pg 7.4 and the famous context switch storm. We are planning a migration to 8.1 to (hopefully) solve this problem. Perhaps our problem is due to that high CS rate. -- Guillaume From pgsql-performance-owner@postgresql.org Tue Nov 22 12:50:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53701D9422 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 12:50:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76200-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 16:50:36 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 06CE7D86C2 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 12:50:34 -0400 (AST) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id jAMGoNEL014106; Tue, 22 Nov 2005 10:50:23 -0600 Date: Tue, 22 Nov 2005 10:51:00 -0600 From: Frank Wiles <frank@wiles.org> To: Marek Dabrowski <marek.dabrowski@infor.pl> Cc: pgsql-performance@postgresql.org Subject: Re: System queue Message-Id: <20051122105100.57e8b60d.frank@wiles.org> In-Reply-To: <438329C3.9060603@infor.pl> References: <438329C3.9060603@infor.pl> X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.6.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/444 X-Sequence-Number: 15701 On Tue, 22 Nov 2005 15:22:59 +0100 Marek Dabrowski <marek.dabrowski@infor.pl> wrote: > Hello > > On my serwer Linux Fedora, HP DL360G3 with 2x3.06 GHz 4GB RAM working > postgresql 7.4.6. Cpu utilization is about 40-50% but system process > queue is long - about 6 task. Do you have nay sugestion/solution? We're going to need a lot more information than that to diagnose what is going on. Do you have any functions or queries that will need to use a large amount of CPU? In general I would suggest upgrading to the latest Fedora and moving to PostgreSQL 8.x. Doing this will get you some extra performance, but will probably not entirely solve your problem. --------------------------------- Frank Wiles <frank@wiles.org> http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Tue Nov 22 13:00:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B533DD9566 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 13:00:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77523-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 17:00:05 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 30EE3D86C2 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 13:00:04 -0400 (AST) Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by svr2.postgresql.org (Postfix) with ESMTP id 221CFF0B3E for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 17:00:02 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5EF86.291240F5" Subject: High context switches occurring Date: Tue, 22 Nov 2005 11:59:54 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E73@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: High context switches occurring Thread-Index: AcXvhij/yG5JlLcwS8iN+UVyKbhXtA== From: "Anjan Dave" <adave@vantage.com> To: <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.48 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.48 X-Spam-Level: X-Archive-Number: 200511/445 X-Sequence-Number: 15702 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5EF86.291240F5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 One of our PG server is experiencing extreme slowness and there are hundreds of SELECTS building up. I am not sure if heavy context switching is the cause of this or something else is causing it. =20 Is this pretty much the final word on this issue? http://archives.postgresql.org/pgsql-performance/2004-04/msg00249.php =20 procs memory swap io system cpu r b swpd free buff cache si so bi bo in cs us sy id wa 2 0 20 2860544 124816 8042544 0 0 0 0 0 0 0 0 0 0 2 0 20 2860376 124816 8042552 0 0 0 24 157 115322 13 10 76 0 3 0 20 2860364 124840 8042540 0 0 0 228 172 120003 12 10 77 0 2 0 20 2860364 124840 8042540 0 0 0 20 158 118816 15 10 75 0 2 0 20 2860080 124840 8042540 0 0 0 10 152 117858 12 11 77 0 1 0 20 2860080 124848 8042572 0 0 0 210 202 114724 14 10 76 0 2 0 20 2860080 124848 8042572 0 0 0 20 169 114843 13 10 77 0 3 0 20 2859908 124860 8042576 0 0 0 188 180 115134 14 11 75 0 3 0 20 2859848 124860 8042576 0 0 0 20 173 113470 13 10 77 0 2 0 20 2859836 124860 8042576 0 0 0 10 157 112839 14 11 75 0 =20 The system seems to be fine on iowait/memory side, except the CPU being busy with the CS. Here's the top output: =20 11:54:57 up 59 days, 14:11, 2 users, load average: 1.13, 1.66, 1.52 282 processes: 281 sleeping, 1 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 13.8% 0.0% 9.7% 0.0% 0.0% 0.0% 76.2% cpu00 12.3% 0.0% 10.5% 0.0% 0.0% 0.1% 76.8% cpu01 12.1% 0.0% 6.1% 0.0% 0.0% 0.1% 81.5% cpu02 10.9% 0.0% 9.1% 0.0% 0.0% 0.0% 79.9% cpu03 19.4% 0.0% 14.9% 0.0% 0.0% 0.0% 65.6% cpu04 13.9% 0.0% 11.1% 0.0% 0.0% 0.0% 74.9% cpu05 14.9% 0.0% 9.1% 0.0% 0.0% 0.0% 75.9% cpu06 12.9% 0.0% 8.9% 0.0% 0.0% 0.0% 78.1% cpu07 14.3% 0.0% 8.1% 0.0% 0.1% 0.0% 77.3% Mem: 12081720k av, 9273304k used, 2808416k free, 0k shrd, 126048k buff 4686808k actv, 3211872k in_d, 170240k in_c Swap: 4096532k av, 20k used, 4096512k free 8044072k cached =20 =20 PostgreSQL 7.4.7 on i686-redhat-linux-gnu Red Hat Enterprise Linux AS release 3 (Taroon Update 5) Linux vl-pe6650-004 2.4.21-32.0.1.ELsmp =20 This is a Dell Quad XEON. Hyperthreading is turned on, and I am planning to turn it off as soon as I get a chance to bring it down. =20 WAL is on separate drives from the OS and database. =20 Appreciate any inputs please.... =20 Thanks, Anjan =20 =20 ------_=_NextPart_001_01C5EF86.291240F5 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> </head> <body lang=3DEN-US link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Hi,<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>One of our PG server is experiencing extreme slowness = and there are hundreds of SELECTS building up. I am not sure if heavy = context switching is the cause of this or something else is causing = it.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Is this pretty much the final word on this = issue?<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><a href=3D"http://archives.postgresql.org/pgsql-performance/2004-04/msg00249= .php">http://archives.postgresql.org/pgsql-performance/2004-04/msg00249.p= hp</a><o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>procs        &= nbsp;           &n= bsp; memory      swap          io     system         = cpu<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> r  b   swpd   free   buff  cache  =             s= i   so   bi    bo   in    = cs       us sy id wa<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 2  0     20 2860544 = 124816 8042544    0    0     0     0    0     = 0  0  0  0  0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 2  0     20 2860376 = 124816 8042552    0    0     0    24  157 115322 13 10 76  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 3  0     20 2860364 = 124840 8042540    0    0     0   228  172 120003 12 10 77  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 2  0     20 2860364 = 124840 8042540    0    0     0    20  158 118816 15 10 75  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 2  0     20 2860080 = 124840 8042540    0    0     0    10  152 117858 12 11 77  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 1  0     20 2860080 = 124848 8042572    0    0     0   210  202 114724 14 10 76  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 2  0     20 2860080 = 124848 8042572    0    0     0    20  169 114843 13 10 77  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 3  0     20 2859908 = 124860 8042576    0    0     0   188  180 115134 14 11 75  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 3  0     20 2859848 = 124860 8042576    0    0     0    20  173 113470 13 10 77  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> 2  0     20 2859836 = 124860 8042576    0    0     0    10  157 112839 14 11 75  = 0<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>The system seems to be fine on iowait/memory side, = except the CPU being busy with the CS. Here’s the top = output:<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>11:54:57  up 59 days, 14:11,  2 = users,  load average: 1.13, 1.66, 1.52<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>282 processes: 281 sleeping, 1 running, 0 zombie, 0 = stopped<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   total   13.8%    0.0%    = 9.7%   0.0%     0.0%    0.0%   = 76.2%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu00   12.3%    0.0%   = 10.5%   0.0%     0.0%    0.1%   = 76.8%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu01   12.1%    0.0%    6.1%   0.0%     0.0%    0.1%   81.5%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu02   10.9%    0.0%    9.1%   0.0%     0.0%    0.0%   79.9%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>    =        cpu03   19.4%    0.0%   14.9%   0.0%     0.0%    0.0%   = 65.6%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu04   13.9%    0.0%   = 11.1%   0.0%     0.0%    0.0%   = 74.9%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu05   14.9%    0.0%    9.1%   0.0%     0.0%    0.0%   75.9%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu06   12.9%    0.0%    8.9% =   0.0%     0.0%    0.0%   = 78.1%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =   cpu07   14.3%    0.0%    8.1%   0.0%     0.1%    0.0%   77.3%<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Mem:  12081720k av, 9273304k used, 2808416k free,       0k shrd,  126048k = buff<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>         =           4686808k actv, 3211872k in_d,  170240k = in_c<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Swap: 4096532k av,      20k = used, 4096512k free           &nb= sp;     8044072k cached<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>PostgreSQL 7.4.7 on = i686-redhat-linux-gnu<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Red Hat Enterprise Linux AS release 3 (Taroon Update = 5)<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Linux vl-pe6650-004 = 2.4.21-32.0.1.ELsmp<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>This is a Dell Quad XEON. Hyperthreading is turned = on, and I am planning to turn it off as soon as I get a chance to bring it = down.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>WAL is on separate drives from the OS and = database.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Appreciate any inputs = please….<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Thanks,<br> Anjan<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> </div> </body> </html> ------_=_NextPart_001_01C5EF86.291240F5-- From pgsql-performance-owner@postgresql.org Tue Nov 22 13:15:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F607DB081 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 13:15:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79451-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 17:14:58 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id B6303DB080 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 13:14:56 -0400 (AST) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id D67FAB80D for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 12:14:55 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E73@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E73@vt-pe2550-001.vantage.vantage.com> Content-Type: multipart/alternative; boundary=Apple-Mail-2--246327675 Message-Id: <0D46FCC7-9DB2-4B45-B7C3-4F76EF53DB1F@khera.org> From: Vivek Khera <vivek@khera.org> Subject: Re: High context switches occurring Date: Tue, 22 Nov 2005 12:14:54 -0500 To: Postgresql Performance <pgsql-performance@postgresql.org> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.129 required=5 tests=[AWL=-0.128, HTML_FONT_BIG=0.256, HTML_MESSAGE=0.001] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200511/446 X-Sequence-Number: 15703 --Apple-Mail-2--246327675 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Nov 22, 2005, at 11:59 AM, Anjan Dave wrote: > This is a Dell Quad XEON. Hyperthreading is turned on, and I am > planning to turn it off as soon as I get a chance to bring it down. > You should probably also upgrade to Pg 8.0 or newer since it is a known problem with XEON processors and older postgres versions. Upgrading Pg may solve your problem or it may not. It is just a fluke with XEON processors... --Apple-Mail-2--246327675 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 <HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; = -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Nov 22, 2005, = at 11:59 AM, Anjan Dave wrote:<FONT size=3D"2" face=3D"Arial"><SPAN = style=3D"font-size:10.0pt; font-family:Arial; font-size: 13.3333px; = "><O:P style=3D"font-family: Arial; font-size: 13.3333px; "><SPAN = class=3D"Apple-style-span" style=3D"font-family: Arial; font-size: = 13.3333px; ">=A0</SPAN></O:P></SPAN></FONT></DIV><BLOCKQUOTE = type=3D"cite"><SPAN class=3D"Apple-style-span" style=3D"border-collapse: = separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: = Georgia; font-size: 14px; font-style: normal; font-variant: normal; = font-weight: normal; letter-spacing: normal; line-height: normal; = text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: = 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; = white-space: normal; widows: 2; word-spacing: 0px; "><P = class=3D"MsoNormal"><FONT size=3D"2" face=3D"Arial"><SPAN = style=3D"font-size:10.0pt; font-family:Arial; font-size: 13.3333px; = "><SPAN class=3D"Apple-style-span" style=3D"font-family: Arial; = font-size: 13.3333px; ">This is a Dell Quad XEON. Hyperthreading is = turned on, and I am planning to turn it off as soon as I get a chance to = bring it down.</SPAN></SPAN></FONT></P><P class=3D"MsoNormal"><FONT = class=3D"Apple-style-span" face=3D"Arial" size=3D"4"><SPAN = class=3D"Apple-style-span" style=3D"font-size: = 13.3333px;"></SPAN></FONT></P></SPAN></BLOCKQUOTE><BR></DIV><DIV>You = should probably also upgrade to Pg 8.0 or newer since it is a known = problem with XEON processors and older postgres versions.=A0 Upgrading = Pg may solve your problem or it may not.=A0 It is just a fluke with XEON = processors...</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><FONT = class=3D"Apple-style-span" face=3D"Arial" size=3D"4"><SPAN = class=3D"Apple-style-span" style=3D"font-size: = 13.3333px;"><BR></SPAN></FONT></BODY></HTML>= --Apple-Mail-2--246327675-- From pgsql-performance-owner@postgresql.org Tue Nov 22 13:20:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A1BE4D99B8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 13:20:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79236-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 17:20:08 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth08.mail.atl.earthlink.net (smtpauth08.mail.atl.earthlink.net [209.86.89.68]) by svr1.postgresql.org (Postfix) with ESMTP id 891ADD9566 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 13:20:07 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=lePpJKcWBLv8h7SAVMmS2MCzMtfIQH19xpQcm6snSxC3ehVx5fu7sBh8AE32+eBk; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [71.243.20.20] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth08.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EeboI-0000pv-Sn; Tue, 22 Nov 2005 12:20:03 -0500 Message-Id: <6.2.5.6.0.20051122120225.040f8658@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Tue, 22 Nov 2005 12:19:57 -0500 To: Guillaume Smet <guillaume.smet@openwide.fr>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: weird performances problem In-Reply-To: <43833899.5080408@openwide.fr> References: <437CC21D.8070402@openwide.fr> <dlugsf$25o5$1@news.hub.org> <4382EB58.3020804@openwide.fr> <6.2.5.6.0.20051122074454.040fae60@earthlink.net> <43832AA3.6080606@openwide.fr> <6.2.5.6.0.20051122093227.040fd900@earthlink.net> <43833899.5080408@openwide.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc434ee0091acf86fe28fe76da498402b6350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.20.20 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/447 X-Sequence-Number: 15704 At 10:26 AM 11/22/2005, Guillaume Smet wrote: >Ron, > >First of all, thanks for your time. Happy to help. >>As has been noted many times around here, put the WAL on its own >>dedicated HD's. You don't want any head movement on those HD's. > >Yep, I know that. That's just we supposed it was not so important if >it was nearly a readonly database which is wrong according to you. It's just good practice with pg that pg-xlog should always get it's own dedicated HD set. OTOH, I'm not at all convinced given the scant evidence so far that it is the primary problem here; particularly since if I understand you correctly, px-xlog is not on sdb or sdb1 where you are having the write storm. >>_Something_ is doing long bursts of write IO on sdb and sdb1 every >>30 minutes or so according to your previous posts. > >It's not every 30 minutes. It's a 20-30 minutes slow down 3-4 times >a day when we have a high load. Thanks for the correction and I apologize for the misunderstanding. Clearly the first step is to instrument sdb and sdb1 so that you understand exactly what is being accessed and written on them. Possibilities that come to mind: a) Are some of your sorts requiring more than 32MB during high load? If sorts do not usually require HD temp files and suddenly do, you could get behavior like yours. b) Are you doing too many 32MB sorts during high load? Same comment as above. c) Are you doing some sort of data updates or appends during high load that do not normally occur? d) Are you constantly doing "a little" write IO that turns into a write storm under high load because of queuing issues? Put the scaffolding in needed to trace _exactly_ what's happening on sdb and sdb1 throughout the day and then examine the traces over a day, a few days, and a week. I'll bet you will notice some patterns that will be helpful in identifying what's going on. Ron From pgsql-performance-owner@postgresql.org Tue Nov 22 13:34:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2F928DAFBD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 13:34:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81478-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 17:34:43 +0000 (GMT) X-Greylist: delayed 00:06:36.58847 by SQLgrey- Received: from jefftrout.com (pool-71-248-161-64.bstnma.fios.verizon.net [71.248.161.64]) by svr1.postgresql.org (Postfix) with SMTP id A6F11D99B8 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 13:34:41 -0400 (AST) Received: (qmail 23962 invoked from network); 22 Nov 2005 17:28:38 -0000 Received: from pool-71-248-161-64.bstnma.fios.verizon.net (HELO ?10.10.10.105?) (71.248.161.64) by 192.168.0.101 with SMTP; 22 Nov 2005 17:28:38 -0000 In-Reply-To: <438329C3.9060603@infor.pl> References: <438329C3.9060603@infor.pl> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <E09D46F0-6DFC-4410-A00D-CA5301A88CF3@torgo.978.org> Cc: Pgsql-Performance <pgsql-performance@postgresql.org> Content-Transfer-Encoding: 7bit From: Jeff Trout <threshar@torgo.978.org> Subject: Re: System queue Date: Tue, 22 Nov 2005 12:28:00 -0500 To: Marek Dabrowski <marek.dabrowski@infor.pl> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/448 X-Sequence-Number: 15705 On Nov 22, 2005, at 9:22 AM, Marek Dabrowski wrote: > Hello > > On my serwer Linux Fedora, HP DL360G3 with 2x3.06 GHz 4GB RAM > working postgresql 7.4.6. Cpu utilization is about 40-50% but > system process queue is long - about 6 task. Do you have nay > sugestion/solution?\ High run queue (loadavg) with low cpu usage means you are IO bound. Either change some queries around to generate less IO, or add more disks. -- Jeff Trout <jeff@jefftrout.com> http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Tue Nov 22 13:35:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 374BFDB08A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 13:35:53 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80862-08-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 17:35:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 59C41DB09D for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 13:35:50 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAMHZnCB012639; Tue, 22 Nov 2005 12:35:49 -0500 (EST) To: Vivek Khera <vivek@khera.org> cc: Postgresql Performance <pgsql-performance@postgresql.org>, "Anjan Dave" <adave@vantage.com> Subject: Re: High context switches occurring In-reply-to: <0D46FCC7-9DB2-4B45-B7C3-4F76EF53DB1F@khera.org> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E73@vt-pe2550-001.vantage.vantage.com> <0D46FCC7-9DB2-4B45-B7C3-4F76EF53DB1F@khera.org> Comments: In-reply-to Vivek Khera <vivek@khera.org> message dated "Tue, 22 Nov 2005 12:14:54 -0500" Date: Tue, 22 Nov 2005 12:35:49 -0500 Message-ID: <12638.1132680949@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200511/449 X-Sequence-Number: 15706 Vivek Khera <vivek@khera.org> writes: > On Nov 22, 2005, at 11:59 AM, Anjan Dave wrote: >> This is a Dell Quad XEON. Hyperthreading is turned on, and I am >> planning to turn it off as soon as I get a chance to bring it down. > You should probably also upgrade to Pg 8.0 or newer since it is a > known problem with XEON processors and older postgres versions. > Upgrading Pg may solve your problem or it may not. PG 8.1 is the first release that has a reasonable probability of avoiding heavy contention for the buffer manager lock when there are multiple CPUs. If you're going to update to try to fix this, you need to go straight to 8.1. I've recently been chasing a report from Rob Creager that seems to indicate contention on SubTransControlLock, so the slru code is likely to be our next bottleneck to fix :-( regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 22 14:29:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C69ADB0B1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:29:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95514-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 18:29:43 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from europa.telenet-ops.be (europa.telenet-ops.be [195.130.137.75]) by svr1.postgresql.org (Postfix) with ESMTP id 5C8DFDB0C6 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 14:29:39 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by europa.telenet-ops.be (Postfix) with SMTP id F2A803817B for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 19:29:37 +0100 (CET) Received: from [10.0.1.2] (d5152B3BA.access.telenet.be [81.82.179.186]) by europa.telenet-ops.be (Postfix) with ESMTP id A33AC38186 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 19:29:37 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v623) To: pgsql-performance@postgresql.org Message-Id: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-210--241845262 From: Yves Vindevogel <yves.vindevogel@implements.be> Subject: Stored Procedure Date: Tue, 22 Nov 2005 19:29:37 +0100 X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.823 required=5 tests=[RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 1.823 X-Spam-Level: * X-Archive-Number: 200511/450 X-Sequence-Number: 15707 --Apple-Mail-210--241845262 Content-Type: multipart/alternative; boundary=Apple-Mail-211--241845262 --Apple-Mail-211--241845262 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Is there another way in PG to return a recordset from a function than=20 to declare a type first ? create function fnTest () returns setof=20 myDefinedTypeIDontWantToDefineFirst ... Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-211--241845262 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Is there another way in PG to return a recordset from a function than to declare a type first ? create function fnTest () returns setof myDefinedTypeIDontWantToDefineFirst ... Met vriendelijke groeten, Bien =E0 vous, Kind regards, <bold>Yves Vindevogel</bold> <bold>Implements</bold> <smaller> </smaller>= --Apple-Mail-211--241845262-- --Apple-Mail-210--241845262 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM8LAAMjhhuR5ir4ULjigT5pn+P5co2T6pn+YBup6dp6xoh6kHie95modNOFkah0H+Qhd pyKBNmcf68r2Bo9GGtdpwIAUotM1Q4QMNzUDZhuVZbLsvy7KkqZZCnAb4AFcQY1C3LW1Wb5lOa2t ZvUt78NNjcMN83wEOMDczvuTzXNQ3QEN01WRL2b8XBYEDuugQEFUYgkpIo5FjIJTmhfZkHG8J0nm fB/sifp/EQYLBioUKsBkRKVgWPLX7stA4VnaDa+tZlZel0j+gCMpWS8MRULQNeIDY/4zTIAIyFX0 GFybZnr+rZ8p2a1s6tUNfADXXI1Yb8jLX+MNQk+1Az7zWqwVa/FaJrHpvSLeAQOhdE/l7CSJwrAb BXDXH+PkyA/gUiPGaftASWW6JeDgnGAsCmLNvcYqlz5+FchnZMrqGbeE3JoYhAMAKbEvOGeigtaE CDZwJcgxtiML0uMgQYzllKt2GhtP/EaH6cgAm+fnCtVEVXFOKNU54AC1B/tyLfBx4YJBGwhAAG5m yUoGH/TgxlZ7nGXw3YdEpYTPWOvaSq/JVEX28rEDQsGKDoGPx+QYnE1URg2paZY4dy7EHTx9cc41 upqIfwkjSgJWyW0MgBdK9I1DGAAwnS8G8+4cGYyUWWbKMg/gSiOjQG+FMQ44qqlmgBNUSYYMohKW 2ULFZaR8NdMFucoz/w/ZcAAMzgH+j/AKGV8QAZkhmWNM0AJ/I5zCiJEGYjF1qoGmxI5MqwT7JVlG buLULJhPXlbK+WMt3HwHmIbF8xaA0n6mvPgN7EJhx9Vcax+hsX6wGZuldNDnTSgQDoloGohS6BYE 62gPQqyRhlFE2gIYkCRgdD4WcAUsnxvlYklKgUCn4upi29JkkpG/pbYgtKbr86TLOnbLCF066ZLP kGsI+7NY9rRjZHB+0ew4M5S0AKT4FA8l0BaIUk4XHkj/EYLwzAtVyj/GwRYf49B8D6H+OMdw9R/j DG8vcTgx1xhpFTBoHYilRgaDygQAobXCynVVSSVdRYTLJls5CcIaqX0zpw/Kms76c2DSnTsNNPaA TbpggqOSCg4MkQwcAPiBAzimJqI4Xg3R/itX0P8bY66xD7MiYkgg5h4vAF2NgdY/xNGCH+HQVMIQ WiCNVM2L6Ap4s3ShFixMubA2HnjcUulhab3GuIbGxVjLlxXZoawMKFgsCiaSOUd6nB6XbH+PofKN LtqcH7eMf5AyimQOtegf4/TIEFvYP8dyjTm2eV1KdmNgrlIKr/cOxF+LjmRldTZY88L/U6P/YtyF +b82PDAhkOQsyNkHu8jS76NB4YXH+PvDUG7v3lIFeu8mFbuj6q8PXE2HEaXqIEUEgxnh2T2YhD/B WBZcUunVjO59yMB3PsHc3BONLemxwaP8NwsTMEPvVeMieJKvXmHZk8f48h5GHyYP8e+V3g3tvMQs VY01FLCxjgTHk8b943yBTOVoJEiXJzPgae1zr+2HwYhnIuRzrjczwP8eY8zDmKy7l8NOYcx40zKW nNswizytg+kXHc/qS48x9o7QbNMhZ0yMdvPBG7wmNz/jB6WYs436uFmbHhbFrAFgjhl4Y/g5IvH+ 0EkYFw+NuAHqmoet9bWJwPnDHEfM55E0udjTNW7uZ+y9p6L+oNe3Bxtoa4lACzgQee2kQ5Jwo1RK QPQfK8xejaJ6FG6w/wEh1NZJ+L6ydoH+zfqTUK0dK7AzsY7Yem9jaA0Fu2wVf9eJObqW+TxuwbCS K4JEYVnh2O/vWQM5K+wtCehCCAP5YABybV035xCAJIJqnrTyFqB9H8e1Lu/OumM870MTp3MGn9J8 g5Zsxhk2ZURLfGmrBAEg5m/CISIf4jRekblaCgRoyS0BjWNZVw6uZ70hnsrkND/Fbn3kWWtmz1ID a5NxyLYJ1xujdI3iZTm9dkYy4/P9yFKIcFoDQsbtKW4nT2YbLrpr450V6zTGem7N+YzXVzDZ0PSl ddIb8GQVrlD9sQjy4FKHVy0ZDDeLHCPWuuD/68Y0Vg1LX8c0bQSBiAq9JrVv2pYwZkzq6mqxDi8y XJgBkjZGftMMdUgm5PKyCBnogBI72hYgZlgrD6WWgMzPZkxGdUzfIfIzsdb66PXr/Jxp+XwRGlOL GnuJm2b0l7vo/dJeDL4N7qwWN+qn5CqedNMATuzZmObaad1s4dBMl/6wmG/Pt1+oAAYk2hToiuQc 5FxyjyRoHqH0xYKE+Q8k+UIgH0KAH+HSHqXmGwHSIuEGF0I25eWE8A96/g2akwhIk8Puf25mpi3w /IeG/M8y0O10/WgM3cpUS8l0mS+ocOYgDQS0ASDUTOB6EaJWDkXyXwFyL+GqGkPKHQHMOkxIXmIO HAHAJyyuKgvGIIHgU2H+G0GuHKH+FwF6KwEAtAH+CUEcLOAiNC2QnKcOZSZCmO9ongNep2sA3Y2W nY/KwE9hDazc8w8Sug9mh6cAZ0/UAEC0FKH+AOCOEoJQBeD8H+A2A+DYYGBuD2H+D6DmFCH+F0Fq hDB+PKGcGaaSGsGmJyGOGGg0EuEgP0CqCOEOH+BIA+DQH+AgBSDrD+CAEcH+AICwFNA+pamupfDQ /G1E2asfDksJDesNBCv012x+5WDmQSseeiAaCGEiH+BEAmC0H+A8AcCyH+A4AXGqAqAOCsLqAQCw H+BMAuDIH+CJEWPMCpFKCaCEEASEBFESA2AaC2H+AoAOCqK6AVGqA8AYCvGcAiC9HmBlHZBglBDt F80LF7BNDdBHDg2U0JGI0lGEseWsAgB6EYH+BUAkC4H+BKAuDDGcArH+BCAnH+A8AeC6K7HjG7H4 AoANHtG1G4A1GxGkAfHkBAAjJOBCAqC/FMAuDAH+BOApJ8A0BYDy2aWtGEzI1G2dKRIUwDGDF9BP DooBISnVImB9IsBRJHI2AuDHK3HHI4DFK3K6BGArI8BAAlJ8A8AhJqAlJxJBK3LDLBK9LmBNKCH+ AwBZEZIGcjGM3zKVIRL7BEH8zVKfKojrKlMCQVIk2jKuH/KzH/I5K7MjLFMpMnI5HGBIAvG/I5J9 MvMrK5M/K7LrJ9LxL1DXL5KYp1L/MM80g2wABMzWAGjVDZIc/XDrIiNjKtKxK1MtNBN7MlN9HFJ5 M3J7NDONMnNHLvLzKNKnMS5dNPMAsGpgLKLoAQNswAH8EAGAXGB0EobQAwEEJOblOa1uzJIfNvF9 MXFVMbMfOPODOBOBMxM1K3M7PfPdNFLtNLOZOcfjIOgVPIfeAaD2VGBUEY6ECyFQL+awXWH+HCHa KgW+KoAqDsPu3Mt8rxMO+fOjPTNzMZN3MhPtN/M/PlOJPrPhPvHBPzOXL3KPKhP69Mv4SmYWWs4m QyDGFUGsH+GeHEOkHW204SIED6FmaSBqeZHmQ3Fikw7iPwZWkCSs40Yg0CwTQAxpPUAhPZN5RDS1 PjOHPpRRRFOTP1RZSo5W1skw6MDa6g5omYZW94AYDkN+BOD+NKCoE6SKHy1WA8EOL2Z8cuhGTU/f SlArAu95L2cmiO1xSrQ7PXQ/S/S1RJS9RFUlNBTDRXNPRavw3St25kTXBiQsADBfUFNO/fUC6K+A N+9fTI2SkOfG6YmY9MZWDEFS+0TInFUQSfPI1NQ9MdSzRPUnS5MzRLUdRPUqD02RRaeoseDdSaQn ScQi9G/kPu+e/o+E8UQUoGv/IXMKsOfqZu8O/eV2S89E7QZ7XG8w/edGQYxiTeoSB3FKBQAlRBV9 S3LnWDUjXpN7LCBOAnJ8AyBXKKV0Z7KPKO6i764rXI9wS8DJVq6TAw+hP5MFBJDi0Ofq0i86mQPv XMDRWlBi6QVy6iAYCUEuJIBDESBGA0DNI2AxLjRCAxS4BGAvH5I5J2BLZdZVV9ZtZqDKJIA+DUH+ AiB4ES2a4pDFDE+fVIkg84ZylyTUn7RdYjIZYhQy14fipY9SDTWhSjRg6UAEC+fZGWEfEMBCDbFM AtJ9MzI9LlM8BFZjJ5ZpNBMzLCBJLKH+A+A3ZSAiByEMmcC0FO7Q7eTVSW+ectBY9HQ2oFDTNXak Ns9fIa0hPPVUfqfq5i3OjohIAEC6fYAWB6ERFUBSDxLuAtZSA7JSA/JoH/LPH+BIAtK7bZG4BGAt JCApH+A+AhJPGnJOA0AfH+AiBIDoWuBzc6AICvD8PxUAWJWWj2sfWwsPP9cXWzKc/PGE0jPQvwiE 9kWsAeB+EVI2AaCpdQAbGjGnHkA4AbJPHhI0A2AZI0A6AdI1drG+A6AfG/HhGjfVI1fLfJGpfBGq BGAZHsAvKJA+j7eZencVNSlZGBelINchalStIqbTV7J5I8BDLtdrJPfLfSAZHkA2AXfPfXENJTfl JrK0BFdjMoBOArX7UsYhUxaledgRcZgVBLMTepVU17StSxXlMrZzbgAtLDgrdoAlGiBBK1dhZZLi AxK/OFORRVNNhbhu0PhhafgTW1gXilgbgRhzUbV/OOAwDPFMAxe/ZrPriXXnWJidP3hiuZgPiphk eGA8EUJGWEc3MNhtgdUXSvi5XxS1Z3Zhe/MzbfjNRRUrieVpeejtOg0OseDeNYQexAIEE4GcX2B4 EkRKAMDsNjXSTWcVVVjvi1jzh1WHM/j8AvkAAvkFlHkLjVjdjZF4pPk0nANKLKQIBCESL2D6F6XG XgvWqwHQMqEsGIRaL6RSAgD6bcQAbyNRBkLQDCWNhdNxkPj1V5h3i7N7lLlPlTmtUpjTTHak1tUE DHDyQMDWN+ggQIByEiJOEGOcGIG8Okq7CMXay2KMG8HaU4rcMGCIE8aSBcEWL2Ci4ccggbKXhxlD j3jPPdmxbdLnm3PxNJhZkO1CseseDUNKBIEMJWB8EqhCBqEuGgH+DiFiL+GXQcINAEIhl4McIkXc IICurWWuDulCNiDW85VVi3mplHmuH/j/oZM9odRTohkNNQnjYIc6QIAILmH+BgEOLOtabCUcIPpV qiIOHMKeOQGoJ6C+FaMwAuEJT474DYTfliJQrbgjmrj5OBoXkDobrTJ/LsArX+LQDI72nBlkJQLv C2FBpAEoGOMGGhqsvKH7nlqpqlnpsKKMHgJ+tgGQPKCmFIaSAwD8LOA4EGJWBiCdEFH1G/iPp0Av rXlRrboTdXLDdrI0BSBkD4H/n8JOAkD7o0EwhCECF+PKG6HceBsQRtsPtyOuq4/+22RcFYJGBkBK Ddp4AtI8A2AdHkA/H9uPZZrVp5lNp9OFMzK7iLJ9HhHlgrJ8BSA3FSEWECe+vNsVnkXdt4MVqnvR qiHmHkKgF+F0JqEMD8fECQB4D7uPI8AyAZGjubJ8BAAqClbqAng4AbfZdsKyBTuMDiDOE2H+FmFe JGHMU1vXwrvVwrwxCKagF3pADyDiFEH+CWCAEHJ+A3G4B+BmDmH+DQC7EEFGE4NKHYHUXvwxxqIj t3xtxyIaw0ImGwGus8HgUZx1yGavxxyJyPyRySKIKQFuFibQGOGEYFyVynypymKQCaB/xIDkDOE8 IQFSFEVGE+EsQIIWGEF4L+EwEeP6IOE4EoN2DOC0ErpCDLy6DYDAEyH+FiFU6EHyq6H+DqDUFAH+ G4GwOWIWw0IIEMD68HzsE0H+DgDIE4H+DaDD0cG8G4X2FgFS6EFGE2LAIWG0GsHMH+EoEWTaIOFn uEH+DKCzzkDjzoH+DJ1aH+FuFgbRsGIIEKD2fZyCrEIOGUGMI2E8EqNLz6XmDsDXEgDUC6EwH+DW C9zx1ZzkF4FuOOHUq0D8Dnb8DeDHwd0h0kEeEKQsKQCkCLFKDv2SIQD6DkFJENg2H/ygYFxkPCBu BQDkH+CwCXIsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-210--241845262 Content-Type: multipart/alternative; boundary=Apple-Mail-212--241845261 --Apple-Mail-212--241845261 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-212--241845261 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII <smaller> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be <italic><x-tad-smaller> First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi.</x-tad-smaller></italic></smaller> --Apple-Mail-212--241845261-- --Apple-Mail-210--241845262-- From pgsql-performance-owner@postgresql.org Tue Nov 22 14:43:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B80FFDB0E1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:43:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94852-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 18:43:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 46B94DB08A for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 14:42:59 -0400 (AST) Received: from amanda.contactbda.com (ipn36372-f65123.cidr.lightship.net [216.204.66.227]) by svr2.postgresql.org (Postfix) with ESMTP id 63B9BF0BC5 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 18:42:59 +0000 (GMT) Received: from amanda.contactbda.com (amanda.contactbda.com [192.168.1.2]) by amanda.contactbda.com (8.12.11/8.12.11/Debian-3) with ESMTP id jAMIgrqj002394; Tue, 22 Nov 2005 13:42:53 -0500 From: "Jim Buttafuoco" <jim@contactbda.com> To: Yves Vindevogel <yves.vindevogel@implements.be>, pgsql-performance@postgresql.org Reply-To: jim@contactbda.com Subject: Re: Stored Procedure Date: Tue, 22 Nov 2005 13:42:53 -0500 Message-Id: <20051122184119.M48526@contactbda.com> In-Reply-To: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> References: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> X-Mailer: Open WebMail 2.41 20040926 X-OriginatingIP: 192.168.1.1 (jim) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/451 X-Sequence-Number: 15708 create function abc() returns setof RECORD ... then to call it you would do select * from abc() as (a text,b int,...); ---------- Original Message ----------- From: Yves Vindevogel <yves.vindevogel@implements.be> To: pgsql-performance@postgresql.org Sent: Tue, 22 Nov 2005 19:29:37 +0100 Subject: [PERFORM] Stored Procedure > Is there another way in PG to return a recordset from a function than > to declare a type first ? > > create function fnTest () returns setof > myDefinedTypeIDontWantToDefineFirst ... > > Met vriendelijke groeten, > Bien � vous, > Kind regards, > > Yves Vindevogel > Implements ------- End of Original Message ------- From pgsql-performance-owner@postgresql.org Tue Nov 22 14:59:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D71DDDB0D0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 14:59:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97373-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 18:59:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 08C14DB0C8 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 14:59:48 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jAMIxgBl056556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Nov 2005 11:59:45 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jAMIxgsQ018202; Tue, 22 Nov 2005 11:59:42 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jAMIxgfL018201; Tue, 22 Nov 2005 11:59:42 -0700 (MST) (envelope-from mfuhr) Date: Tue, 22 Nov 2005 11:59:42 -0700 From: Michael Fuhr <mike@fuhr.org> To: Yves Vindevogel <yves.vindevogel@implements.be> Cc: pgsql-performance@postgresql.org Subject: Re: Stored Procedure Message-ID: <20051122185941.GA18102@winnie.fuhr.org> References: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000, UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/452 X-Sequence-Number: 15709 On Tue, Nov 22, 2005 at 07:29:37PM +0100, Yves Vindevogel wrote: > Is there another way in PG to return a recordset from a function than > to declare a type first ? In 8.1 some languages support OUT and INOUT parameters. CREATE FUNCTION foo(IN x integer, INOUT y integer, OUT z integer) AS $$ BEGIN y := y * 10; z := x * 10; END; $$ LANGUAGE plpgsql IMMUTABLE STRICT; SELECT * FROM foo(1, 2); y | z ----+---- 20 | 10 (1 row) CREATE FUNCTION fooset(IN x integer, INOUT y integer, OUT z integer) RETURNS SETOF record AS $$ BEGIN y := y * 10; z := x * 10; RETURN NEXT; y := y + 1; z := z + 1; RETURN NEXT; END; $$ LANGUAGE plpgsql IMMUTABLE STRICT; SELECT * FROM fooset(1, 2); y | z ----+---- 20 | 10 21 | 11 (2 rows) -- Michael Fuhr From pgsql-performance-owner@postgresql.org Tue Nov 22 15:23:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ACD90D7E05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 15:23:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00743-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 19:23:40 +0000 (GMT) X-Greylist: delayed 02:23:37.837591 by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by svr1.postgresql.org (Postfix) with ESMTP id 86718D80BA for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 15:23:36 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: High context switches occurring Date: Tue, 22 Nov 2005 14:23:34 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785027001C1@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcXvizKJ0RfGM9seSRqWYudicPH/OAADq+GA From: "Anjan Dave" <adave@vantage.com> To: "Tom Lane" <tgl@sss.pgh.pa.us>, "Vivek Khera" <vivek@khera.org> Cc: "Postgresql Performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.36 required=5 tests=[AWL=-0.119, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.36 X-Spam-Level: X-Archive-Number: 200511/453 X-Sequence-Number: 15710 Thanks, guys, I'll start planning on upgrading to PG8.1 Would this problem change it's nature in any way on the recent Dual-Core Intel XEON MP machines? Thanks, Anjan -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Sent: Tuesday, November 22, 2005 12:36 PM To: Vivek Khera Cc: Postgresql Performance; Anjan Dave Subject: Re: [PERFORM] High context switches occurring=20 Vivek Khera <vivek@khera.org> writes: > On Nov 22, 2005, at 11:59 AM, Anjan Dave wrote: >> This is a Dell Quad XEON. Hyperthreading is turned on, and I am =20 >> planning to turn it off as soon as I get a chance to bring it down. > You should probably also upgrade to Pg 8.0 or newer since it is a =20 > known problem with XEON processors and older postgres versions. =20 > Upgrading Pg may solve your problem or it may not. PG 8.1 is the first release that has a reasonable probability of avoiding heavy contention for the buffer manager lock when there are multiple CPUs. If you're going to update to try to fix this, you need to go straight to 8.1. I've recently been chasing a report from Rob Creager that seems to indicate contention on SubTransControlLock, so the slru code is likely to be our next bottleneck to fix :-( regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 22 15:41:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5391DD817C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 15:41:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03622-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 19:41:43 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 84A04D9566 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 15:41:40 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAMJfe2L013417; Tue, 22 Nov 2005 14:41:40 -0500 (EST) To: "Anjan Dave" <adave@vantage.com> cc: "Vivek Khera" <vivek@khera.org>, "Postgresql Performance" <pgsql-performance@postgresql.org> Subject: Re: High context switches occurring In-reply-to: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785027001C1@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785027001C1@vt-pe2550-001.vantage.vantage.com> Comments: In-reply-to "Anjan Dave" <adave@vantage.com> message dated "Tue, 22 Nov 2005 14:23:34 -0500" Date: Tue, 22 Nov 2005 14:41:40 -0500 Message-ID: <13416.1132688500@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200511/454 X-Sequence-Number: 15711 "Anjan Dave" <adave@vantage.com> writes: > Would this problem change it's nature in any way on the recent Dual-Core > Intel XEON MP machines? Probably not much. There's some evidence that Opterons have less of a problem than Xeons in multi-chip configurations, but we've seen CS thrashing on Opterons too. I think the issue is probably there to some extent in any modern SMP architecture. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Nov 22 16:33:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 652E0DB7E5 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 16:33:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20727-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 20:33:30 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by svr1.postgresql.org (Postfix) with ESMTP id 512C6DB7DB for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 16:33:26 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: High context switches occurring Date: Tue, 22 Nov 2005 15:33:26 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E76@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcXvizKJ0RfGM9seSRqWYudicPH/OAADq+GAAACsshA= From: "Anjan Dave" <adave@vantage.com> To: "Anjan Dave" <adave@vantage.com>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Vivek Khera" <vivek@khera.org> Cc: "Postgresql Performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.119, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/455 X-Sequence-Number: 15712 Is there any way to get a temporary relief from this Context Switching storm? Does restarting postmaster help? It seems that I can recreate the heavy CS with just one SELECT statement...and then when multiple such SELECT queries are coming in, things just get hosed up until we cancel a bunch of queries... Thanks, Anjan -----Original Message----- From: Anjan Dave=20 Sent: Tuesday, November 22, 2005 2:24 PM To: Tom Lane; Vivek Khera Cc: Postgresql Performance Subject: Re: [PERFORM] High context switches occurring=20 Thanks, guys, I'll start planning on upgrading to PG8.1 Would this problem change it's nature in any way on the recent Dual-Core Intel XEON MP machines? Thanks, Anjan -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Sent: Tuesday, November 22, 2005 12:36 PM To: Vivek Khera Cc: Postgresql Performance; Anjan Dave Subject: Re: [PERFORM] High context switches occurring=20 Vivek Khera <vivek@khera.org> writes: > On Nov 22, 2005, at 11:59 AM, Anjan Dave wrote: >> This is a Dell Quad XEON. Hyperthreading is turned on, and I am =20 >> planning to turn it off as soon as I get a chance to bring it down. > You should probably also upgrade to Pg 8.0 or newer since it is a =20 > known problem with XEON processors and older postgres versions. =20 > Upgrading Pg may solve your problem or it may not. PG 8.1 is the first release that has a reasonable probability of avoiding heavy contention for the buffer manager lock when there are multiple CPUs. If you're going to update to try to fix this, you need to go straight to 8.1. I've recently been chasing a report from Rob Creager that seems to indicate contention on SubTransControlLock, so the slru code is likely to be our next bottleneck to fix :-( regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Nov 22 16:37:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 61D3DDB6B0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 16:37:50 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17304-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 20:37:50 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id A515BDB48E for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 16:37:47 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 22 Nov 2005 14:37:47 -0600 Subject: Re: High context switches occurring From: Scott Marlowe <smarlowe@g2switchworks.com> To: Anjan Dave <adave@vantage.com> Cc: Tom Lane <tgl@sss.pgh.pa.us>, Vivek Khera <vivek@khera.org>, Postgresql Performance <pgsql-performance@postgresql.org> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E76@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E76@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132691867.28788.42.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 22 Nov 2005 14:37:47 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/456 X-Sequence-Number: 15713 On Tue, 2005-11-22 at 14:33, Anjan Dave wrote: > Is there any way to get a temporary relief from this Context Switching > storm? Does restarting postmaster help? > > It seems that I can recreate the heavy CS with just one SELECT > statement...and then when multiple such SELECT queries are coming in, > things just get hosed up until we cancel a bunch of queries... Is your machine a hyperthreaded one? Some folks have found that turning off hyper threading helps. I knew it made my servers better behaved in the past. From pgsql-performance-owner@postgresql.org Tue Nov 22 16:38:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 32530DB861 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 16:38:33 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28630-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 20:38:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 47CE1DB816 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 16:38:29 -0400 (AST) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 22 Nov 2005 14:38:31 -0600 Subject: Re: High context switches occurring From: Scott Marlowe <smarlowe@g2switchworks.com> To: Anjan Dave <adave@vantage.com> Cc: Tom Lane <tgl@sss.pgh.pa.us>, Vivek Khera <vivek@khera.org>, Postgresql Performance <pgsql-performance@postgresql.org> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E76@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E76@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1132691910.28788.44.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Tue, 22 Nov 2005 14:38:31 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/457 X-Sequence-Number: 15714 P.s., followup to my last post, I don't know if turning of HT actually lowered the number of context switches, just that it made my server run faster. From pgsql-performance-owner@postgresql.org Tue Nov 22 18:17:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B8AB9DBCA1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 18:17:45 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96922-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 22:17:45 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hoboe2bl1.telenet-ops.be (hoboe2bl1.telenet-ops.be [195.130.137.73]) by svr1.postgresql.org (Postfix) with ESMTP id B9C7EDA406 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 18:17:40 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by hoboe2bl1.telenet-ops.be (Postfix) with SMTP id 698E738187 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 23:17:42 +0100 (CET) Received: from [10.0.1.2] (d5152B3BA.access.telenet.be [81.82.179.186]) by hoboe2bl1.telenet-ops.be (Postfix) with ESMTP id 2DD9F38077 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 23:17:42 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v623) In-Reply-To: <20051122184119.M48526@contactbda.com> References: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> <20051122184119.M48526@contactbda.com> Content-Type: multipart/mixed; boundary=Apple-Mail-1--228161321 Message-Id: <33f74d2a046b89d119c349e82b7398de@implements.be> From: Yves Vindevogel <yves.vindevogel@implements.be> Subject: Re: Stored Procedure Date: Tue, 22 Nov 2005 23:17:41 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.823 required=5 tests=[RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 1.823 X-Spam-Level: * X-Archive-Number: 200511/458 X-Sequence-Number: 15715 --Apple-Mail-1--228161321 Content-Type: multipart/alternative; boundary=Apple-Mail-2--228161320 --Apple-Mail-2--228161320 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed But this does not work without the second line, right ? BTW, the thing returned is not a record. It's a bunch of fields, not a=20= complete record or fields of multiple records. I'm not so sure it works. On 22 Nov 2005, at 19:42, Jim Buttafuoco wrote: > create function abc() returns setof RECORD ... > > then to call it you would do > select * from abc() as (a text,b int,...); > > > > > ---------- Original Message ----------- > From: Yves Vindevogel <yves.vindevogel@implements.be> > To: pgsql-performance@postgresql.org > Sent: Tue, 22 Nov 2005 19:29:37 +0100 > Subject: [PERFORM] Stored Procedure > >> Is there another way in PG to return a recordset from a function than >> to declare a type first ? >> >> create function fnTest () returns setof >> myDefinedTypeIDontWantToDefineFirst ... >> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> Yves Vindevogel >> Implements > ------- End of Original Message ------- > > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-2--228161320 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 But this does not work without the second line, right ? BTW, the thing returned is not a record. It's a bunch of fields, not a complete record or fields of multiple records. I'm not so sure it works. On 22 Nov 2005, at 19:42, Jim Buttafuoco wrote: <excerpt>create function abc() returns setof RECORD ... then to call it you would do select * from abc() as (a text,b int,...); ---------- Original Message ----------- From: Yves Vindevogel <<yves.vindevogel@implements.be> To: pgsql-performance@postgresql.org Sent: Tue, 22 Nov 2005 19:29:37 +0100 Subject: [PERFORM] Stored Procedure <excerpt>Is there another way in PG to return a recordset from a function than=20 to declare a type first ? create function fnTest () returns setof=20 myDefinedTypeIDontWantToDefineFirst ... Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements </excerpt>------- End of Original Message ------- </excerpt>Met vriendelijke groeten, Bien =E0 vous, Kind regards, <bold>Yves Vindevogel</bold> <bold>Implements</bold> <smaller> </smaller>= --Apple-Mail-2--228161320-- --Apple-Mail-1--228161321 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM8LAAMjhhuR5ir4ULjigT5pn+P5co2T6pn+YBup6dp6xoh6kHie95modNOFkah0H+Qhd pyKBNmcf68r2Bo9GGtdpwIAUotM1Q4QMNzUDZhuVZbLsvy7KkqZZCnAb4AFcQY1C3LW1Wb5lOa2t ZvUt78NNjcMN83wEOMDczvuTzXNQ3QEN01WRL2b8XBYEDuugQEFUYgkpIo5FjIJTmhfZkHG8J0nm fB/sifp/EQYLBioUKsBkRKVgWPLX7stA4VnaDa+tZlZel0j+gCMpWS8MRULQNeIDY/4zTIAIyFX0 GFybZnr+rZ8p2a1s6tUNfADXXI1Yb8jLX+MNQk+1Az7zWqwVa/FaJrHpvSLeAQOhdE/l7CSJwrAb BXDXH+PkyA/gUiPGaftASWW6JeDgnGAsCmLNvcYqlz5+FchnZMrqGbeE3JoYhAMAKbEvOGeigtaE CDZwJcgxtiML0uMgQYzllKt2GhtP/EaH6cgAm+fnCtVEVXFOKNU54AC1B/tyLfBx4YJBGwhAAG5m yUoGH/TgxlZ7nGXw3YdEpYTPWOvaSq/JVEX28rEDQsGKDoGPx+QYnE1URg2paZY4dy7EHTx9cc41 upqIfwkjSgJWyW0MgBdK9I1DGAAwnS8G8+4cGYyUWWbKMg/gSiOjQG+FMQ44qqlmgBNUSYYMohKW 2ULFZaR8NdMFucoz/w/ZcAAMzgH+j/AKGV8QAZkhmWNM0AJ/I5zCiJEGYjF1qoGmxI5MqwT7JVlG buLULJhPXlbK+WMt3HwHmIbF8xaA0n6mvPgN7EJhx9Vcax+hsX6wGZuldNDnTSgQDoloGohS6BYE 62gPQqyRhlFE2gIYkCRgdD4WcAUsnxvlYklKgUCn4upi29JkkpG/pbYgtKbr86TLOnbLCF066ZLP kGsI+7NY9rRjZHB+0ew4M5S0AKT4FA8l0BaIUk4XHkj/EYLwzAtVyj/GwRYf49B8D6H+OMdw9R/j DG8vcTgx1xhpFTBoHYilRgaDygQAobXCynVVSSVdRYTLJls5CcIaqX0zpw/Kms76c2DSnTsNNPaA TbpggqOSCg4MkQwcAPiBAzimJqI4Xg3R/itX0P8bY66xD7MiYkgg5h4vAF2NgdY/xNGCH+HQVMIQ WiCNVM2L6Ap4s3ShFixMubA2HnjcUulhab3GuIbGxVjLlxXZoawMKFgsCiaSOUd6nB6XbH+PofKN LtqcH7eMf5AyimQOtegf4/TIEFvYP8dyjTm2eV1KdmNgrlIKr/cOxF+LjmRldTZY88L/U6P/YtyF +b82PDAhkOQsyNkHu8jS76NB4YXH+PvDUG7v3lIFeu8mFbuj6q8PXE2HEaXqIEUEgxnh2T2YhD/B WBZcUunVjO59yMB3PsHc3BONLemxwaP8NwsTMEPvVeMieJKvXmHZk8f48h5GHyYP8e+V3g3tvMQs VY01FLCxjgTHk8b943yBTOVoJEiXJzPgae1zr+2HwYhnIuRzrjczwP8eY8zDmKy7l8NOYcx40zKW nNswizytg+kXHc/qS48x9o7QbNMhZ0yMdvPBG7wmNz/jB6WYs436uFmbHhbFrAFgjhl4Y/g5IvH+ 0EkYFw+NuAHqmoet9bWJwPnDHEfM55E0udjTNW7uZ+y9p6L+oNe3Bxtoa4lACzgQee2kQ5Jwo1RK QPQfK8xejaJ6FG6w/wEh1NZJ+L6ydoH+zfqTUK0dK7AzsY7Yem9jaA0Fu2wVf9eJObqW+TxuwbCS K4JEYVnh2O/vWQM5K+wtCehCCAP5YABybV035xCAJIJqnrTyFqB9H8e1Lu/OumM870MTp3MGn9J8 g5Zsxhk2ZURLfGmrBAEg5m/CISIf4jRekblaCgRoyS0BjWNZVw6uZ70hnsrkND/Fbn3kWWtmz1ID a5NxyLYJ1xujdI3iZTm9dkYy4/P9yFKIcFoDQsbtKW4nT2YbLrpr450V6zTGem7N+YzXVzDZ0PSl ddIb8GQVrlD9sQjy4FKHVy0ZDDeLHCPWuuD/68Y0Vg1LX8c0bQSBiAq9JrVv2pYwZkzq6mqxDi8y XJgBkjZGftMMdUgm5PKyCBnogBI72hYgZlgrD6WWgMzPZkxGdUzfIfIzsdb66PXr/Jxp+XwRGlOL GnuJm2b0l7vo/dJeDL4N7qwWN+qn5CqedNMATuzZmObaad1s4dBMl/6wmG/Pt1+oAAYk2hToiuQc 5FxyjyRoHqH0xYKE+Q8k+UIgH0KAH+HSHqXmGwHSIuEGF0I25eWE8A96/g2akwhIk8Puf25mpi3w /IeG/M8y0O10/WgM3cpUS8l0mS+ocOYgDQS0ASDUTOB6EaJWDkXyXwFyL+GqGkPKHQHMOkxIXmIO HAHAJyyuKgvGIIHgU2H+G0GuHKH+FwF6KwEAtAH+CUEcLOAiNC2QnKcOZSZCmO9ongNep2sA3Y2W nY/KwE9hDazc8w8Sug9mh6cAZ0/UAEC0FKH+AOCOEoJQBeD8H+A2A+DYYGBuD2H+D6DmFCH+F0Fq hDB+PKGcGaaSGsGmJyGOGGg0EuEgP0CqCOEOH+BIA+DQH+AgBSDrD+CAEcH+AICwFNA+pamupfDQ /G1E2asfDksJDesNBCv012x+5WDmQSseeiAaCGEiH+BEAmC0H+A8AcCyH+A4AXGqAqAOCsLqAQCw H+BMAuDIH+CJEWPMCpFKCaCEEASEBFESA2AaC2H+AoAOCqK6AVGqA8AYCvGcAiC9HmBlHZBglBDt F80LF7BNDdBHDg2U0JGI0lGEseWsAgB6EYH+BUAkC4H+BKAuDDGcArH+BCAnH+A8AeC6K7HjG7H4 AoANHtG1G4A1GxGkAfHkBAAjJOBCAqC/FMAuDAH+BOApJ8A0BYDy2aWtGEzI1G2dKRIUwDGDF9BP DooBISnVImB9IsBRJHI2AuDHK3HHI4DFK3K6BGArI8BAAlJ8A8AhJqAlJxJBK3LDLBK9LmBNKCH+ AwBZEZIGcjGM3zKVIRL7BEH8zVKfKojrKlMCQVIk2jKuH/KzH/I5K7MjLFMpMnI5HGBIAvG/I5J9 MvMrK5M/K7LrJ9LxL1DXL5KYp1L/MM80g2wABMzWAGjVDZIc/XDrIiNjKtKxK1MtNBN7MlN9HFJ5 M3J7NDONMnNHLvLzKNKnMS5dNPMAsGpgLKLoAQNswAH8EAGAXGB0EobQAwEEJOblOa1uzJIfNvF9 MXFVMbMfOPODOBOBMxM1K3M7PfPdNFLtNLOZOcfjIOgVPIfeAaD2VGBUEY6ECyFQL+awXWH+HCHa KgW+KoAqDsPu3Mt8rxMO+fOjPTNzMZN3MhPtN/M/PlOJPrPhPvHBPzOXL3KPKhP69Mv4SmYWWs4m QyDGFUGsH+GeHEOkHW204SIED6FmaSBqeZHmQ3Fikw7iPwZWkCSs40Yg0CwTQAxpPUAhPZN5RDS1 PjOHPpRRRFOTP1RZSo5W1skw6MDa6g5omYZW94AYDkN+BOD+NKCoE6SKHy1WA8EOL2Z8cuhGTU/f SlArAu95L2cmiO1xSrQ7PXQ/S/S1RJS9RFUlNBTDRXNPRavw3St25kTXBiQsADBfUFNO/fUC6K+A N+9fTI2SkOfG6YmY9MZWDEFS+0TInFUQSfPI1NQ9MdSzRPUnS5MzRLUdRPUqD02RRaeoseDdSaQn ScQi9G/kPu+e/o+E8UQUoGv/IXMKsOfqZu8O/eV2S89E7QZ7XG8w/edGQYxiTeoSB3FKBQAlRBV9 S3LnWDUjXpN7LCBOAnJ8AyBXKKV0Z7KPKO6i764rXI9wS8DJVq6TAw+hP5MFBJDi0Ofq0i86mQPv XMDRWlBi6QVy6iAYCUEuJIBDESBGA0DNI2AxLjRCAxS4BGAvH5I5J2BLZdZVV9ZtZqDKJIA+DUH+ AiB4ES2a4pDFDE+fVIkg84ZylyTUn7RdYjIZYhQy14fipY9SDTWhSjRg6UAEC+fZGWEfEMBCDbFM AtJ9MzI9LlM8BFZjJ5ZpNBMzLCBJLKH+A+A3ZSAiByEMmcC0FO7Q7eTVSW+ectBY9HQ2oFDTNXak Ns9fIa0hPPVUfqfq5i3OjohIAEC6fYAWB6ERFUBSDxLuAtZSA7JSA/JoH/LPH+BIAtK7bZG4BGAt JCApH+A+AhJPGnJOA0AfH+AiBIDoWuBzc6AICvD8PxUAWJWWj2sfWwsPP9cXWzKc/PGE0jPQvwiE 9kWsAeB+EVI2AaCpdQAbGjGnHkA4AbJPHhI0A2AZI0A6AdI1drG+A6AfG/HhGjfVI1fLfJGpfBGq BGAZHsAvKJA+j7eZencVNSlZGBelINchalStIqbTV7J5I8BDLtdrJPfLfSAZHkA2AXfPfXENJTfl JrK0BFdjMoBOArX7UsYhUxaledgRcZgVBLMTepVU17StSxXlMrZzbgAtLDgrdoAlGiBBK1dhZZLi AxK/OFORRVNNhbhu0PhhafgTW1gXilgbgRhzUbV/OOAwDPFMAxe/ZrPriXXnWJidP3hiuZgPiphk eGA8EUJGWEc3MNhtgdUXSvi5XxS1Z3Zhe/MzbfjNRRUrieVpeejtOg0OseDeNYQexAIEE4GcX2B4 EkRKAMDsNjXSTWcVVVjvi1jzh1WHM/j8AvkAAvkFlHkLjVjdjZF4pPk0nANKLKQIBCESL2D6F6XG XgvWqwHQMqEsGIRaL6RSAgD6bcQAbyNRBkLQDCWNhdNxkPj1V5h3i7N7lLlPlTmtUpjTTHak1tUE DHDyQMDWN+ggQIByEiJOEGOcGIG8Okq7CMXay2KMG8HaU4rcMGCIE8aSBcEWL2Ci4ccggbKXhxlD j3jPPdmxbdLnm3PxNJhZkO1CseseDUNKBIEMJWB8EqhCBqEuGgH+DiFiL+GXQcINAEIhl4McIkXc IICurWWuDulCNiDW85VVi3mplHmuH/j/oZM9odRTohkNNQnjYIc6QIAILmH+BgEOLOtabCUcIPpV qiIOHMKeOQGoJ6C+FaMwAuEJT474DYTfliJQrbgjmrj5OBoXkDobrTJ/LsArX+LQDI72nBlkJQLv C2FBpAEoGOMGGhqsvKH7nlqpqlnpsKKMHgJ+tgGQPKCmFIaSAwD8LOA4EGJWBiCdEFH1G/iPp0Av rXlRrboTdXLDdrI0BSBkD4H/n8JOAkD7o0EwhCECF+PKG6HceBsQRtsPtyOuq4/+22RcFYJGBkBK Ddp4AtI8A2AdHkA/H9uPZZrVp5lNp9OFMzK7iLJ9HhHlgrJ8BSA3FSEWECe+vNsVnkXdt4MVqnvR qiHmHkKgF+F0JqEMD8fECQB4D7uPI8AyAZGjubJ8BAAqClbqAng4AbfZdsKyBTuMDiDOE2H+FmFe JGHMU1vXwrvVwrwxCKagF3pADyDiFEH+CWCAEHJ+A3G4B+BmDmH+DQC7EEFGE4NKHYHUXvwxxqIj t3xtxyIaw0ImGwGus8HgUZx1yGavxxyJyPyRySKIKQFuFibQGOGEYFyVynypymKQCaB/xIDkDOE8 IQFSFEVGE+EsQIIWGEF4L+EwEeP6IOE4EoN2DOC0ErpCDLy6DYDAEyH+FiFU6EHyq6H+DqDUFAH+ G4GwOWIWw0IIEMD68HzsE0H+DgDIE4H+DaDD0cG8G4X2FgFS6EFGE2LAIWG0GsHMH+EoEWTaIOFn uEH+DKCzzkDjzoH+DJ1aH+FuFgbRsGIIEKD2fZyCrEIOGUGMI2E8EqNLz6XmDsDXEgDUC6EwH+DW C9zx1ZzkF4FuOOHUq0D8Dnb8DeDHwd0h0kEeEKQsKQCkCLFKDv2SIQD6DkFJENg2H/ygYFxkPCBu BQDkH+CwCXIsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-1--228161321 Content-Type: multipart/alternative; boundary=Apple-Mail-3--228161319 --Apple-Mail-3--228161319 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-3--228161319 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII <smaller> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be <italic><x-tad-smaller> First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi.</x-tad-smaller></italic></smaller> --Apple-Mail-3--228161319-- --Apple-Mail-1--228161321-- From pgsql-performance-owner@postgresql.org Tue Nov 22 18:52:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49F34DBE02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 18:52:20 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06924-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 22:52:21 +0000 (GMT) X-Greylist: delayed 00:32:06.985064 by SQLgrey- Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by svr1.postgresql.org (Postfix) with ESMTP id 49326DBDCD for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 18:52:16 -0400 (AST) Received: from [10.0.1.2] (d5152B3BA.access.telenet.be [81.82.179.186]) by adicia.telenet-ops.be (Postfix) with ESMTP id A363A380D9 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 23:20:10 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v623) In-Reply-To: <20051122185941.GA18102@winnie.fuhr.org> References: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> <20051122185941.GA18102@winnie.fuhr.org> Content-Type: multipart/mixed; boundary=Apple-Mail-4--228012768 Message-Id: <06612338d301f531643d479a819e4632@implements.be> From: Yves Vindevogel <yves.vindevogel@implements.be> Subject: Re: Stored Procedure Date: Tue, 22 Nov 2005 23:20:09 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.823 required=5 tests=[RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 1.823 X-Spam-Level: * X-Archive-Number: 200511/459 X-Sequence-Number: 15716 --Apple-Mail-4--228012768 Content-Type: multipart/alternative; boundary=Apple-Mail-5--228012768 --Apple-Mail-5--228012768 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed 8.1, hmm, that's brand new. But, still, it's quite some coding for a complete recordset, not ? On 22 Nov 2005, at 19:59, Michael Fuhr wrote: > On Tue, Nov 22, 2005 at 07:29:37PM +0100, Yves Vindevogel wrote: >> Is there another way in PG to return a recordset from a function than >> to declare a type first ? > > In 8.1 some languages support OUT and INOUT parameters. > > CREATE FUNCTION foo(IN x integer, INOUT y integer, OUT z integer) AS = $$ > BEGIN > y :=3D y * 10; > z :=3D x * 10; > END; > $$ LANGUAGE plpgsql IMMUTABLE STRICT; > > SELECT * FROM foo(1, 2); > y | z > ----+---- > 20 | 10 > (1 row) > > CREATE FUNCTION fooset(IN x integer, INOUT y integer, OUT z integer) > RETURNS SETOF record AS $$ > BEGIN > y :=3D y * 10; > z :=3D x * 10; > RETURN NEXT; > y :=3D y + 1; > z :=3D z + 1; > RETURN NEXT; > END; > $$ LANGUAGE plpgsql IMMUTABLE STRICT; > > SELECT * FROM fooset(1, 2); > y | z > ----+---- > 20 | 10 > 21 | 11 > (2 rows) > > --=20 > Michael Fuhr > > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-5--228012768 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 8.1, hmm, that's brand new. =20 But, still, it's quite some coding for a complete recordset, not ? On 22 Nov 2005, at 19:59, Michael Fuhr wrote: <excerpt>On Tue, Nov 22, 2005 at 07:29:37PM +0100, Yves Vindevogel wrote: <excerpt>Is there another way in PG to return a recordset from a function than=20 to declare a type first ?=20 </excerpt> In 8.1 some languages support OUT and INOUT parameters. CREATE FUNCTION foo(IN x integer, INOUT y integer, OUT z integer) AS $$ BEGIN y :=3D y * 10; z :=3D x * 10; END; $$ LANGUAGE plpgsql IMMUTABLE STRICT; SELECT * FROM foo(1, 2); y | z =20 ----+---- 20 | 10 (1 row) CREATE FUNCTION fooset(IN x integer, INOUT y integer, OUT z integer)=20 RETURNS SETOF record AS $$ BEGIN y :=3D y * 10; z :=3D x * 10; RETURN NEXT; y :=3D y + 1; z :=3D z + 1; RETURN NEXT; END; $$ LANGUAGE plpgsql IMMUTABLE STRICT; SELECT * FROM fooset(1, 2); y | z =20 ----+---- 20 | 10 21 | 11 (2 rows) --=20 Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org </excerpt>Met vriendelijke groeten, Bien =E0 vous, Kind regards, <bold>Yves Vindevogel</bold> <bold>Implements</bold> <smaller> </smaller>= --Apple-Mail-5--228012768-- --Apple-Mail-4--228012768 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM8LAAMjhhuR5ir4ULjigT5pn+P5co2T6pn+YBup6dp6xoh6kHie95modNOFkah0H+Qhd pyKBNmcf68r2Bo9GGtdpwIAUotM1Q4QMNzUDZhuVZbLsvy7KkqZZCnAb4AFcQY1C3LW1Wb5lOa2t ZvUt78NNjcMN83wEOMDczvuTzXNQ3QEN01WRL2b8XBYEDuugQEFUYgkpIo5FjIJTmhfZkHG8J0nm fB/sifp/EQYLBioUKsBkRKVgWPLX7stA4VnaDa+tZlZel0j+gCMpWS8MRULQNeIDY/4zTIAIyFX0 GFybZnr+rZ8p2a1s6tUNfADXXI1Yb8jLX+MNQk+1Az7zWqwVa/FaJrHpvSLeAQOhdE/l7CSJwrAb BXDXH+PkyA/gUiPGaftASWW6JeDgnGAsCmLNvcYqlz5+FchnZMrqGbeE3JoYhAMAKbEvOGeigtaE CDZwJcgxtiML0uMgQYzllKt2GhtP/EaH6cgAm+fnCtVEVXFOKNU54AC1B/tyLfBx4YJBGwhAAG5m yUoGH/TgxlZ7nGXw3YdEpYTPWOvaSq/JVEX28rEDQsGKDoGPx+QYnE1URg2paZY4dy7EHTx9cc41 upqIfwkjSgJWyW0MgBdK9I1DGAAwnS8G8+4cGYyUWWbKMg/gSiOjQG+FMQ44qqlmgBNUSYYMohKW 2ULFZaR8NdMFucoz/w/ZcAAMzgH+j/AKGV8QAZkhmWNM0AJ/I5zCiJEGYjF1qoGmxI5MqwT7JVlG buLULJhPXlbK+WMt3HwHmIbF8xaA0n6mvPgN7EJhx9Vcax+hsX6wGZuldNDnTSgQDoloGohS6BYE 62gPQqyRhlFE2gIYkCRgdD4WcAUsnxvlYklKgUCn4upi29JkkpG/pbYgtKbr86TLOnbLCF066ZLP kGsI+7NY9rRjZHB+0ew4M5S0AKT4FA8l0BaIUk4XHkj/EYLwzAtVyj/GwRYf49B8D6H+OMdw9R/j DG8vcTgx1xhpFTBoHYilRgaDygQAobXCynVVSSVdRYTLJls5CcIaqX0zpw/Kms76c2DSnTsNNPaA TbpggqOSCg4MkQwcAPiBAzimJqI4Xg3R/itX0P8bY66xD7MiYkgg5h4vAF2NgdY/xNGCH+HQVMIQ WiCNVM2L6Ap4s3ShFixMubA2HnjcUulhab3GuIbGxVjLlxXZoawMKFgsCiaSOUd6nB6XbH+PofKN LtqcH7eMf5AyimQOtegf4/TIEFvYP8dyjTm2eV1KdmNgrlIKr/cOxF+LjmRldTZY88L/U6P/YtyF +b82PDAhkOQsyNkHu8jS76NB4YXH+PvDUG7v3lIFeu8mFbuj6q8PXE2HEaXqIEUEgxnh2T2YhD/B WBZcUunVjO59yMB3PsHc3BONLemxwaP8NwsTMEPvVeMieJKvXmHZk8f48h5GHyYP8e+V3g3tvMQs VY01FLCxjgTHk8b943yBTOVoJEiXJzPgae1zr+2HwYhnIuRzrjczwP8eY8zDmKy7l8NOYcx40zKW nNswizytg+kXHc/qS48x9o7QbNMhZ0yMdvPBG7wmNz/jB6WYs436uFmbHhbFrAFgjhl4Y/g5IvH+ 0EkYFw+NuAHqmoet9bWJwPnDHEfM55E0udjTNW7uZ+y9p6L+oNe3Bxtoa4lACzgQee2kQ5Jwo1RK QPQfK8xejaJ6FG6w/wEh1NZJ+L6ydoH+zfqTUK0dK7AzsY7Yem9jaA0Fu2wVf9eJObqW+TxuwbCS K4JEYVnh2O/vWQM5K+wtCehCCAP5YABybV035xCAJIJqnrTyFqB9H8e1Lu/OumM870MTp3MGn9J8 g5Zsxhk2ZURLfGmrBAEg5m/CISIf4jRekblaCgRoyS0BjWNZVw6uZ70hnsrkND/Fbn3kWWtmz1ID a5NxyLYJ1xujdI3iZTm9dkYy4/P9yFKIcFoDQsbtKW4nT2YbLrpr450V6zTGem7N+YzXVzDZ0PSl ddIb8GQVrlD9sQjy4FKHVy0ZDDeLHCPWuuD/68Y0Vg1LX8c0bQSBiAq9JrVv2pYwZkzq6mqxDi8y XJgBkjZGftMMdUgm5PKyCBnogBI72hYgZlgrD6WWgMzPZkxGdUzfIfIzsdb66PXr/Jxp+XwRGlOL GnuJm2b0l7vo/dJeDL4N7qwWN+qn5CqedNMATuzZmObaad1s4dBMl/6wmG/Pt1+oAAYk2hToiuQc 5FxyjyRoHqH0xYKE+Q8k+UIgH0KAH+HSHqXmGwHSIuEGF0I25eWE8A96/g2akwhIk8Puf25mpi3w /IeG/M8y0O10/WgM3cpUS8l0mS+ocOYgDQS0ASDUTOB6EaJWDkXyXwFyL+GqGkPKHQHMOkxIXmIO HAHAJyyuKgvGIIHgU2H+G0GuHKH+FwF6KwEAtAH+CUEcLOAiNC2QnKcOZSZCmO9ongNep2sA3Y2W nY/KwE9hDazc8w8Sug9mh6cAZ0/UAEC0FKH+AOCOEoJQBeD8H+A2A+DYYGBuD2H+D6DmFCH+F0Fq hDB+PKGcGaaSGsGmJyGOGGg0EuEgP0CqCOEOH+BIA+DQH+AgBSDrD+CAEcH+AICwFNA+pamupfDQ /G1E2asfDksJDesNBCv012x+5WDmQSseeiAaCGEiH+BEAmC0H+A8AcCyH+A4AXGqAqAOCsLqAQCw H+BMAuDIH+CJEWPMCpFKCaCEEASEBFESA2AaC2H+AoAOCqK6AVGqA8AYCvGcAiC9HmBlHZBglBDt F80LF7BNDdBHDg2U0JGI0lGEseWsAgB6EYH+BUAkC4H+BKAuDDGcArH+BCAnH+A8AeC6K7HjG7H4 AoANHtG1G4A1GxGkAfHkBAAjJOBCAqC/FMAuDAH+BOApJ8A0BYDy2aWtGEzI1G2dKRIUwDGDF9BP DooBISnVImB9IsBRJHI2AuDHK3HHI4DFK3K6BGArI8BAAlJ8A8AhJqAlJxJBK3LDLBK9LmBNKCH+ AwBZEZIGcjGM3zKVIRL7BEH8zVKfKojrKlMCQVIk2jKuH/KzH/I5K7MjLFMpMnI5HGBIAvG/I5J9 MvMrK5M/K7LrJ9LxL1DXL5KYp1L/MM80g2wABMzWAGjVDZIc/XDrIiNjKtKxK1MtNBN7MlN9HFJ5 M3J7NDONMnNHLvLzKNKnMS5dNPMAsGpgLKLoAQNswAH8EAGAXGB0EobQAwEEJOblOa1uzJIfNvF9 MXFVMbMfOPODOBOBMxM1K3M7PfPdNFLtNLOZOcfjIOgVPIfeAaD2VGBUEY6ECyFQL+awXWH+HCHa KgW+KoAqDsPu3Mt8rxMO+fOjPTNzMZN3MhPtN/M/PlOJPrPhPvHBPzOXL3KPKhP69Mv4SmYWWs4m QyDGFUGsH+GeHEOkHW204SIED6FmaSBqeZHmQ3Fikw7iPwZWkCSs40Yg0CwTQAxpPUAhPZN5RDS1 PjOHPpRRRFOTP1RZSo5W1skw6MDa6g5omYZW94AYDkN+BOD+NKCoE6SKHy1WA8EOL2Z8cuhGTU/f SlArAu95L2cmiO1xSrQ7PXQ/S/S1RJS9RFUlNBTDRXNPRavw3St25kTXBiQsADBfUFNO/fUC6K+A N+9fTI2SkOfG6YmY9MZWDEFS+0TInFUQSfPI1NQ9MdSzRPUnS5MzRLUdRPUqD02RRaeoseDdSaQn ScQi9G/kPu+e/o+E8UQUoGv/IXMKsOfqZu8O/eV2S89E7QZ7XG8w/edGQYxiTeoSB3FKBQAlRBV9 S3LnWDUjXpN7LCBOAnJ8AyBXKKV0Z7KPKO6i764rXI9wS8DJVq6TAw+hP5MFBJDi0Ofq0i86mQPv XMDRWlBi6QVy6iAYCUEuJIBDESBGA0DNI2AxLjRCAxS4BGAvH5I5J2BLZdZVV9ZtZqDKJIA+DUH+ AiB4ES2a4pDFDE+fVIkg84ZylyTUn7RdYjIZYhQy14fipY9SDTWhSjRg6UAEC+fZGWEfEMBCDbFM AtJ9MzI9LlM8BFZjJ5ZpNBMzLCBJLKH+A+A3ZSAiByEMmcC0FO7Q7eTVSW+ectBY9HQ2oFDTNXak Ns9fIa0hPPVUfqfq5i3OjohIAEC6fYAWB6ERFUBSDxLuAtZSA7JSA/JoH/LPH+BIAtK7bZG4BGAt JCApH+A+AhJPGnJOA0AfH+AiBIDoWuBzc6AICvD8PxUAWJWWj2sfWwsPP9cXWzKc/PGE0jPQvwiE 9kWsAeB+EVI2AaCpdQAbGjGnHkA4AbJPHhI0A2AZI0A6AdI1drG+A6AfG/HhGjfVI1fLfJGpfBGq BGAZHsAvKJA+j7eZencVNSlZGBelINchalStIqbTV7J5I8BDLtdrJPfLfSAZHkA2AXfPfXENJTfl JrK0BFdjMoBOArX7UsYhUxaledgRcZgVBLMTepVU17StSxXlMrZzbgAtLDgrdoAlGiBBK1dhZZLi AxK/OFORRVNNhbhu0PhhafgTW1gXilgbgRhzUbV/OOAwDPFMAxe/ZrPriXXnWJidP3hiuZgPiphk eGA8EUJGWEc3MNhtgdUXSvi5XxS1Z3Zhe/MzbfjNRRUrieVpeejtOg0OseDeNYQexAIEE4GcX2B4 EkRKAMDsNjXSTWcVVVjvi1jzh1WHM/j8AvkAAvkFlHkLjVjdjZF4pPk0nANKLKQIBCESL2D6F6XG XgvWqwHQMqEsGIRaL6RSAgD6bcQAbyNRBkLQDCWNhdNxkPj1V5h3i7N7lLlPlTmtUpjTTHak1tUE DHDyQMDWN+ggQIByEiJOEGOcGIG8Okq7CMXay2KMG8HaU4rcMGCIE8aSBcEWL2Ci4ccggbKXhxlD j3jPPdmxbdLnm3PxNJhZkO1CseseDUNKBIEMJWB8EqhCBqEuGgH+DiFiL+GXQcINAEIhl4McIkXc IICurWWuDulCNiDW85VVi3mplHmuH/j/oZM9odRTohkNNQnjYIc6QIAILmH+BgEOLOtabCUcIPpV qiIOHMKeOQGoJ6C+FaMwAuEJT474DYTfliJQrbgjmrj5OBoXkDobrTJ/LsArX+LQDI72nBlkJQLv C2FBpAEoGOMGGhqsvKH7nlqpqlnpsKKMHgJ+tgGQPKCmFIaSAwD8LOA4EGJWBiCdEFH1G/iPp0Av rXlRrboTdXLDdrI0BSBkD4H/n8JOAkD7o0EwhCECF+PKG6HceBsQRtsPtyOuq4/+22RcFYJGBkBK Ddp4AtI8A2AdHkA/H9uPZZrVp5lNp9OFMzK7iLJ9HhHlgrJ8BSA3FSEWECe+vNsVnkXdt4MVqnvR qiHmHkKgF+F0JqEMD8fECQB4D7uPI8AyAZGjubJ8BAAqClbqAng4AbfZdsKyBTuMDiDOE2H+FmFe JGHMU1vXwrvVwrwxCKagF3pADyDiFEH+CWCAEHJ+A3G4B+BmDmH+DQC7EEFGE4NKHYHUXvwxxqIj t3xtxyIaw0ImGwGus8HgUZx1yGavxxyJyPyRySKIKQFuFibQGOGEYFyVynypymKQCaB/xIDkDOE8 IQFSFEVGE+EsQIIWGEF4L+EwEeP6IOE4EoN2DOC0ErpCDLy6DYDAEyH+FiFU6EHyq6H+DqDUFAH+ G4GwOWIWw0IIEMD68HzsE0H+DgDIE4H+DaDD0cG8G4X2FgFS6EFGE2LAIWG0GsHMH+EoEWTaIOFn uEH+DKCzzkDjzoH+DJ1aH+FuFgbRsGIIEKD2fZyCrEIOGUGMI2E8EqNLz6XmDsDXEgDUC6EwH+DW C9zx1ZzkF4FuOOHUq0D8Dnb8DeDHwd0h0kEeEKQsKQCkCLFKDv2SIQD6DkFJENg2H/ygYFxkPCBu BQDkH+CwCXIsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-4--228012768 Content-Type: multipart/alternative; boundary=Apple-Mail-6--228012766 --Apple-Mail-6--228012766 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-6--228012766 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII <smaller> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be <italic><x-tad-smaller> First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi.</x-tad-smaller></italic></smaller> --Apple-Mail-6--228012766-- --Apple-Mail-4--228012768-- From pgsql-performance-owner@postgresql.org Tue Nov 22 19:17:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 60D09DBE6E for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 19:17:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12387-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 23:17:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by svr1.postgresql.org (Postfix) with ESMTP id 62D53DBE65 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 19:17:31 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: High context switches occurring Date: Tue, 22 Nov 2005 18:17:27 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E78@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcXvpJzxdiGehd5LROOUKlr06FlV9AAEfAsA From: "Anjan Dave" <adave@vantage.com> To: "Scott Marlowe" <smarlowe@g2switchworks.com> Cc: "Tom Lane" <tgl@sss.pgh.pa.us>, "Vivek Khera" <vivek@khera.org>, "Postgresql Performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/460 X-Sequence-Number: 15717 Yes, it's turned on, unfortunately it got overlooked during the setup, and until now...! It's mostly a 'read' application, I increased the vm.max-readahead to 2048 from the default 256, after which I've not seen the CS storm, though it could be incidental. Thanks, Anjan -----Original Message----- From: Scott Marlowe [mailto:smarlowe@g2switchworks.com]=20 Sent: Tuesday, November 22, 2005 3:38 PM To: Anjan Dave Cc: Tom Lane; Vivek Khera; Postgresql Performance Subject: Re: [PERFORM] High context switches occurring On Tue, 2005-11-22 at 14:33, Anjan Dave wrote: > Is there any way to get a temporary relief from this Context Switching > storm? Does restarting postmaster help? >=20 > It seems that I can recreate the heavy CS with just one SELECT > statement...and then when multiple such SELECT queries are coming in, > things just get hosed up until we cancel a bunch of queries... Is your machine a hyperthreaded one? Some folks have found that turning off hyper threading helps. I knew it made my servers better behaved in the past. From pgsql-performance-owner@postgresql.org Tue Nov 22 20:13:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B9492DBF54 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 20:13:36 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17556-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 00:13:37 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 63745DBF44 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 20:13:31 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jAN0DKV10698; Tue, 22 Nov 2005 19:13:20 -0500 (EST) From: Bruce Momjian <pgman@candle.pha.pa.us> Message-Id: <200511230013.jAN0DKV10698@candle.pha.pa.us> Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <87ek59omex.fsf@stark.xeocode.com> To: Greg Stark <gsstark@mit.edu> Date: Tue, 22 Nov 2005 19:13:20 -0500 (EST) CC: stange@rentec.com, Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200511/461 X-Sequence-Number: 15718 Greg Stark wrote: > > Alan Stange <stange@rentec.com> writes: > > > The point your making doesn't match my experience with *any* storage or program > > I've ever used, including postgresql. Your point suggests that the storage > > system is idle and that postgresql is broken because it isn't able to use the > > resources available...even when the cpu is very idle. How can that make sense? > > Well I think what he's saying is that Postgres is issuing a read, then waiting > for the data to return. Then it does some processing, and goes back to issue > another read. The CPU is idle half the time because Postgres isn't capable of > doing any work while waiting for i/o, and the i/o system is idle half the time > while the CPU intensive part happens. > > (Consider as a pathological example a program that reads 8k then sleeps for > 10ms, and loops doing that 1,000 times. Now consider the same program > optimized to read 8M asynchronously and sleep for 10s. By the time it's > finished sleeping it has probably read in all 8M. Whereas the program that > read 8k in little chunks interleaved with small sleeps would probably take > twice as long and appear to be entirely i/o-bound with 50% iowait and 50% > idle.) > > It's a reasonable theory and it's not inconsistent with the results you sent. > But it's not exactly proven either. Nor is it clear how to improve matters. > Adding additional threads to handle the i/o adds an enormous amount of > complexity and creates lots of opportunity for other contention that could > easily eat all of the gains. Perfect summary. We have a background writer now. Ideally we would have a background reader, that reads-ahead blocks into the buffer cache. The problem is that while there is a relatively long time between a buffer being dirtied and the time it must be on disk (checkpoint time), the read-ahead time is much shorter, requiring some kind of quick "create a thread" approach that could easily bog us down as outlined above. Right now the file system will do read-ahead for a heap scan (but not an index scan), but even then, there is time required to get that kernel block into the PostgreSQL shared buffers, backing up Luke's observation of heavy memcpy() usage. So what are our options? mmap()? I have no idea. Seems larger page size does help. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Tue Nov 22 23:39:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBFA2DBF66 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 23:39:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58043-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 03:39:06 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nz.telogis.com (unknown [203.98.10.169]) by svr1.postgresql.org (Postfix) with ESMTP id 99B69DB8A5 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 23:39:00 -0400 (AST) Received: from [192.168.3.1] ([192.168.3.1]) by nz.telogis.com with esmtp; Wed, 23 Nov 2005 16:39:04 +1300 id 007327AB.4383E458.000017DD Message-ID: <4383E459.2070906@telogis.com> Date: Wed, 23 Nov 2005 16:39:05 +1300 From: Ralph Mason <ralph.mason@telogis.com> User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Binary Refcursor possible? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/462 X-Sequence-Number: 15719 Hi, I am trying to get better performance reading data from postgres, so I would like to return the data as binary rather than text as parsing it is taking a considerable amount of processor. However I can't figure out how to do that! I have functions like. function my_func(ret refcursor) returns refcursor AS $$ BEGIN OPEN $1 for select * from table; return $1 END; $$ language 'plpgsql' There are queried using SELECT my_func( 'ret'::refcursor); FETCH ALL FROM ret; Is there any way I can say make ret a binary cursor? Thanks Ralph From pgsql-performance-owner@postgresql.org Tue Nov 22 23:58:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 110F5DAF8D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 22 Nov 2005 23:58:58 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61083-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 03:59:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 06D68D9585 for <pgsql-performance@postgresql.org>; Tue, 22 Nov 2005 23:58:54 -0400 (AST) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jAN3wKLm004749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Nov 2005 22:58:22 -0500 (EST) X-Source: non-mednet Received: from [172.16.160.106] (stangesun.rentec.com [172.16.160.106]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id jAN3wNY5007526; Tue, 22 Nov 2005 22:58:23 -0500 (EST) Message-ID: <4383E89C.8040200@rentec.com> Date: Tue, 22 Nov 2005 22:57:16 -0500 From: Alan Stange <stange@rentec.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Bruce Momjian <pgman@candle.pha.pa.us> CC: Greg Stark <gsstark@mit.edu>, Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <200511230013.jAN0DKV10698@candle.pha.pa.us> In-Reply-To: <200511230013.jAN0DKV10698@candle.pha.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jAN3wKLm004749 at Tue Nov 22 22:58:22 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/463 X-Sequence-Number: 15720 Bruce Momjian wrote: > Greg Stark wrote: > >> Alan Stange <stange@rentec.com> writes: >> >> >>> The point your making doesn't match my experience with *any* storage or program >>> I've ever used, including postgresql. Your point suggests that the storage >>> system is idle and that postgresql is broken because it isn't able to use the >>> resources available...even when the cpu is very idle. How can that make sense? >>> >> Well I think what he's saying is that Postgres is issuing a read, then waiting >> for the data to return. Then it does some processing, and goes back to issue >> another read. The CPU is idle half the time because Postgres isn't capable of >> doing any work while waiting for i/o, and the i/o system is idle half the time >> while the CPU intensive part happens. >> >> (Consider as a pathological example a program that reads 8k then sleeps for >> 10ms, and loops doing that 1,000 times. Now consider the same program >> optimized to read 8M asynchronously and sleep for 10s. By the time it's >> finished sleeping it has probably read in all 8M. Whereas the program that >> read 8k in little chunks interleaved with small sleeps would probably take >> twice as long and appear to be entirely i/o-bound with 50% iowait and 50% >> idle.) >> >> It's a reasonable theory and it's not inconsistent with the results you sent. >> But it's not exactly proven either. Nor is it clear how to improve matters. >> Adding additional threads to handle the i/o adds an enormous amount of >> complexity and creates lots of opportunity for other contention that could >> easily eat all of the gains. >> > > Perfect summary. We have a background writer now. Ideally we would > have a background reader, that reads-ahead blocks into the buffer cache. > The problem is that while there is a relatively long time between a > buffer being dirtied and the time it must be on disk (checkpoint time), > the read-ahead time is much shorter, requiring some kind of quick > "create a thread" approach that could easily bog us down as outlined > above. > > Right now the file system will do read-ahead for a heap scan (but not an > index scan), but even then, there is time required to get that kernel > block into the PostgreSQL shared buffers, backing up Luke's observation > of heavy memcpy() usage. > > So what are our options? mmap()? I have no idea. Seems larger page > size does help. For sequential scans, you do have a background reader. It's the kernel. As long as you don't issue a seek() between read() calls, the kernel will get the hint about sequential IO and begin to perform a read ahead for you. This is where the above analysis isn't quite right: while postgresql is processing the returned data from the read() call, the kernel has also issued reads as part of the read ahead, keeping the device busy while the cpu is busy. (I'm assuming these details for Linux; Solaris/UFS does work this way). Issue one seek on the file and the read ahead algorithm will back off for a while. This was my point about some descriptions of how the system works not being sensible. If your goal is sequential IO, then one must use larger block sizes. No one would use 8KB IO for achieving high sequential IO rates. Simply put, read() is about the slowest way to get 8KB of data. Switching to 32KB blocks reduces all the system call overhead by a large margin. Larger blocks would be better still, up to the stripe size of your mirror. (Of course, you're using a mirror and not raid5 if you care about performance.) I don't think the memcpy of data from the kernel to userspace is that big of an issue right now. dd and all the high end network interfaces manage OK doing it, so I'd expect postgresql to do all right with it now yet too. Direct IO will avoid that memcpy, but then you also don't get any caching of the files in memory. I'd be more concerned about any memcpy calls or general data management within postgresql. Does postgresql use the platform specific memcpy() in libc? Some care might be needed to ensure that the memory blocks within postgresql are all properly aligned to make sure that one isn't ping-ponging cache lines around (usually done by padding the buffer sizes by an extra 32 bytes or L1 line size). Whatever you do, all the usual high performance computing tricks should be used prior to considering any rewriting of major code sections. Personally, I'd like to see some detailed profiling being done using hardware counters for cpu cycles and cache misses, etc. Given the poor quality of work that has been discussed here in this thread, I don't have much confidence in any other additional results at this time. None of the analysis would be acceptable in any environment in which I've worked. Be sure to take a look at Sun's free Workshop tools as they are excellent for this sort of profiling and one doesn't need to recompile to use them. If I get a little time in the next week or two I might take a crack at this. Cheers, -- Alan From pgsql-performance-owner@postgresql.org Wed Nov 23 00:07:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 37F90DAF8D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 00:07:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61176-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 04:07:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8348AD9585 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 00:07:26 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAN47PGj010136; Tue, 22 Nov 2005 23:07:25 -0500 (EST) To: Ralph Mason <ralph.mason@telogis.com> cc: pgsql-performance@postgresql.org Subject: Re: Binary Refcursor possible? In-reply-to: <4383E459.2070906@telogis.com> References: <4383E459.2070906@telogis.com> Comments: In-reply-to Ralph Mason <ralph.mason@telogis.com> message dated "Wed, 23 Nov 2005 16:39:05 +1300" Date: Tue, 22 Nov 2005 23:07:25 -0500 Message-ID: <10135.1132718845@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/464 X-Sequence-Number: 15721 Ralph Mason <ralph.mason@telogis.com> writes: > Is there any way I can say make ret a binary cursor? It's possible to determine that at the protocol level, if you're using V3 protocol; but whether this is exposed to an application depends on what client-side software you are using. Which you didn't say. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Nov 23 00:14:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7A50DDC04F for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 00:14:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61652-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 04:14:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nz.telogis.com (unknown [203.98.10.169]) by svr1.postgresql.org (Postfix) with ESMTP id D7FCDDC52E for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 00:14:38 -0400 (AST) Received: from [192.168.3.1] ([192.168.3.1]) by nz.telogis.com with esmtp; Wed, 23 Nov 2005 17:14:37 +1300 id 007321A5.4383ECAD.00001865 Message-ID: <4383ECAE.8050109@telogis.com> Date: Wed, 23 Nov 2005 17:14:38 +1300 From: Ralph Mason <ralph.mason@telogis.com> User-Agent: Thunderbird 1.4 (Windows/20050908) MIME-Version: 1.0 To: Tom Lane <tgl@sss.pgh.pa.us> CC: pgsql-performance@postgresql.org Subject: Re: Binary Refcursor possible? References: <4383E459.2070906@telogis.com> <10135.1132718845@sss.pgh.pa.us> In-Reply-To: <10135.1132718845@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/465 X-Sequence-Number: 15722 Tom Lane wrote: > Ralph Mason <ralph.mason@telogis.com> writes: > >> Is there any way I can say make ret a binary cursor? >> > > It's possible to determine that at the protocol level, if you're using > V3 protocol; but whether this is exposed to an application depends on > what client-side software you are using. Which you didn't say. > > regards, tom lane > This is probably in the documentation but I couldn't find it. All I could see is that if you open a cursor for binary it would return with a type of binary rather than text in the row data messages. The RowDescription format code is always text, and the cursor thing is the only way I could see to change that. Is there some setting I can set that will make it return all data as binary? The dream would also be that I could ask the server it's native byte order and have it send me binary data in it's native byte order. Nice and fast. :-0 Ralph From pgsql-performance-owner@postgresql.org Wed Nov 23 00:21:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C97B4DB1EE for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 00:21:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65817-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 04:21:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 8E0C4DB1C7 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 00:21:46 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Eem8X-0003Yu-00; Tue, 22 Nov 2005 23:21:37 -0500 To: Alan Stange <stange@rentec.com> Cc: Bruce Momjian <pgman@candle.pha.pa.us>, Greg Stark <gsstark@mit.edu>, Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <200511230013.jAN0DKV10698@candle.pha.pa.us> <4383E89C.8040200@rentec.com> In-Reply-To: <4383E89C.8040200@rentec.com> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 22 Nov 2005 23:21:36 -0500 Message-ID: <87d5ksm1tb.fsf@stark.xeocode.com> Lines: 54 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/466 X-Sequence-Number: 15723 Alan Stange <stange@rentec.com> writes: > For sequential scans, you do have a background reader. It's the kernel. As > long as you don't issue a seek() between read() calls, the kernel will get the > hint about sequential IO and begin to perform a read ahead for you. This is > where the above analysis isn't quite right: while postgresql is processing the > returned data from the read() call, the kernel has also issued reads as part of > the read ahead, keeping the device busy while the cpu is busy. (I'm assuming > these details for Linux; Solaris/UFS does work this way). Issue one seek on > the file and the read ahead algorithm will back off for a while. This was my > point about some descriptions of how the system works not being sensible. Well that's certainly the hope. But we don't know that this is actually as effective as you assume it is. It's awfully hard in the kernel to make much more than a vague educated guess about what kind of readahead would actually help. This is especially true when a file isn't really being accessed in a sequential fashion as Postgres may well do if, for example, multiple backends are reading the same file. And as you pointed out it doesn't help at all for random access index scans. > If your goal is sequential IO, then one must use larger block sizes. No one > would use 8KB IO for achieving high sequential IO rates. Simply put, read() > is about the slowest way to get 8KB of data. Switching to 32KB blocks > reduces all the system call overhead by a large margin. Larger blocks would be > better still, up to the stripe size of your mirror. (Of course, you're using > a mirror and not raid5 if you care about performance.) Switching to 32kB blocks throughout Postgres has pros but also major cons, not the least is *extra* i/o for random access read patterns. One of the possible advantages of the suggestions that were made, the ones you're shouting down, would actually be the ability to use 32kB scatter/gather reads without necessarily switching block sizes. (Incidentally, your parenthetical comment is a bit confused. By "mirror" I imagine you're referring to raid1+0 since mirrors alone, aka raid1, aren't a popular way to improve performance. But raid5 actually performs better than raid1+0 for sequential reads.) > Does postgresql use the platform specific memcpy() in libc? Some care might > be needed to ensure that the memory blocks within postgresql are all > properly aligned to make sure that one isn't ping-ponging cache lines around > (usually done by padding the buffer sizes by an extra 32 bytes or L1 line > size). Whatever you do, all the usual high performance computing tricks > should be used prior to considering any rewriting of major code sections. So your philosophy is to worry about microoptimizations before worrying about architectural issues? -- greg From pgsql-performance-owner@postgresql.org Wed Nov 23 00:53:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAF4ADA135 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 00:53:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67139-09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 04:53:38 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id CB893D9585 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 00:53:36 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jAN4rGs24421; Tue, 22 Nov 2005 23:53:16 -0500 (EST) From: Bruce Momjian <pgman@candle.pha.pa.us> Message-Id: <200511230453.jAN4rGs24421@candle.pha.pa.us> Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <4383E89C.8040200@rentec.com> To: Alan Stange <stange@rentec.com> Date: Tue, 22 Nov 2005 23:53:16 -0500 (EST) CC: Greg Stark <gsstark@mit.edu>, Luke Lonergan <llonergan@greenplum.com>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.026 required=5 tests=[AWL=0.026] X-Spam-Score: 0.026 X-Spam-Level: X-Archive-Number: 200511/467 X-Sequence-Number: 15724 Alan Stange wrote: > Bruce Momjian wrote: > > Right now the file system will do read-ahead for a heap scan (but not an > > index scan), but even then, there is time required to get that kernel > > block into the PostgreSQL shared buffers, backing up Luke's observation > > of heavy memcpy() usage. > > > > So what are our options? mmap()? I have no idea. Seems larger page > > size does help. > For sequential scans, you do have a background reader. It's the > kernel. As long as you don't issue a seek() between read() calls, the I guess you missed my text of "Right now the file system will do read-ahead", meaning the kernel. > I don't think the memcpy of data from the kernel to userspace is that > big of an issue right now. dd and all the high end network interfaces > manage OK doing it, so I'd expect postgresql to do all right with it now > yet too. Direct IO will avoid that memcpy, but then you also don't get > any caching of the files in memory. I'd be more concerned about any > memcpy calls or general data management within postgresql. Does > postgresql use the platform specific memcpy() in libc? Some care might > be needed to ensure that the memory blocks within postgresql are all > properly aligned to make sure that one isn't ping-ponging cache lines > around (usually done by padding the buffer sizes by an extra 32 bytes or > L1 line size). Whatever you do, all the usual high performance > computing tricks should be used prior to considering any rewriting of > major code sections. We have dealt with alignment and MemCpy is what we used for small-sized copies to reduce function call overhead. If you want to improve it, feel free to take a look. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Nov 23 01:05:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 80B84D8292 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 01:05:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75266-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 05:05:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id D12E2D80BC for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 01:05:25 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jAN55I0r057016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Nov 2005 22:05:21 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jAN55Idq049141; Tue, 22 Nov 2005 22:05:18 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jAN55Hrj049140; Tue, 22 Nov 2005 22:05:17 -0700 (MST) (envelope-from mfuhr) Date: Tue, 22 Nov 2005 22:05:17 -0700 From: Michael Fuhr <mike@fuhr.org> To: Yves Vindevogel <yves.vindevogel@implements.be> Cc: pgsql-performance@postgresql.org Subject: Re: Stored Procedure Message-ID: <20051123050517.GA49008@winnie.fuhr.org> References: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> <20051122184119.M48526@contactbda.com> <33f74d2a046b89d119c349e82b7398de@implements.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33f74d2a046b89d119c349e82b7398de@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/468 X-Sequence-Number: 15725 On Tue, Nov 22, 2005 at 11:17:41PM +0100, Yves Vindevogel wrote: > But this does not work without the second line, right ? What second line? Instead of returning a specific composite type a function can return RECORD or SETOF RECORD; in these cases the query must provide a column definition list. > BTW, the thing returned is not a record. It's a bunch of fields, not a > complete record or fields of multiple records. What distinction are you making between a record and a bunch of fields? What exactly would you like the function to return? > I'm not so sure it works. Did you try it? If you did and it didn't work then please post exactly what you tried and explain what happened and how that differed from what you'd like. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Wed Nov 23 01:13:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5500AD6D07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 01:13:22 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81019-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 05:13:20 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 95940D7E05 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 01:13:19 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jAN5DEpb057022 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Nov 2005 22:13:16 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jAN5DEXd049202; Tue, 22 Nov 2005 22:13:14 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jAN5DE0t049201; Tue, 22 Nov 2005 22:13:14 -0700 (MST) (envelope-from mfuhr) Date: Tue, 22 Nov 2005 22:13:14 -0700 From: Michael Fuhr <mike@fuhr.org> To: Yves Vindevogel <yves.vindevogel@implements.be> Cc: pgsql-performance@postgresql.org Subject: Re: Stored Procedure Message-ID: <20051123051314.GB49008@winnie.fuhr.org> References: <e28aace15975ef9972fdd65ceb6e0ce8@implements.be> <20051122185941.GA18102@winnie.fuhr.org> <06612338d301f531643d479a819e4632@implements.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <06612338d301f531643d479a819e4632@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/469 X-Sequence-Number: 15726 On Tue, Nov 22, 2005 at 11:20:09PM +0100, Yves Vindevogel wrote: > 8.1, hmm, that's brand new. Yes, but give it a try, at least in a test environment. The more people use it, the more we'll find out if it has any problems. > But, still, it's quite some coding for a complete recordset, not ? How so? The examples I posted are almost identical to how you'd return a composite type created with CREATE TYPE or SETOF that type, except that you declare the return columns as INOUT or OUT parameters and you no longer have to create a separate type. If you're referring to how I wrote two sets of assignments and RETURN NEXT statements, you don't have to do it that way: you can use a loop, just as you would with any other set-returning function. -- Michael Fuhr From pgsql-performance-owner@postgresql.org Wed Nov 23 13:51:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 44449DBA49 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 13:51:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49347-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 17:51:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id 330A6DBA1E for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 13:51:40 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Wed, 23 Nov 2005 12:51:32 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Nov 2005 12:51:08 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Wed, 23 Nov 2005 12:51:08 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 23 Nov 2005 09:51:06 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Bruce Momjian" <pgman@candle.pha.pa.us>, "Greg Stark" <gsstark@mit.edu> cc: stange@rentec.com, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFA9EC0A.14580%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvwsL8LhmQH2wmSB604BAv4GFvlwAk7dXr In-Reply-To: <200511230013.jAN0DKV10698@candle.pha.pa.us> MIME-Version: 1.0 X-OriginalArrivalTime: 23 Nov 2005 17:51:08.0974 (UTC) FILETIME=[7C182CE0:01C5F056] X-WSS-ID: 6F9A73A819O1733739-18-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.386 required=5 tests=[AWL=-0.103, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.386 X-Spam-Level: ** X-Archive-Number: 200511/470 X-Sequence-Number: 15727 Bruce, On 11/22/05 4:13 PM, "Bruce Momjian" <pgman@candle.pha.pa.us> wrote: > Perfect summary. We have a background writer now. Ideally we would > have a background reader, that reads-ahead blocks into the buffer cache. > The problem is that while there is a relatively long time between a > buffer being dirtied and the time it must be on disk (checkpoint time), > the read-ahead time is much shorter, requiring some kind of quick > "create a thread" approach that could easily bog us down as outlined > above. Yes, the question is "how much read-ahead buffer is needed to equate to the 38% of I/O wait time in the current executor profile?" The idea of asynchronous buffering would seem appropriate if the executor would use the 38% of time as useful work. A background reader is an interesting approach - it would require admin management of buffers where AIO would leave that in the kernel. The advantage over AIO would be more universal platform support I suppose? > Right now the file system will do read-ahead for a heap scan (but not an > index scan), but even then, there is time required to get that kernel > block into the PostgreSQL shared buffers, backing up Luke's observation > of heavy memcpy() usage. As evidenced by the 16MB readahead setting still resulting in only 36% IO wait. > So what are our options? mmap()? I have no idea. Seems larger page > size does help. Not sure about that, we used to run with 32KB page size and I didn't see a benefit on seq scan at all. I haven't seen tests in this thread that compare 8K to 32K. - Luke From pgsql-performance-owner@postgresql.org Wed Nov 23 13:54:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 27C3ED7AD7 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 13:54:03 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49888-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 17:54:01 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id 162E3DBA50 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 13:53:59 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Wed, 23 Nov 2005 12:53:52 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Nov 2005 12:53:09 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Wed, 23 Nov 2005 12:53:08 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 23 Nov 2005 09:53:04 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Alan Stange" <stange@rentec.com>, "Postgresql Performance" <pgsql-performance@postgresql.org> Message-ID: <BFA9EC80.14581%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXv4jqsmv9TrNIXTUGC/P0cEau11wAdIX6t In-Reply-To: <4383E89C.8040200@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 23 Nov 2005 17:53:09.0510 (UTC) FILETIME=[C3F08260:01C5F056] X-WSS-ID: 6F9A732719O1735241-30-01 Content-Type: multipart/alternative; boundary=B_3215584385_16349364 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.401 required=5 tests=[AWL=-0.089, HTML_MESSAGE=0.001, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.401 X-Spam-Level: ** X-Archive-Number: 200511/471 X-Sequence-Number: 15728 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215584385_16349364 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Alan, Why not contribute something - put up proof of your stated 8KB versus 32KB page size improvement. - Luke --B_3215584385_16349364 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Alan,= <BR> <BR> Why not contribute something - put up proof of your stated 8KB versus 32KB = page size improvement.<BR> <BR> - Luke</SPAN></FONT> </BODY> </HTML> --B_3215584385_16349364-- From pgsql-performance-owner@postgresql.org Wed Nov 23 14:15:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B145DBA7B for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 14:15:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50188-07-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 18:15:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by svr1.postgresql.org (Postfix) with ESMTP id 1F8E6DBA81 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 14:14:56 -0400 (AST) Received: from [192.168.0.4] (unknown [84.12.200.148]) by smtp.nildram.co.uk (Postfix) with ESMTP id 8E25825E762; Wed, 23 Nov 2005 18:14:50 +0000 (GMT) Subject: Re: High context switches occurring From: Simon Riggs <simon@2ndquadrant.com> To: Anjan Dave <adave@vantage.com> Cc: Scott Marlowe <smarlowe@g2switchworks.com>, Tom Lane <tgl@sss.pgh.pa.us>, Vivek Khera <vivek@khera.org>, Postgresql Performance <pgsql-performance@postgresql.org> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E78@vt-pe2550-001.vantage.vantage.com> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E78@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain Date: Wed, 23 Nov 2005 18:13:58 +0000 Message-Id: <1132769638.4347.7.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 (2.2.2-5) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/472 X-Sequence-Number: 15729 On Tue, 2005-11-22 at 18:17 -0500, Anjan Dave wrote: > It's mostly a 'read' application, I increased the vm.max-readahead to > 2048 from the default 256, after which I've not seen the CS storm, > though it could be incidental. Can you verify this, please? Turn it back down again, try the test, then reset and try the test. If that is a repeatable way of recreating one manifestation of the problem then we will be further ahead than we are now. Thanks, Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Nov 23 14:33:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 86D4AD8A19 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 14:33:17 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53119-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 18:33:16 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by svr1.postgresql.org (Postfix) with ESMTP id 52DB9D7AD7 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 14:33:13 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: High context switches occurring Date: Wed, 23 Nov 2005 13:33:09 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E7B@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcXwWdTR75D6bDAeR6S1VGqN2qlaJAAABtFg From: "Anjan Dave" <adave@vantage.com> To: "Simon Riggs" <simon@2ndquadrant.com> Cc: "Scott Marlowe" <smarlowe@g2switchworks.com>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Vivek Khera" <vivek@khera.org>, "Postgresql Performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/473 X-Sequence-Number: 15730 The offending SELECT query that invoked the CS storm was optimized by folks here last night, so it's hard to say if the VM setting made a difference. I'll give it a try anyway. Thanks, Anjan -----Original Message----- From: Simon Riggs [mailto:simon@2ndquadrant.com]=20 Sent: Wednesday, November 23, 2005 1:14 PM To: Anjan Dave Cc: Scott Marlowe; Tom Lane; Vivek Khera; Postgresql Performance Subject: Re: [PERFORM] High context switches occurring On Tue, 2005-11-22 at 18:17 -0500, Anjan Dave wrote: > It's mostly a 'read' application, I increased the vm.max-readahead to > 2048 from the default 256, after which I've not seen the CS storm, > though it could be incidental. Can you verify this, please? Turn it back down again, try the test, then reset and try the test. If that is a repeatable way of recreating one manifestation of the problem then we will be further ahead than we are now. Thanks, Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Nov 23 17:33:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A38FADBA31 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 17:33:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49953-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 21:33:31 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.244]) by svr1.postgresql.org (Postfix) with ESMTP id 96990DAF10 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 17:33:26 -0400 (AST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: High context switches occurring Date: Wed, 23 Nov 2005 16:33:24 -0500 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785027001E7@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High context switches occurring Thread-Index: AcXwWdTR75D6bDAeR6S1VGqN2qlaJAAABtFgAAbJl0A= From: "Anjan Dave" <adave@vantage.com> To: "Anjan Dave" <adave@vantage.com>, "Simon Riggs" <simon@2ndquadrant.com> Cc: "Scott Marlowe" <smarlowe@g2switchworks.com>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Vivek Khera" <vivek@khera.org>, "Postgresql Performance" <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/474 X-Sequence-Number: 15731 Simon, I tested it by running two of those simultaneous queries (the 'unoptimized' one), and it doesn't make any difference whether vm.max-readahead is 256 or 2048...the modified query runs in a snap. Thanks, Anjan -----Original Message----- From: Anjan Dave=20 Sent: Wednesday, November 23, 2005 1:33 PM To: Simon Riggs Cc: Scott Marlowe; Tom Lane; Vivek Khera; Postgresql Performance Subject: Re: [PERFORM] High context switches occurring The offending SELECT query that invoked the CS storm was optimized by folks here last night, so it's hard to say if the VM setting made a difference. I'll give it a try anyway. Thanks, Anjan -----Original Message----- From: Simon Riggs [mailto:simon@2ndquadrant.com]=20 Sent: Wednesday, November 23, 2005 1:14 PM To: Anjan Dave Cc: Scott Marlowe; Tom Lane; Vivek Khera; Postgresql Performance Subject: Re: [PERFORM] High context switches occurring On Tue, 2005-11-22 at 18:17 -0500, Anjan Dave wrote: > It's mostly a 'read' application, I increased the vm.max-readahead to > 2048 from the default 256, after which I've not seen the CS storm, > though it could be incidental. Can you verify this, please? Turn it back down again, try the test, then reset and try the test. If that is a repeatable way of recreating one manifestation of the problem then we will be further ahead than we are now. Thanks, Best Regards, Simon Riggs ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend From pgsql-performance-owner@postgresql.org Wed Nov 23 18:00:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D26D7DBA92 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 18:00:42 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80479-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 22:00:44 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 268D9DBA4E for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 18:00:39 -0400 (AST) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id jANM0T2v021183 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Nov 2005 17:00:30 -0500 (EST) X-Source: non-mednet Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id jANM0ZvF014858; Wed, 23 Nov 2005 17:00:35 -0500 (EST) Message-ID: <4384E685.4060108@rentec.com> Date: Wed, 23 Nov 2005 17:00:37 -0500 From: Alan Stange <stange@rentec.com> Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Luke Lonergan <llonergan@greenplum.com> CC: Postgresql Performance <pgsql-performance@postgresql.org> Subject: Re: Hardware/OS recommendations for large databases ( References: <BFA9EC80.14581%llonergan@greenplum.com> In-Reply-To: <BFA9EC80.14581%llonergan@greenplum.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Logged: Logged by unicorn.rentec.com as jANM0T2v021183 at Wed Nov 23 17:00:30 2005 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.007 required=5 tests=[AWL=0.007] X-Spam-Score: 0.007 X-Spam-Level: X-Archive-Number: 200511/475 X-Sequence-Number: 15732 Luke Lonergan wrote: > Why not contribute something - put up proof of your stated 8KB versus > 32KB page size improvement. I did observe that 32KB block sizes were a significant win "for our usage patterns". It might be a win for any of the following reasons: 0) The preliminaries: ~300GB database with about ~50GB daily turnover. Our data is fairly reasonably grouped. If we're getting one item on a page we're usually looking at the other items as well. 1) we can live with a smaller FSM size. We were often leaking pages with a 10M page FSM setting. With 32K pages, a 10M FSM size is sufficient. Yes, the solution to this is "run vacuum more often", but when the vacuum was taking 10 hours at a time, that was hard to do. 2) The typical datum size in our largest table is about 2.8KB, which is more than 1/4 page size thus resulting in the use of a toast table. Switching to 32KB pages allows us to get a decent storage of this data into the main tables, thus avoiding another table and associated large index. Not having the extra index in memory for a table with 90M rows is probably beneficial. 3) vacuum time has been substantially reduced. Vacuum analyze now run in the 2 to 3 hour range depending on load. 4) less cpu time spent in the kernel. We're basically doing 1/4 as many system calls. Overall the system has now been working well. We used to see the database being a bottleneck at times, but now it's keeping up nicely. Hope this helps. Happy Thanksgiving! -- Alan From pgsql-performance-owner@postgresql.org Wed Nov 23 21:23:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 395B3DBAF8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 21:23:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14770-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 01:23:56 +0000 (GMT) X-Greylist: delayed 03:08:37.873948 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 1E678DBAC1 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 21:23:50 -0400 (AST) Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) by svr2.postgresql.org (Postfix) with ESMTP id 70A87F0B82 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 22:15:14 +0000 (GMT) Received: from [192.168.0.1] (cev75-1-81-57-249-136.fbx.proxad.net [81.57.249.136]) (authenticated bits=0) by mail.rilk.com (8.13.0/8.13.0) with ESMTP id jANMEmM6016783 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 23:15:02 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v746.2) Content-Transfer-Encoding: quoted-printable Message-Id: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Pailloncy Jean-Gerard <jg@rilk.com> Subject: 8.1 count(*) distinct: IndexScan/SeqScan Date: Wed, 23 Nov 2005 23:14:47 +0100 X-Mailer: Apple Mail (2.746.2) X-DCC-dmv.com-Metrics: mail.rilk.com 1181; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/476 X-Sequence-Number: 15733 Hi, PostgreSQL 8.1 fresh install on a freshly installed OpenBSD 3.8 box. postgres=3D# CREATE DATABASE test; CREATE DATABASE postgres=3D# create table test (id serial, val integer); NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for =20= serial column "test.id" CREATE TABLE postgres=3D# create unique index testid on test (id); CREATE INDEX postgres=3D# create index testval on test (val); CREATE INDEX postgres=3D# insert into test (val) values (round(random()=20 *1024*1024*1024)); INSERT 0 1 [...] insert many random values postgres=3D# vaccum full verbose analyze; postgres=3D# select count(1) from test; count --------- 2097152 (1 row) postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ------------------ Aggregate (cost=3D66328.72..66328.73 rows=3D1 width=3D0) -> Unique (cost=3D0.00..40114.32 rows=3D2097152 width=3D8) -> Index Scan using testval on test (cost=3D0.00..34871.44 =20= rows=3D2097152 width=3D8) (3 rows) postgres=3D# set enable_indexscan=3Doff; postgres=3D# explain analyze select count(*) from (select distinct on =20= (val) * from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ------------------------------------------------------------ Aggregate (cost=3D280438.64..280438.65 rows=3D1 width=3D0) (actual =20 time=3D39604.107..39604.108 rows=3D1 loops=3D1) -> Unique (cost=3D243738.48..254224.24 rows=3D2097152 width=3D8) =20= (actual time=3D30281.004..37746.488 rows=3D2095104 loops=3D1) -> Sort (cost=3D243738.48..248981.36 rows=3D2097152 width=3D8)= =20 (actual time=3D30280.999..33744.197 rows=3D2097152 loops=3D1) Sort Key: test.val -> Seq Scan on test (cost=3D0.00..23537.52 =20 rows=3D2097152 width=3D8) (actual time=3D11.550..3262.433 rows=3D2097152 = =20 loops=3D1) Total runtime: 39624.094 ms (6 rows) postgres=3D# set enable_indexscan=3Don; postgres=3D# explain analyze select count(*) from (select distinct on =20= (val) * from test where val<10000000) as foo; =20 QUERY PLAN ------------------------------------------------------------------------=20= ----------------------------------------------------------------------- Aggregate (cost=3D4739.58..4739.59 rows=3D1 width=3D0) (actual =20 time=3D4686.472..4686.473 rows=3D1 loops=3D1) -> Unique (cost=3D4380.56..4483.14 rows=3D20515 width=3D8) (actual = =20 time=3D4609.046..4669.289 rows=3D19237 loops=3D1) -> Sort (cost=3D4380.56..4431.85 rows=3D20515 width=3D8) =20 (actual time=3D4609.041..4627.976 rows=3D19255 loops=3D1) Sort Key: test.val -> Bitmap Heap Scan on test (cost=3D88.80..2911.24 =20 rows=3D20515 width=3D8) (actual time=3D130.954..4559.244 rows=3D19255 = loops=3D1) Recheck Cond: (val < 10000000) -> Bitmap Index Scan on testval =20 (cost=3D0.00..88.80 rows=3D20515 width=3D0) (actual = time=3D120.041..120.041 =20 rows=3D19255 loops=3D1) Index Cond: (val < 10000000) Total runtime: 4690.513 ms (9 rows) postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test where val<100000000) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ----------------- Aggregate (cost=3D16350.20..16350.21 rows=3D1 width=3D0) -> Unique (cost=3D0.00..13748.23 rows=3D208158 width=3D8) -> Index Scan using testval on test (cost=3D0.00..13227.83 =20= rows=3D208158 width=3D8) Index Cond: (val < 100000000) (4 rows) postgres=3D# set enable_indexscan=3Doff; postgres=3D# explain analyze select count(*) from (select distinct on =20= (val) * from test where val<100000000) as foo; =20= QUERY PLAN ------------------------------------------------------------------------=20= ------------------------------------------------------------------------=20= ---- Aggregate (cost=3D28081.27..28081.28 rows=3D1 width=3D0) (actual =20 time=3D6444.650..6444.651 rows=3D1 loops=3D1) -> Unique (cost=3D24438.50..25479.29 rows=3D208158 width=3D8) = (actual =20 time=3D5669.118..6277.206 rows=3D194142 loops=3D1) -> Sort (cost=3D24438.50..24958.89 rows=3D208158 width=3D8) =20= (actual time=3D5669.112..5852.351 rows=3D194342 loops=3D1) Sort Key: test.val -> Bitmap Heap Scan on test (cost=3D882.55..6050.53 =20= rows=3D208158 width=3D8) (actual time=3D1341.114..4989.840 rows=3D194342 = =20 loops=3D1) Recheck Cond: (val < 100000000) -> Bitmap Index Scan on testval =20 (cost=3D0.00..882.55 rows=3D208158 width=3D0) (actual =20 time=3D1339.707..1339.707 rows=3D194342 loops=3D1) Index Cond: (val < 100000000) Total runtime: 6487.114 ms (9 rows) postgres=3D# explain analyze select count(*) from (select distinct on =20= (val) * from test where val<750000000) as foo; Q=20= UERY PLAN ------------------------------------------------------------------------=20= ------------------------------------------------------------------------=20= ------- Aggregate (cost=3D204576.53..204576.54 rows=3D1 width=3D0) (actual =20 time=3D35718.935..35718.936 rows=3D1 loops=3D1) -> Unique (cost=3D178717.28..186105.64 rows=3D1477671 width=3D8) =20= (actual time=3D29465.856..34459.640 rows=3D1462348 loops=3D1) -> Sort (cost=3D178717.28..182411.46 rows=3D1477671 width=3D8)= =20 (actual time=3D29465.853..31658.056 rows=3D1463793 loops=3D1) Sort Key: test.val -> Bitmap Heap Scan on test (cost=3D6256.85..27293.73 =20= rows=3D1477671 width=3D8) (actual time=3D8316.676..11561.018 = rows=3D1463793 =20 loops=3D1) Recheck Cond: (val < 750000000) -> Bitmap Index Scan on testval =20 (cost=3D0.00..6256.85 rows=3D1477671 width=3D0) (actual =20 time=3D8305.963..8305.963 rows=3D1463793 loops=3D1) Index Cond: (val < 750000000) Total runtime: 35736.167 ms (9 rows) postgres=3D# explain analyze select count(*) from (select distinct on =20= (val) * from test where val<800000000) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ------------------------------------------------------------ Aggregate (cost=3D217582.20..217582.21 rows=3D1 width=3D0) (actual =20 time=3D28718.331..28718.332 rows=3D1 loops=3D1) -> Unique (cost=3D190140.72..197981.14 rows=3D1568084 width=3D8) =20= (actual time=3D22175.170..27380.343 rows=3D1559648 loops=3D1) -> Sort (cost=3D190140.72..194060.93 rows=3D1568084 width=3D8)= =20 (actual time=3D22175.165..24451.892 rows=3D1561181 loops=3D1) Sort Key: test.val -> Seq Scan on test (cost=3D0.00..28780.40 =20 rows=3D1568084 width=3D8) (actual time=3D13.130..3358.923 rows=3D1561181 = =20 loops=3D1) Filter: (val < 800000000) Total runtime: 28735.264 ms (7 rows) I did not post any result for the indexscan plan, because it takes to =20= much time. Why the stupid indexscan plan on the whole table ? Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Wed Nov 23 21:51:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 02612DAE89 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 21:51:57 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18655-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 01:52:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id C3E06DBA59 for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 21:51:52 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Wed, 23 Nov 2005 20:51:42 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Nov 2005 20:50:59 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Wed, 23 Nov 2005 20:50:59 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 23 Nov 2005 17:50:57 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: stange@rentec.com cc: "Postgresql Performance" <pgsql-performance@postgresql.org> Message-ID: <BFAA5C81.145DB%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXweV01iY4lbERPReOGq+8vxhxRgAAICXgV In-Reply-To: <4384E685.4060108@rentec.com> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Nov 2005 01:50:59.0537 (UTC) FILETIME=[849B7410:01C5F099] X-WSS-ID: 6F9BC32419O2005981-11-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.794 required=5 tests=[AWL=0.541, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.794 X-Spam-Level: * X-Archive-Number: 200511/477 X-Sequence-Number: 15734 Alan, On 11/23/05 2:00 PM, "Alan Stange" <stange@rentec.com> wrote: > Luke Lonergan wrote: >> Why not contribute something - put up proof of your stated 8KB versus >> 32KB page size improvement. > > I did observe that 32KB block sizes were a significant win "for our > usage patterns". It might be a win for any of the following reasons: > (* big snip *) Though all of what you relate is interesting, it seems irrelevant to your earlier statement here: >> Alan Stange <stange@rentec.com> writes: >> If your goal is sequential IO, then one must use larger block sizes. >> No one would use 8KB IO for achieving high sequential IO rates. Simply >> put, read() is about the slowest way to get 8KB of data. Switching >> to 32KB blocks reduces all the system call overhead by a large margin. >> Larger blocks would be better still, up to the stripe size of your >> mirror. (Of course, you're using a mirror and not raid5 if you care >> about performance.) And I am interested in seeing if your statement is correct. Do you have any proof of this to share? - Luke From pgsql-performance-owner@postgresql.org Wed Nov 23 22:29:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 350F7DAE89 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 22:29:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19797-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 02:29:59 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 48D7DDA86D for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 22:29:52 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Wed, 23 Nov 2005 21:29:51 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Nov 2005 21:29:50 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Wed, 23 Nov 2005 21:29:50 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Wed, 23 Nov 2005 18:29:49 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz> cc: pgsql-performance@postgresql.org, "eng@intranet.greenplum.com" <eng@intranet.greenplum.com> Message-ID: <BFAA659D.145E5%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvIxdwfLDwWrP8Q669kHxJ85F1twBe9mid In-Reply-To: <4382A840.3030401@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Nov 2005 02:29:50.0935 (UTC) FILETIME=[F23A8E70:01C5F09E] X-WSS-ID: 6F9BFA152UO2837356-01-01 Content-Type: multipart/alternative; boundary=B_3215615389_18058204 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.387 required=5 tests=[AWL=-0.103, HTML_MESSAGE=0.001, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.387 X-Spam-Level: ** X-Archive-Number: 200511/478 X-Sequence-Number: 15735 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215615389_18058204 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Mark, This is an excellent idea =AD unfortunately I=B9m in Maui right now (Mahalo!) and I=B9m not getting to testing with this. My first try was with 8.0.3 and it=B9s an 8.1 function I presume. Not to be lazy =AD but any hint as to how to do the same thing for 8.0? - Luke On 11/21/05 9:10 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > Luke Lonergan wrote: >=20 >> > So that leaves the question - why not more than 64% of the I/O scan ra= te? >> > And why is it a flat 64% as the I/O subsystem increases in speed from >> > 333-400MB/s? >> > >=20 > It might be interesting to see what effect reducing the cpu consumption > entailed by the count aggregation has - by (say) writing a little bit > of code to heap scan the desired relation (sample attached). >=20 > Cheers >=20 > Mark >=20 >=20 >=20 >=20 >=20 >=20 > /* > * fastcount.c > * > * Do a count that uses considerably less CPU time than an aggregate. > */ >=20 > #include "postgres.h" >=20 > #include "funcapi.h" > #include "access/heapam.h" > #include "catalog/namespace.h" > #include "utils/builtins.h" >=20 >=20 > extern Datum fastcount(PG_FUNCTION_ARGS); >=20 >=20 > PG_FUNCTION_INFO_V1(fastcount); > Datum > fastcount(PG_FUNCTION_ARGS) > { > text *relname =3D PG_GETARG_TEXT_P(0); > RangeVar *relrv; > Relation rel; > HeapScanDesc scan; > HeapTuple tuple; > int64 result =3D 0; >=20 > /* Use the name to get a suitable range variable and open the relation. = */ > relrv =3D makeRangeVarFromNameList(textToQualifiedNameList(relname)); > rel =3D heap_openrv(relrv, AccessShareLock); >=20 > /* Start a heap scan on the relation. */ > scan =3D heap_beginscan(rel, SnapshotNow, 0, NULL); > while ((tuple =3D heap_getnext(scan, ForwardScanDirection)) !=3D NULL) > { > result++; > } >=20 > /* End the scan and close up the relation. */ > heap_endscan(scan); > heap_close(rel, AccessShareLock); >=20 >=20 > PG_RETURN_INT64(result); > } --B_3215615389_18058204 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <HTML> <HEAD> <TITLE>Re: [PERFORM] Hardware/OS recommendations for large databases (</TIT= LE> </HEAD> <BODY> <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:14.0px'>Mark,= <BR> <BR> This is an excellent idea – unfortunately I’m in Maui right now= (Mahalo!) and I’m not getting to testing with this.  My first tr= y was with 8.0.3 and it’s an 8.1 function I presume.<BR> <BR> Not to be lazy – but any hint as to how to do the same thing for 8.0?= <BR> <BR> - Luke<BR> <BR> <BR> On 11/21/05 9:10 PM, "Mark Kirkwood" <markir@paradise.net.nz&g= t; wrote:<BR> <BR> </SPAN></FONT><BLOCKQUOTE><FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYL= E=3D'font-size:14.0px'>Luke Lonergan wrote:<BR> <BR> > So that leaves the question - why not more than 64% of the I/O scan ra= te?<BR> > And why is it a flat 64% as the I/O subsystem increases in speed from<= BR> > 333-400MB/s?<BR> ><BR> <BR> It might be interesting to see what effect reducing the cpu consumption<BR>   entailed by the count aggregation has - by (say) writing a litt= le bit<BR> of code to heap scan the desired relation (sample attached).<BR> <BR> Cheers<BR> <BR> Mark<BR> <BR> <BR> <BR> <BR> <BR> <HR ALIGN=3DCENTER SIZE=3D"3" WIDTH=3D"95%"></SPAN></FONT><FONT SIZE=3D"2"><FONT FA= CE=3D"Monaco, Courier New"><SPAN STYLE=3D'font-size:12.0px'>/*<BR>  * fastcount.c<BR>  *<BR>  * Do a count that uses considerably less CPU time than an aggregate.<= BR>  */<BR> <BR> #include "postgres.h"<BR> <BR> #include "funcapi.h"<BR> #include "access/heapam.h"<BR> #include "catalog/namespace.h"<BR> #include "utils/builtins.h"<BR> <BR> <BR> extern Datum fastcount(PG_FUNCTION_ARGS);<BR> <BR> <BR> PG_FUNCTION_INFO_V1(fastcount);<BR> Datum<BR> fastcount(PG_FUNCTION_ARGS)<BR> {<BR>  text    *relname =3D PG_GETARG_TEXT_P(0);<BR>  RangeVar   *relrv;<BR>  Relation rel;<BR>  HeapScanDesc scan;<BR>  HeapTuple tuple;<BR>  int64  result =3D 0;<BR> <BR>  /* Use the name to get a suitable range variable and open the relatio= n. */<BR>  relrv =3D makeRangeVarFromNameList(textToQualifiedNameList(relname));<B= R>  rel =3D heap_openrv(relrv, AccessShareLock);<BR> <BR>  /* Start a heap scan on the relation. */<BR>  scan =3D heap_beginscan(rel, SnapshotNow, 0, NULL);<BR>  while ((tuple =3D heap_getnext(scan, ForwardScanDirection)) !=3D NULL)<BR= >  {<BR>   result++;<BR>  }<BR> <BR>  /* End the scan and close up the relation. */<BR>  heap_endscan(scan);<BR>  heap_close(rel, AccessShareLock);<BR> <BR> <BR>  PG_RETURN_INT64(result);<BR> }<BR> </SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE=3D"2"><FONT FACE=3D"Monaco, Courie= r New"><SPAN STYLE=3D'font-size:12.0px'><BR> </SPAN></FONT></FONT> </BODY> </HTML> --B_3215615389_18058204-- From pgsql-performance-owner@postgresql.org Wed Nov 23 23:14:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 86D6ADBB09 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 23 Nov 2005 23:14:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31649-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 03:14:57 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AD883DBA4E for <pgsql-performance@postgresql.org>; Wed, 23 Nov 2005 23:14:51 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAO3EuwT007007; Wed, 23 Nov 2005 22:14:56 -0500 (EST) To: Pailloncy Jean-Gerard <jg@rilk.com> cc: pgsql-performance@postgresql.org Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan In-reply-to: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> Comments: In-reply-to Pailloncy Jean-Gerard <jg@rilk.com> message dated "Wed, 23 Nov 2005 23:14:47 +0100" Date: Wed, 23 Nov 2005 22:14:56 -0500 Message-ID: <7006.1132802096@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/479 X-Sequence-Number: 15736 Pailloncy Jean-Gerard <jg@rilk.com> writes: > Why the stupid indexscan plan on the whole table ? Pray tell, what are you using for the planner cost parameters? The only way I can come close to duplicating your numbers is by setting random_page_cost to somewhere around 0.01 ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 24 02:22:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D4D84DB723 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 02:21:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56524-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 06:21:58 +0000 (GMT) X-Greylist: delayed 01:01:31.924714 by SQLgrey- Received: from pillette.com (adsl-67-119-5-202.dsl.snfc21.pacbell.net [67.119.5.202]) by svr1.postgresql.org (Postfix) with ESMTP id 9374DDBC0C for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 02:21:56 -0400 (AST) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id jAO5KJx03991; Wed, 23 Nov 2005 21:20:19 -0800 Date: Wed, 23 Nov 2005 21:20:19 -0800 From: andrew@pillette.com Message-Id: <200511240520.jAO5KJx03991@pillette.com> Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan To: Pailloncy Jean-Gerard <jg@rilk.com> Cc: pgsql-performance@postgresql.org X-Originating-IP: 70.137.147.241 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.55 required=5 tests=[NO_REAL_NAME=0.55] X-Spam-Score: 0.55 X-Spam-Level: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200511/481 X-Sequence-Number: 15738 Pailloncy Jean-Gerard <jg@rilk.com> wrote .. [snip] THIS MAY SEEM SILLY but vacuum is mispelled below and presumably there was never any ANALYZE done. > > postgres=# vaccum full verbose analyze; From pgsql-performance-owner@postgresql.org Thu Nov 24 01:34:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5A05BD7282 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 01:34:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51167-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 05:34:12 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id 5F547D704F for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 01:34:06 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQG006IL24TZH@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 24 Nov 2005 18:34:05 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-4.dsl.clear.net.nz [218.101.28.4]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id BEB2011536AB; Thu, 24 Nov 2005 18:34:04 +1300 (NZDT) Date: Thu, 24 Nov 2005 18:34:03 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFAA659D.145E5%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: pgsql-performance@postgresql.org, "eng@intranet.greenplum.com" <eng@intranet.greenplum.com> Message-id: <438550CB.5020506@paradise.net.nz> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_QaxGn75YzNMJHffeg0xdpg)" X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFAA659D.145E5%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.261 required=5 tests=[AWL=0.261] X-Spam-Score: 0.261 X-Spam-Level: X-Archive-Number: 200511/480 X-Sequence-Number: 15737 This is a multi-part message in MIME format. --Boundary_(ID_QaxGn75YzNMJHffeg0xdpg) Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 8BIT Luke Lonergan wrote: > Mark, > > This is an excellent idea � unfortunately I�m in Maui right now > (Mahalo!) and I�m not getting to testing with this. My first try was > with 8.0.3 and it�s an 8.1 function I presume. > > Not to be lazy � but any hint as to how to do the same thing for 8.0? > Yeah, it's 8.1 - I didn't think to check against 8.0. The attached variant works with 8.0.4 (textToQualifiedNameList needs 2 args) cheers Mark P.s. Maui eh, sounds real nice. --Boundary_(ID_QaxGn75YzNMJHffeg0xdpg) Content-type: text/plain; name=fastcount-8.0.c Content-transfer-encoding: 7BIT Content-disposition: inline; filename=fastcount-8.0.c /* * fastcount.c * * Do a count that uses considerably less CPU time than an aggregate. * * (Variant for 8.0.x - textToQualifiedNameList needs 2 args) */ #include "postgres.h" #include "funcapi.h" #include "access/heapam.h" #include "catalog/namespace.h" #include "utils/builtins.h" extern Datum fastcount(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(fastcount); Datum fastcount(PG_FUNCTION_ARGS) { text *relname = PG_GETARG_TEXT_P(0); RangeVar *relrv; Relation rel; HeapScanDesc scan; HeapTuple tuple; int64 result = 0; /* Use the name to get a suitable range variable and open the relation. */ relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname, "")); rel = heap_openrv(relrv, AccessShareLock); /* Start a heap scan on the relation. */ scan = heap_beginscan(rel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { result++; } /* End the scan and close up the relation. */ heap_endscan(scan); heap_close(rel, AccessShareLock); PG_RETURN_INT64(result); } --Boundary_(ID_QaxGn75YzNMJHffeg0xdpg)-- From pgsql-performance-owner@postgresql.org Thu Nov 24 04:18:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 786B2D6EBC for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 04:18:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73364-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 08:18:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 2E5E3DAD64 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 04:18:43 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Thu, 24 Nov 2005 03:18:38 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 24 Nov 2005 03:17:08 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Thu, 24 Nov 2005 03:17:07 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 24 Nov 2005 00:17:06 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz> cc: stange@rentec.com, "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFAAB702.1460D%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvIxdwfLDwWrP8Q669kHxJ85F1twBrF12i In-Reply-To: <4382A840.3030401@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Nov 2005 08:17:08.0129 (UTC) FILETIME=[762A0910:01C5F0CF] X-WSS-ID: 6F9BA8D72UO3042572-06-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.396 required=5 tests=[AWL=-0.093, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.396 X-Spam-Level: ** X-Archive-Number: 200511/482 X-Sequence-Number: 15739 Mark, See the results below and analysis - the pure HeapScan gets 94.1% of the max available read bandwidth (cool!). Nothing wrong with heapscan in the presence of large readahead, which is good news. That says it's something else in the path. As you probably know there is a page lock taken, a copy of the tuple from the page, lock removed, count incremented for every iteration of the agg node on a count(*). Is the same true of a count(1)? I recall that the profile is full of memcpy and memory context calls. It would be nice to put some tracers into the executor and see where the time is going. I'm also curious about the impact of the new 8.1 virtual tuples in reducing the executor overhead. In this case my bet's on the agg node itself, what do you think? - Luke On 11/21/05 9:10 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > Luke Lonergan wrote: > >> So that leaves the question - why not more than 64% of the I/O scan rate? >> And why is it a flat 64% as the I/O subsystem increases in speed from >> 333-400MB/s? >> > > It might be interesting to see what effect reducing the cpu consumption > entailed by the count aggregation has - by (say) writing a little bit > of code to heap scan the desired relation (sample attached). OK - here are results for a slightly smaller (still bigger than RAM) lineitem on the same machine, using the same xfs filesystem that achieved 407MB/s: ============================================================================ 12.9GB of DBT-3 data from the lineitem table ============================================================================ llonergan=# select relpages from pg_class where relname='lineitem'; relpages ---------- 1579270 (1 row) 1579270*8192/1000000 12937 Million Bytes or 12.9GB llonergan=# \timing Timing is on. llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 197870.105 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 49912.164 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 49218.739 ms llonergan=# select fastcount('lineitem'); fastcount ----------- 59986052 (1 row) Time: 33752.778 ms llonergan=# select fastcount('lineitem'); fastcount ----------- 59986052 (1 row) Time: 34543.646 ms llonergan=# select fastcount('lineitem'); fastcount ----------- 59986052 (1 row) Time: 34528.053 ms ============================================================================ Analysis: ============================================================================ Bandwidth Percent of max dd Read 407MB/s 100% Count(1) 263MB/s 64.6% HeapScan 383MB/s 94.1% Wow - looks like the HeapScan gets almost all of the available bandwidth! - Luke From pgsql-performance-owner@postgresql.org Thu Nov 24 04:53:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CFDB9D7E05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 04:53:19 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77617-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 08:53:20 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id 1FB9DD6EBC for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 04:53:17 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQG00D0SBCUTY@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 24 Nov 2005 21:53:18 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-4.dsl.clear.net.nz [218.101.28.4]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id E8612F24F3F; Thu, 24 Nov 2005 21:53:17 +1300 (NZDT) Date: Thu, 24 Nov 2005 21:53:16 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFAAB702.1460D%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: stange@rentec.com, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <43857F7C.6060305@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFAAB702.1460D%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.24 required=5 tests=[AWL=0.240] X-Spam-Score: 0.24 X-Spam-Level: X-Archive-Number: 200511/483 X-Sequence-Number: 15740 Luke Lonergan wrote: > ============================================================================ > 12.9GB of DBT-3 data from the lineitem table > ============================================================================ > llonergan=# select relpages from pg_class where relname='lineitem'; > relpages > ---------- > 1579270 > (1 row) > > 1579270*8192/1000000 > 12937 Million Bytes or 12.9GB > > llonergan=# \timing > Timing is on. > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 197870.105 ms So 198 seconds is the uncached read time with count (Just for clarity, did you clear the Pg and filesystem caches or unmount / remount the filesystem?) > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 49912.164 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 49218.739 ms > and ~50 seconds is the (partially) cached read time with count > llonergan=# select fastcount('lineitem'); > fastcount > ----------- > 59986052 > (1 row) > > Time: 33752.778 ms > llonergan=# select fastcount('lineitem'); > fastcount > ----------- > 59986052 > (1 row) > > Time: 34543.646 ms > llonergan=# select fastcount('lineitem'); > fastcount > ----------- > 59986052 > (1 row) > > Time: 34528.053 ms > so ~34 seconds is the (partially) cached read time for fastcount - I calculate this to give ~362Mb/s effective IO rate (I'm doing / by 1024*1024 not 1000*1000) FWIW. While this is interesting, you probably want to stop Pg, unmount the filesystem, and restart Pg to get the uncached time for fastcount too (and how does this compare to uncached read with dd using the same block size?). But at this stage it certainly looks the the heapscan code is pretty efficient - great! Oh - and do you want to try out 32K block size, I'm interested to see what level of improvement you get (as my system is hopelessly cpu bound...)! > ============================================================================ > Analysis: > ============================================================================ > Bandwidth Percent of max > dd Read 407MB/s 100% > Count(1) 263MB/s 64.6% > HeapScan 383MB/s 94.1% Cheers Mark From pgsql-performance-owner@postgresql.org Thu Nov 24 05:11:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 447DDDAF8D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 05:11:41 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79720-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:11:42 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id C419ED6EBC for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 05:11:38 -0400 (AST) Received: from smtp-2.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQG00E8WC7GS3@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 24 Nov 2005 22:11:40 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-4.dsl.clear.net.nz [218.101.28.4]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 83A9D9AE7B0; Thu, 24 Nov 2005 22:11:38 +1300 (NZDT) Date: Thu, 24 Nov 2005 22:11:36 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFAAB702.1460D%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: stange@rentec.com, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <438583C8.4050809@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFAAB702.1460D%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.222 required=5 tests=[AWL=0.222] X-Spam-Score: 0.222 X-Spam-Level: X-Archive-Number: 200511/484 X-Sequence-Number: 15741 Luke Lonergan wrote: > Mark, > > > It would be nice to put some tracers into the executor and see where the > time is going. I'm also curious about the impact of the new 8.1 virtual > tuples in reducing the executor overhead. In this case my bet's on the agg > node itself, what do you think? > Yeah - it's pretty clear that the count aggregate is fairly expensive wrt cpu - However, I am not sure if all agg nodes suffer this way (guess we could try a trivial aggregate that does nothing for all tuples bar the last and just reports the final value it sees). Cheers Mark From pgsql-performance-owner@postgresql.org Thu Nov 24 05:23:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C4527DBA6C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 05:23:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80935-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:23:05 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id BC261DBA04 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 05:23:01 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Thu, 24 Nov 2005 04:22:52 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 24 Nov 2005 04:22:04 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Thu, 24 Nov 2005 04:22:03 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 24 Nov 2005 01:22:03 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz> cc: stange@rentec.com, "Greg Stark" <gsstark@mit.edu>, "Dave Cramer" <pg@fastcrypt.com>, "Joshua Marsh" <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-ID: <BFAAC63B.14618%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXw1IoT6owKGP/7ThSbYUo+hMe9tAAA/2fi In-Reply-To: <43857F7C.6060305@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Nov 2005 09:22:04.0773 (UTC) FILETIME=[88BEB950:01C5F0D8] X-WSS-ID: 6F9B59ED3282408891-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.787 required=5 tests=[AWL=0.534, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.787 X-Spam-Level: * X-Archive-Number: 200511/485 X-Sequence-Number: 15742 Mark, >> Time: 197870.105 ms > > So 198 seconds is the uncached read time with count (Just for clarity, > did you clear the Pg and filesystem caches or unmount / remount the > filesystem?) Nope - the longer time is due to the "second write" known issue with Postgres - it writes the data to the table, but all of the pages are marked dirty? So, always on the first scan after loading they are written again. This is clear as you watch vmstat - the pattern on the first seq scan is half read / half write. >> Time: 49218.739 ms >> > > and ~50 seconds is the (partially) cached read time with count Again - the pattern here is pure read and completely non-cached. You see a very nearly constant I/O rate when watching vmstat for the entire scan. >> Time: 34528.053 ms > so ~34 seconds is the (partially) cached read time for fastcount - > I calculate this to give ~362Mb/s effective IO rate (I'm doing / by > 1024*1024 not 1000*1000) FWIW. The dd number uses 1000*1000, so I maintained it for the percentage of max. > While this is interesting, you probably want to stop Pg, unmount the > filesystem, and restart Pg to get the uncached time for fastcount too > (and how does this compare to uncached read with dd using the same block > size?). I'll do it again sometime, but I've already deleted the file. I've done the following in the past to validate this though: - Reboot machine - Rerun scan And we get identical results. > But at this stage it certainly looks the the heapscan code is pretty > efficient - great! Yep. > Oh - and do you want to try out 32K block size, I'm interested to see > what level of improvement you get (as my system is hopelessly cpu bound...)! Yah - done so in the past and not seen any - was waiting for Alan to post his results. >> ============================================================================ >> Analysis: >> ============================================================================ >> Bandwidth Percent of max >> dd Read 407MB/s 100% >> Count(1) 263MB/s 64.6% >> HeapScan 383MB/s 94.1% Note these are all in consistent 1000x1000 units. Thanks for the test - neat trick! We'll use it to do some more profiling some time soon... - Luke From pgsql-performance-owner@postgresql.org Thu Nov 24 05:24:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 76A77DAD64 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 05:24:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80244-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:24:39 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id DBB74D6EBC for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 05:24:35 -0400 (AST) Received: from smtp-3.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQG00FYKCT1WO@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 24 Nov 2005 22:24:37 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-4.dsl.clear.net.nz [218.101.28.4]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id 2B27E139AD8A; Thu, 24 Nov 2005 22:24:37 +1300 (NZDT) Date: Thu, 24 Nov 2005 22:24:35 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFAAB702.1460D%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: stange@rentec.com, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <438586D3.9010701@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFAAB702.1460D%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.207 required=5 tests=[AWL=0.207] X-Spam-Score: 0.207 X-Spam-Level: X-Archive-Number: 200511/486 X-Sequence-Number: 15743 Luke Lonergan wrote: > That says it's something else in the path. As you probably know there is a > page lock taken, a copy of the tuple from the page, lock removed, count > incremented for every iteration of the agg node on a count(*). Is the same > true of a count(1)? > Sorry Luke - message 3 - I seem to be suffering from a very small working memory buffer myself right now, I think it's after a day of working with DB2 ... :-) Anyway, as I read src/backend/parser/gram.y:6542 - count(*) is transformed into count(1), so these two are identical. Cheers (last time tonight, promise!) Mark From pgsql-performance-owner@postgresql.org Thu Nov 24 05:26:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 616F5DBA6C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 05:26:48 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81013-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:26:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id BEBBDDBA04 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 05:26:45 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQG00FLYCWNWO@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 24 Nov 2005 22:26:47 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-4.dsl.clear.net.nz [218.101.28.4]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id B7661BB9147; Thu, 24 Nov 2005 22:26:46 +1300 (NZDT) Date: Thu, 24 Nov 2005 22:26:44 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <BFAAC63B.14618%llonergan@greenplum.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: stange@rentec.com, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <43858754.4020300@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFAAC63B.14618%llonergan@greenplum.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.193 required=5 tests=[AWL=0.193] X-Spam-Score: 0.193 X-Spam-Level: X-Archive-Number: 200511/487 X-Sequence-Number: 15744 Luke Lonergan wrote: > Mark, > > >>>Time: 197870.105 ms >> >>So 198 seconds is the uncached read time with count (Just for clarity, >>did you clear the Pg and filesystem caches or unmount / remount the >>filesystem?) > > > Nope - the longer time is due to the "second write" known issue with > Postgres - it writes the data to the table, but all of the pages are marked > dirty? So, always on the first scan after loading they are written again. > This is clear as you watch vmstat - the pattern on the first seq scan is > half read / half write. > Ah - indeed - first access after a COPY no? I should have thought of that, sorry! From pgsql-performance-owner@postgresql.org Thu Nov 24 09:53:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E211D721E for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:53:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16626-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 13:53:56 +0000 (GMT) X-Greylist: delayed 03:14:54.681692 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 0E567DBBD6 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 09:53:50 -0400 (AST) Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de [83.236.156.26]) by svr2.postgresql.org (Postfix) with ESMTP id 58A51F0B10 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 10:38:56 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aeccom.com (Postfix) with ESMTP id 66A481CB48; Thu, 24 Nov 2005 11:38:48 +0100 (CET) Received: from mail.aeccom.com ([127.0.0.1]) by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25878-01-22; Thu, 24 Nov 2005 11:38:47 +0100 (CET) Received: from [192.168.2.14] (andes.core.aeccom.com [192.168.2.14]) by mail.aeccom.com (Postfix) with ESMTP id 3D71C1CB53; Thu, 24 Nov 2005 11:38:47 +0100 (CET) Message-ID: <43859837.8040101@aeccom.com> Date: Thu, 24 Nov 2005 11:38:47 +0100 From: Sven Geisler <sgeisler@aeccom.com> Organization: AEC/communications GmbH User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Anjan Dave <adave@vantage.com> Cc: Scott Marlowe <smarlowe@g2switchworks.com>, Tom Lane <tgl@sss.pgh.pa.us>, Vivek Khera <vivek@khera.org>, Postgresql Performance <pgsql-performance@postgresql.org> Subject: Re: High context switches occurring References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E78@vt-pe2550-001.vantage.vantage.com> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098E78@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at aeccom.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/493 X-Sequence-Number: 15750 Hi Anjan, I can support Scott. You should turn on HT if you see high values for CS. I do have a few customers running a web-based 3-tier application with PostgreSQL. We had to turn off HT to have better overall performance. The issue is the behavior under high load. I notice that HT on does collapse faster. Just a question. Which version of XEON do you have? What is does the server have as memory architecture. I think, Dual-Core XEON's are no issue. One of our customers does use a 4-way Dual-Core Opteron 875 since a few months. We have Pg 8.0.3 and it runs perfect. I have to say that we use a special patch from Tom which fix an issue with the looking of shared buffers and the Opteron. I notice that this patch is also useful for XEON's with EMT64. Best regards Sven. Anjan Dave schrieb: > Yes, it's turned on, unfortunately it got overlooked during the setup, > and until now...! > > It's mostly a 'read' application, I increased the vm.max-readahead to > 2048 from the default 256, after which I've not seen the CS storm, > though it could be incidental. > > Thanks, > Anjan > > -----Original Message----- > From: Scott Marlowe [mailto:smarlowe@g2switchworks.com] > Sent: Tuesday, November 22, 2005 3:38 PM > To: Anjan Dave > Cc: Tom Lane; Vivek Khera; Postgresql Performance > Subject: Re: [PERFORM] High context switches occurring > > On Tue, 2005-11-22 at 14:33, Anjan Dave wrote: > >>Is there any way to get a temporary relief from this Context Switching >>storm? Does restarting postmaster help? >> >>It seems that I can recreate the heavy CS with just one SELECT >>statement...and then when multiple such SELECT queries are coming in, >>things just get hosed up until we cancel a bunch of queries... > > > Is your machine a hyperthreaded one? Some folks have found that turning > off hyper threading helps. I knew it made my servers better behaved in > the past. > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster -- /This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and delete your copy from your system. Thank you for your cooperation./ Sven Geisler <sgeisler@aeccom.com> Tel +49.30.5362.1627 Fax .1638 Senior Developer, AEC/communications GmbH Berlin, Germany From pgsql-performance-owner@postgresql.org Thu Nov 24 07:54:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9AC56DBBA1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 07:54:36 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00387-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 11:54:38 +0000 (GMT) X-Greylist: delayed 13:39:23.443934 by SQLgrey- Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6C049DBB98 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 07:54:32 -0400 (AST) Received: from [192.168.0.1] (cev75-1-81-57-249-136.fbx.proxad.net [81.57.249.136]) (authenticated bits=0) by mail.rilk.com (8.13.0/8.13.0) with ESMTP id jAOBsQgS008207 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO); Thu, 24 Nov 2005 12:54:32 +0100 (CET) In-Reply-To: <200511240520.jAO5KJx03991@pillette.com> References: <200511240520.jAO5KJx03991@pillette.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <D629E6A4-81A4-42F0-9702-68883971F05E@rilk.com> Cc: andrew@pillette.com Content-Transfer-Encoding: quoted-printable From: Pailloncy Jean-Gerard <jg@rilk.com> Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Date: Thu, 24 Nov 2005 12:54:25 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-DCC-CTc-dcc2-Metrics: mail.rilk.com 1031; Body=3 Fuz1=3 Fuz2=3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/488 X-Sequence-Number: 15745 > THIS MAY SEEM SILLY but vacuum is mispelled below and presumably =20 > there was never any ANALYZE done. > >> >> postgres=3D# vaccum full verbose analyze; I do have done the "vacUUm full verbose analyze;". But I copy/paste the wrong line. Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Thu Nov 24 07:54:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF914DBAB1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 07:54:51 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01575-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 11:54:53 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) by svr1.postgresql.org (Postfix) with ESMTP id 88EF3DB939 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 07:54:48 -0400 (AST) Received: from [192.168.0.1] (cev75-1-81-57-249-136.fbx.proxad.net [81.57.249.136]) (authenticated bits=0) by mail.rilk.com (8.13.0/8.13.0) with ESMTP id jAOBsQgT008207 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO); Thu, 24 Nov 2005 12:54:51 +0100 (CET) In-Reply-To: <7006.1132802096@sss.pgh.pa.us> References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <7006.1132802096@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <7F8AA93A-431E-44E9-9339-F4BDA5FD7760@rilk.com> Cc: Tom Lane <tgl@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable From: Pailloncy Jean-Gerard <jg@rilk.com> Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Date: Thu, 24 Nov 2005 12:54:50 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-DCC-CTc-dcc2-Metrics: mail.rilk.com 1031; Body=2 Fuz1=2 Fuz2=2 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/489 X-Sequence-Number: 15746 > Pailloncy Jean-Gerard <jg@rilk.com> writes: >> Why the stupid indexscan plan on the whole table ? > > Pray tell, what are you using for the planner cost parameters? > The only way I can come close to duplicating your numbers is > by setting random_page_cost to somewhere around 0.01 ... > I did not change the costs. > grep cost postgresql.conf # note: increasing max_connections costs ~400 bytes of shared memory per # note: increasing max_prepared_transactions costs ~600 bytes of =20 shared memory #vacuum_cost_delay =3D 0 # 0-1000 milliseconds #vacuum_cost_page_hit =3D 1 # 0-10000 credits #vacuum_cost_page_miss =3D 10 # 0-10000 credits #vacuum_cost_page_dirty =3D 20 # 0-10000 credits #vacuum_cost_limit =3D 200 # 0-10000 credits #random_page_cost =3D 4 # units are one sequential =20 page fetch # cost #cpu_tuple_cost =3D 0.01 # (same) #cpu_index_tuple_cost =3D 0.001 # (same) #cpu_operator_cost =3D 0.0025 # (same) #autovacuum_vacuum_cost_delay =3D -1 # default vacuum cost delay = for # vacuum_cost_delay #autovacuum_vacuum_cost_limit =3D -1 # default vacuum cost limit = for # vacuum_cost_limit Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Thu Nov 24 08:41:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 478F7D8323 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 08:41:24 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05111-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 12:41:26 +0000 (GMT) X-Greylist: delayed 00:15:07.660252 by SQLgrey- Received: from travis.trilogy.com (unknown [149.75.65.93]) by svr1.postgresql.org (Postfix) with ESMTP id A3C63D721E for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 08:41:21 -0400 (AST) To: pgsql-performance@postgresql.org Subject: xlog flush request error MIME-Version: 1.0 X-Mailer: Lotus Notes Release 5.0.9 November 16, 2001 Message-ID: <OF52A26328.BA64DC8C-ON862570C3.00440956@trilogy.com> From: Vipul.Gupta@trilogy.com Date: Thu, 24 Nov 2005 06:24:32 -0600 X-MIMETrack: Serialize by Router on Travis/Trilogy(Release 5.0.12 |February 13, 2003) at 11/24/2005 06:39:44 AM, Serialize complete at 11/24/2005 06:39:44 AM Content-Type: multipart/alternative; boundary="=_alternative 00443E43652570C3_=" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.551 required=5 tests=[HTML_MESSAGE=0.001, NO_REAL_NAME=0.55] X-Spam-Score: 0.551 X-Spam-Level: X-Archive-Number: 200511/490 X-Sequence-Number: 15747 This is a multipart message in MIME format. --=_alternative 00443E43652570C3_= Content-Type: text/plain; charset="us-ascii" Hi , i get the following error on doing anything with the database after starting it. Can anyone suggest how do i fix this xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324 Vipul Gupta --=_alternative 00443E43652570C3_= Content-Type: text/html; charset="us-ascii" <br><font size=2 face="sans-serif">Hi ,</font> <br> <br><font size=2 face="sans-serif">i get the following error on doing anything with the database after starting it.</font> <br><font size=2 face="sans-serif">Can anyone suggest how do i fix this</font> <br> <br><font size=2 face="sans-serif"> xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324</font> <br> <br><font size=2 face="sans-serif">Vipul Gupta<br> </font> --=_alternative 00443E43652570C3_=-- From pgsql-performance-owner@postgresql.org Thu Nov 24 09:06:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83DE9DB9C0 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:06:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09065-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 13:06:56 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 6BFC4DB939 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 09:06:51 -0400 (AST) Received: from hotmail.com (bay101-f8.bay101.hotmail.com [64.4.56.18]) by svr2.postgresql.org (Postfix) with ESMTP id C3A6CF0BA3 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 13:06:54 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 24 Nov 2005 05:06:49 -0800 Message-ID: <BAY101-F89F00F81CBAF5B66A6EE0AD540@phx.gbl> Received: from 64.4.56.200 by by101fd.bay101.hotmail.msn.com with HTTP; Thu, 24 Nov 2005 13:06:48 GMT X-Originating-IP: [84.210.10.106] X-Originating-Email: [bealach_na_bo@hotmail.com] X-Sender: bealach_na_bo@hotmail.com From: "Bealach-na Bo" <bealach_na_bo@hotmail.com> To: pgsql-performance@postgresql.org Subject: Very slow queries - please help. Date: Thu, 24 Nov 2005 13:06:48 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 24 Nov 2005 13:06:49.0106 (UTC) FILETIME=[EE08A720:01C5F0F7] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200511/491 X-Sequence-Number: 15748 Hi Folks, I'm new to Postgresql. I'm having great difficulties getting the performance I had hoped for from Postgresql 8.0. The typical query below takes ~20 minutes !! I hope an expert out there will tell me what I'm doing wrong - I hope *I* am doing something wrong. Hardware -------- Single processor, Intel Xeon 3.06 GHz machine running Red Hat Ent. 4. with 1.5 GB of RAM. The machine is dedicated to running Postgresql 8.0 and Apache/mod_perl etc. The database is being accessed for report generation via a web form. The web server talks to Pg over TCP/IP (I know, that I don't need to do this if they are all on the same machine, but I have good reasons for this and don't suspect that this is where my problems are - I have the same poor performance when running from psql on the server.) Database -------- Very simple, not fully normalized set of two tables. The first table, very small (2000 lines of 4 cols with very few chars and integers in in col). The other quite a bit larger (500000 lines with 15 cols. with the largest fields ~ 256 chars) Typical query ------------ SELECT n.name FROM node n WHERE n.name LIKE '56x%' AND n.type='H' AND n.usage='TEST' AND n.node_id NOT IN (select n.node_id FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '56x%' AND n.type='H' AND n.usage='TEST' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-22 09:31:10' OR j.job_stop IS NULL)) ORDER BY n.name The node table is the small table and the job_log table is the large table. I've tried all the basic things that I found in the documentation like VACUUM ANALYZE, EXPLAIN etc., but I suspect there is something terribly wrong with what I'm doing and these measures will not shave off 19 min and 50 seconds off the query time. Any help and comments would be very much appreciated. Bealach From pgsql-performance-owner@postgresql.org Thu Nov 24 09:23:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6CD36DBCA8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 09:23:38 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12793-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 13:23:40 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by svr1.postgresql.org (Postfix) with ESMTP id F1BA3DBC88 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 09:23:34 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so1668232wri for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 05:23:38 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VlN3lxkmGQjDnrTMGsperlYDrYQPTErg/6ISfyRhV8AFz0kTL04MWbk5son4gqbw8F/NrrN7Q3VdSzjH+q7UL0kEScgxMeUaWKYANgWvkCwqM01IP5wNn5pUHzEQipo7JOQq03Em9Xpk9JfVNTlPthgzV85Ux6ObmvsubYnzMMU= Received: by 10.65.234.16 with SMTP id l16mr7140663qbr; Thu, 24 Nov 2005 05:23:38 -0800 (PST) Received: by 10.65.192.16 with HTTP; Thu, 24 Nov 2005 05:23:38 -0800 (PST) Message-ID: <b41c75520511240523t3372661fw@mail.gmail.com> Date: Thu, 24 Nov 2005 14:23:38 +0100 From: Claus Guttesen <kometen@gmail.com> To: Bealach-na Bo <bealach_na_bo@hotmail.com> Subject: Re: Very slow queries - please help. Cc: pgsql-performance@postgresql.org In-Reply-To: <BAY101-F89F00F81CBAF5B66A6EE0AD540@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <BAY101-F89F00F81CBAF5B66A6EE0AD540@phx.gbl> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/492 X-Sequence-Number: 15749 > Typical query > ------------ > > SELECT n.name > FROM node n > WHERE n.name > LIKE '56x%' > AND n.type=3D'H' > AND n.usage=3D'TEST' > AND n.node_id > NOT IN > (select n.node_id > FROM job_log j > INNER JOIN node n > ON j.node_id =3D n.node_id > WHERE n.name > LIKE '56x%' > AND n.type=3D'H' > AND n.usage=3D'TEST' > AND j.job_name =3D 'COPY FILES' > AND j.job_start >=3D '2005-11-14 00:00:00' > AND (j.job_stop <=3D '2005-11-22 09:31:10' OR j.job_stop IS NULL)) > ORDER BY n.name Do you have any indexes? regards Claus From pgsql-performance-owner@postgresql.org Thu Nov 24 10:36:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA957DBC0C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 10:36:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45293-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 14:36:09 +0000 (GMT) X-Greylist: delayed 01:29:13.338951 by SQLgrey- Received: from hotmail.com (bay101-f39.bay101.hotmail.com [64.4.56.49]) by svr1.postgresql.org (Postfix) with ESMTP id A520BDBC7A for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 10:36:02 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 24 Nov 2005 06:36:06 -0800 Message-ID: <BAY101-F398BCDC77A2C41D225B978AD540@phx.gbl> Received: from 64.4.56.200 by by101fd.bay101.hotmail.msn.com with HTTP; Thu, 24 Nov 2005 14:36:06 GMT X-Originating-IP: [84.210.10.106] X-Originating-Email: [bealach_na_bo@hotmail.com] X-Sender: bealach_na_bo@hotmail.com In-Reply-To: <b41c75520511240523t3372661fw@mail.gmail.com> From: "Bealach-na Bo" <bealach_na_bo@hotmail.com> To: kometen@gmail.com Cc: pgsql-performance@postgresql.org Subject: Re: Very slow queries - please help. Date: Thu, 24 Nov 2005 14:36:06 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 24 Nov 2005 14:36:06.0791 (UTC) FILETIME=[67768170:01C5F104] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.439 required=5 tests=[AWL=-0.480, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.439 X-Spam-Level: * X-Archive-Number: 200511/494 X-Sequence-Number: 15751 Hi, Thanks for your comments. I've explicitly made any indexes, but the default ones are: user@10.0.0.2.dbdev=> \di List of relations Schema | Name | Type | Owner | Table ---------+-----------------+-------+---------+--------- user | job_log_id_pkey | index | user | job_log user | node_id_pkey | index | user | node user | node_name_key | index | user | node (3 rows) I'm also sending the EXPLAIN outputs. explain SELECT n.name,n.type, n.usage, j.status, j.job_start,j.job_stop, j.nfiles_in_job,j.job_name FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '56x%' AND n.type = 'K' AND n.usage = 'LIVE' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-14 05:00:00' OR j.job_stop IS NULL) ORDER BY n.name; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..75753.31 rows=1 width=461) Join Filter: ("inner".node_id = "outer".node_id) -> Index Scan using node_name_key on node n (cost=0.00..307.75 rows=1 width=181) Filter: ((name ~~ '56x%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar)) -> Seq Scan on job_log j (cost=0.00..75445.54 rows=1 width=288) Filter: ((job_name = 'COPY FILES'::bpchar) AND (job_start >= '2005-11-14 00:00:00'::timestamp without time zone) AND ((job_stop <= '2005-11-14 05:00:00'::timestamp without time zone) OR (job_stop IS NULL))) (6 rows) explain SELECT n.name, n.type, n.usage FROM node n WHERE n.name LIKE '56x%' AND n.type = 'K' AND n.usage = 'LIVE' AND n.node_id NOT IN (SELECT n.node_id FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '56x%' AND n.type = 'K' AND n.usage = 'LIVE' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-14 05:00:00' OR j.job_stop IS NULL)) ORDER BY n.name; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Index Scan using node_name_key on node n (cost=75451.55..75764.94 rows=1 width=177) Filter: ((name ~~ '56x%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar) AND (NOT (hashed subplan))) SubPlan -> Nested Loop (cost=0.00..75451.54 rows=1 width=4) -> Seq Scan on job_log j (cost=0.00..75445.54 rows=1 width=4) Filter: ((job_name = 'COPY FILES'::bpchar) AND (job_start >= '2005-11-14 00:00:00'::timestamp without time zone) AND ((job_stop <= '2005-11-14 05:00:00'::timestamp without time zone) OR (job_stop IS NULL))) -> Index Scan using node_id_pkey on node n (cost=0.00..5.99 rows=1 width=4) Index Cond: ("outer".node_id = n.node_id) Filter: ((name ~~ '56x%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar)) Yours, Bealach >From: Claus Guttesen <kometen@gmail.com> >To: Bealach-na Bo <bealach_na_bo@hotmail.com> >CC: pgsql-performance@postgresql.org >Subject: Re: [PERFORM] Very slow queries - please help. >Date: Thu, 24 Nov 2005 14:23:38 +0100 > > > Typical query > > ------------ > > > > SELECT n.name > > FROM node n > > WHERE n.name > > LIKE '56x%' > > AND n.type='H' > > AND n.usage='TEST' > > AND n.node_id > > NOT IN > > (select n.node_id > > FROM job_log j > > INNER JOIN node n > > ON j.node_id = n.node_id > > WHERE n.name > > LIKE '56x%' > > AND n.type='H' > > AND n.usage='TEST' > > AND j.job_name = 'COPY FILES' > > AND j.job_start >= '2005-11-14 00:00:00' > > AND (j.job_stop <= '2005-11-22 09:31:10' OR j.job_stop IS NULL)) > > ORDER BY n.name > >Do you have any indexes? > >regards >Claus From pgsql-performance-owner@postgresql.org Thu Nov 24 11:03:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ECA32D7282 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 11:03:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50669-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 15:03:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from soufre.accelance.net (soufre.accelance.net [213.162.48.15]) by svr1.postgresql.org (Postfix) with ESMTP id 40D82DBCA5 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 11:03:44 -0400 (AST) Received: from [213.162.49.207] (gs.team.openwide.fr [213.162.49.207]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by soufre.accelance.net (Postfix) with ESMTP id 4EB4B5CF6; Thu, 24 Nov 2005 16:03:48 +0100 (CET) Message-ID: <4385D653.7020804@openwide.fr> Date: Thu, 24 Nov 2005 16:03:47 +0100 From: Guillaume Smet <guillaume.smet@openwide.fr> User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bealach-na Bo <bealach_na_bo@hotmail.com> CC: pgsql-performance@postgresql.org Subject: Re: Very slow queries - please help. References: <BAY101-F398BCDC77A2C41D225B978AD540@phx.gbl> In-Reply-To: <BAY101-F398BCDC77A2C41D225B978AD540@phx.gbl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/495 X-Sequence-Number: 15752 Hi, > I'm also sending the EXPLAIN outputs. Please provide EXPLAIN ANALYZE outputs instead of EXPLAIN. You will have more information. Indexes on your tables are obviously missing. You should try to add: CREATE INDEX idx_node_filter ON node(name, type, usage); CREATE INDEX idx_job_log_filter ON job_log(job_name, job_start, job_stop); I'm not so sure it's a good idea to add job_stop in this index as you have an IS NULL in your query so I'm not sure it can be used. You should try it anyway and remove it if not needed. I added all your search fields in the indexes but it depends a lot on the selectivity of your conditions. I don't know your data but I think you understand the idea. HTH -- Guillaume From pgsql-performance-owner@postgresql.org Thu Nov 24 11:15:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6D425D7282 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 11:15:37 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49929-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 15:15:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 841E3DBC1D for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 11:15:34 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAOFFZYR013627; Thu, 24 Nov 2005 10:15:35 -0500 (EST) To: "Bealach-na Bo" <bealach_na_bo@hotmail.com> cc: pgsql-performance@postgresql.org Subject: Re: Very slow queries - please help. In-reply-to: <BAY101-F89F00F81CBAF5B66A6EE0AD540@phx.gbl> References: <BAY101-F89F00F81CBAF5B66A6EE0AD540@phx.gbl> Comments: In-reply-to "Bealach-na Bo" <bealach_na_bo@hotmail.com> message dated "Thu, 24 Nov 2005 13:06:48 +0000" Date: Thu, 24 Nov 2005 10:15:35 -0500 Message-ID: <13626.1132845335@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/496 X-Sequence-Number: 15753 "Bealach-na Bo" <bealach_na_bo@hotmail.com> writes: > I'm having great difficulties getting the performance I had hoped for > from Postgresql 8.0. The typical query below takes ~20 minutes !! You need to show us the table definition (including indexes) and the EXPLAIN ANALYZE results for the query. It seems likely that the NOT IN is the source of your problems, but it's hard to be sure without EXPLAIN results. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 24 11:37:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 63B3EDBBF3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 11:37:19 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56923-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 15:37:23 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9400CDBB89 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 11:37:16 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAOFbLhL013838; Thu, 24 Nov 2005 10:37:21 -0500 (EST) To: Vipul.Gupta@trilogy.com cc: pgsql-performance@postgresql.org Subject: Re: xlog flush request error In-reply-to: <OF52A26328.BA64DC8C-ON862570C3.00440956@trilogy.com> References: <OF52A26328.BA64DC8C-ON862570C3.00440956@trilogy.com> Comments: In-reply-to Vipul.Gupta@trilogy.com message dated "Thu, 24 Nov 2005 06:24:32 -0600" Date: Thu, 24 Nov 2005 10:37:21 -0500 Message-ID: <13837.1132846641@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.005 required=5 tests=[AWL=0.005] X-Spam-Score: 0.005 X-Spam-Level: X-Archive-Number: 200511/497 X-Sequence-Number: 15754 Vipul.Gupta@trilogy.com writes: > Can anyone suggest how do i fix this > xlog flush request 7/7D02338C is not satisfied --- flushed only to > 3/2471E324 This looks like corrupt data to me --- specifically, garbage in the LSN field of a page header. Is that all you get? PG 7.4 and up should tell you the problem page number in a CONTEXT: line. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 24 12:00:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2D3F2DBCB3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 12:00:47 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58710-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 16:00:45 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 6BCB0DBCC9 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 12:00:44 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EfJWM-000338-00; Thu, 24 Nov 2005 11:00:26 -0500 To: Mark Kirkwood <markir@paradise.net.nz> Cc: Luke Lonergan <llonergan@greenplum.com>, stange@rentec.com, Greg Stark <gsstark@mit.edu>, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFAAB702.1460D%llonergan@greenplum.com> <438583C8.4050809@paradise.net.nz> In-Reply-To: <438583C8.4050809@paradise.net.nz> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 24 Nov 2005 11:00:25 -0500 Message-ID: <87d5kqkpd2.fsf@stark.xeocode.com> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/498 X-Sequence-Number: 15755 Mark Kirkwood <markir@paradise.net.nz> writes: > Yeah - it's pretty clear that the count aggregate is fairly expensive wrt cpu - > However, I am not sure if all agg nodes suffer this way (guess we could try a > trivial aggregate that does nothing for all tuples bar the last and just > reports the final value it sees). As you mention count(*) and count(1) are the same thing. Last I heard the reason count(*) was so expensive was because its state variable was a bigint. That means it doesn't fit in a Datum and has to be alloced and stored as a pointer. And because of the Aggregate API that means it has to be allocated and freed for every tuple processed. There was some talk of having a special case API for count(*) and maybe sum(...) to avoid having to do this. There was also some talk of making Datum 8 bytes wide on platforms where that was natural (I guess AMD64, Sparc64, Alpha, Itanic). Afaik none of these items have happened but I don't know for sure. -- greg From pgsql-performance-owner@postgresql.org Thu Nov 24 12:25:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB93CDBC1D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 12:25:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63202-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 16:25:47 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A76AFDBC0C for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 12:25:46 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAOGPSnR014287; Thu, 24 Nov 2005 11:25:29 -0500 (EST) To: Greg Stark <gsstark@mit.edu> cc: Mark Kirkwood <markir@paradise.net.nz>, Luke Lonergan <llonergan@greenplum.com>, stange@rentec.com, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <87d5kqkpd2.fsf@stark.xeocode.com> References: <BFAAB702.1460D%llonergan@greenplum.com> <438583C8.4050809@paradise.net.nz> <87d5kqkpd2.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark <gsstark@mit.edu> message dated "24 Nov 2005 11:00:25 -0500" Date: Thu, 24 Nov 2005 11:25:28 -0500 Message-ID: <14286.1132849528@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/499 X-Sequence-Number: 15756 Greg Stark <gsstark@mit.edu> writes: > Last I heard the reason count(*) was so expensive was because its state > variable was a bigint. That means it doesn't fit in a Datum and has to be > alloced and stored as a pointer. And because of the Aggregate API that means > it has to be allocated and freed for every tuple processed. There's a hack in 8.1 to avoid the palloc overhead (courtesy of Neil Conway IIRC). regards, tom lane From pgsql-performance-owner@postgresql.org Thu Nov 24 12:40:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 88B15DBA4C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 12:40:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64887-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 16:40:26 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id E59F2DBA3F for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 12:40:25 -0400 (AST) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1EfK8z-0003u4-00; Thu, 24 Nov 2005 11:40:21 -0500 To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Greg Stark <gsstark@mit.edu>, Mark Kirkwood <markir@paradise.net.nz>, Luke Lonergan <llonergan@greenplum.com>, stange@rentec.com, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFAAB702.1460D%llonergan@greenplum.com> <438583C8.4050809@paradise.net.nz> <87d5kqkpd2.fsf@stark.xeocode.com> <14286.1132849528@sss.pgh.pa.us> In-Reply-To: <14286.1132849528@sss.pgh.pa.us> From: Greg Stark <gsstark@mit.edu> Organization: The Emacs Conspiracy; member since 1992 Date: 24 Nov 2005 11:40:21 -0500 Message-ID: <877jayknii.fsf@stark.xeocode.com> Lines: 15 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/500 X-Sequence-Number: 15757 Tom Lane <tgl@sss.pgh.pa.us> writes: > Greg Stark <gsstark@mit.edu> writes: > > Last I heard the reason count(*) was so expensive was because its state > > variable was a bigint. That means it doesn't fit in a Datum and has to be > > alloced and stored as a pointer. And because of the Aggregate API that means > > it has to be allocated and freed for every tuple processed. > > There's a hack in 8.1 to avoid the palloc overhead (courtesy of Neil > Conway IIRC). ah, cool, missed that. -- greg From pgsql-performance-owner@postgresql.org Thu Nov 24 13:08:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8558CDBC26 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 13:07:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69156-03-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 17:07:57 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id 91589DBBB8 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 13:07:56 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Thu, 24 Nov 2005 12:07:42 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 24 Nov 2005 12:07:42 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Thu, 24 Nov 2005 12:07:42 -0500 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Thu, 24 Nov 2005 09:07:40 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Luke Lonergan" <llonergan@greenplum.com> cc: pgsql-performance@postgresql.org Message-ID: <BFAB335C.14684%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvIxdwfLDwWrP8Q669kHxJ85F1twBrF12iABKHo1c= In-Reply-To: <BFAAB702.1460D%llonergan@greenplum.com> MIME-Version: 1.0 X-OriginalArrivalTime: 24 Nov 2005 17:07:42.0594 (UTC) FILETIME=[94FBE620:01C5F119] X-WSS-ID: 6F9B2CD43282685473-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.386 required=5 tests=[AWL=-0.103, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.386 X-Spam-Level: ** X-Archive-Number: 200511/501 X-Sequence-Number: 15758 The same 12.9GB distributed across 4 machines using Bizgres MPP fits into I/O cache. The interesting result is that the query "select count(1)" is limited in speed to 280 MB/s per CPU when run on the lineitem table. So when I run it spread over 4 machines, one CPU per machine I get this: ====================================================== Bizgres MPP, 4 data segments, 1 per 2 CPUs ====================================================== llonergan=# explain select count(1) from lineitem; QUERY PLAN ---------------------------------------------------------------------------- ---------- Aggregate (cost=582452.00..582452.00 rows=1 width=0) -> Gather Motion (cost=582452.00..582452.00 rows=1 width=0) -> Aggregate (cost=582452.00..582452.00 rows=1 width=0) -> Seq Scan on lineitem (cost=0.00..544945.00 rows=15002800 width=0) (4 rows) llonergan=# \timing Timing is on. llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 12191.435 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 11986.109 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 11448.941 ms ====================================================== That's 12,937 MB in 11.45 seconds, or 1,130 MB/s. When you divide out the number of Postgres instances (4), that's 283MB/s per Postgres instance. To verify that this has nothing to do with MPP, I ran it in a special internal mode on one instance and got the same result. So - we should be able to double this rate by running one segment per CPU, or two per host: ====================================================== Bizgres MPP, 8 data segments, 1 per CPU ====================================================== llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 6484.594 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 6156.729 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 6063.416 ms ====================================================== That's 12,937 MB in 11.45 seconds, or 2,134 MB/s. When you divide out the number of Postgres instances (8), that's 267MB/s per Postgres instance. So, if you want to "select count(1)", using more CPUs is a good idea! For most complex queries, having lots of CPUs + MPP is a good combo. Here is an example of a sorting plan - this should probably be done with a hash aggregation, but using 8 CPUs makes it go 8x faster: - Luke From pgsql-performance-owner@postgresql.org Thu Nov 24 14:14:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46F38DBC44 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 14:14:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76107-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 18:14:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay101-f35.bay101.hotmail.com [64.4.56.45]) by svr1.postgresql.org (Postfix) with ESMTP id 1ABCCDBC0C for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 14:14:52 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 24 Nov 2005 10:14:53 -0800 Message-ID: <BAY101-F35C5475BF7CCEE56EAB208AD540@phx.gbl> Received: from 64.4.56.200 by by101fd.bay101.hotmail.msn.com with HTTP; Thu, 24 Nov 2005 18:14:53 GMT X-Originating-IP: [84.210.10.106] X-Originating-Email: [bealach_na_bo@hotmail.com] X-Sender: bealach_na_bo@hotmail.com From: "Bealach-na Bo" <bealach_na_bo@hotmail.com> To: kometen@gmail.com, tgl@sss.pgh.pa.us, noerder-tuitje@technology.de, pgsql-performance@postgresql.org, guillaume.smet@openwide.fr Subject: Re: Very slow queries - please help Date: Thu, 24 Nov 2005 18:14:53 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 24 Nov 2005 18:14:53.0308 (UTC) FILETIME=[F77A0BC0:01C5F122] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.439 required=5 tests=[AWL=-0.480, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.439 X-Spam-Level: * X-Archive-Number: 200511/502 X-Sequence-Number: 15759 OK. The consensus seems to be that I need more indexes and I also need to look into the NOT IN statement as a possible bottleneck. I've introduced the indexes which has led to a DRAMATIC change in response time. Now I have to experiment with INNER JOIN -> OUTER JOIN variations, SET ENABLE_SEQSCAN=OFF. Forgive me for not mentioning each person individually and by name. You have all contributed to confirming what I had suspected (and hoped): that *I* have a lot to learn! I'm attaching table descriptions, the first few lines of top output while the queries were running, index lists, sample queries and EXPLAIN ANALYSE output BEFORE and AFTER the introduction of the indexes. As I said, DRAMATIC :) I notice that the CPU usage does not vary very much, it's nearly 100% anyway, but the memory usage drops markedly, which is another very nice result of the index introduction. Any more comments and tips would be very welcome. Thank you all for your input. Bealach. blouser@10.0.0.2.dbdev=> \d job_log Table "blouser.job_log" Column | Type | Modifiers ----------------+-----------------------------+-------------------------------------------------- job_log_id | integer | not null default nextval('job_log_id_seq'::text) first_registry | timestamp without time zone | blogger_name | character(50) | node_id | integer | job_type | character(50) | job_name | character(256) | job_start | timestamp without time zone | job_timeout | interval | job_stop | timestamp without time zone | nfiles_in_job | integer | status | integer | error_code | smallint | Indexes: "job_log_id_pkey" PRIMARY KEY, btree (job_log_id) Check constraints: "job_log_status_check" CHECK (status = 0 OR status = 1 OR status = 8 OR status = 9) Foreign-key constraints: "legal_node" FOREIGN KEY (node_id) REFERENCES node(node_id) blouser@10.0.0.2.dbdev=> \d node Table "blouser.node" Column | Type | Modifiers ---------+---------------+----------------------------------------------- node_id | integer | not null default nextval('node_id_seq'::text) name | character(50) | type | character(1) | usage | character(4) | Indexes: "node_id_pkey" PRIMARY KEY, btree (node_id) "node_name_key" UNIQUE, btree (name) Check constraints: "node_type_check" CHECK ("type" = 'B'::bpchar OR "type" = 'K'::bpchar OR "type" = 'C'::bpchar OR "type" = 'T'::bpchar OR "type" = 'R'::bpchar) "node_usage_check" CHECK ("usage" = 'TEST'::bpchar OR "usage" = 'LIVE'::bpchar) #========================before new indexes were created Tasks: 114 total, 2 running, 112 sleeping, 0 stopped, 0 zombie Cpu(s): 25.7% us, 24.5% sy, 0.0% ni, 49.4% id, 0.3% wa, 0.0% hi, 0.0% si Mem: 1554788k total, 1513576k used, 41212k free, 31968k buffers Swap: 1020024k total, 27916k used, 992108k free, 708728k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 25883 postgres 25 0 20528 12m 11m R 99.7 0.8 4:54.91 postmaster blouser@10.0.0.2.dbdev=> \di List of relations Schema | Name | Type | Owner | Table ---------+-----------------+-------+---------+--------- blouser | job_log_id_pkey | index | blouser | job_log blouser | node_id_pkey | index | blouser | node blouser | node_name_key | index | blouser | node (3 rows) EXPLAIN ANALYSE SELECT n.name,n.type, n.usage, j.status, j.job_start,j.job_stop, j.nfiles_in_job,j.job_name FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '711%' AND n.type = 'K' AND n.usage = 'LIVE' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-14 05:00:00' OR j.job_stop IS NULL) ORDER BY n.name; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..75753.31 rows=1 width=461) (actual time=270486.692..291662.350 rows=3 loops=1) Join Filter: ("inner".node_id = "outer".node_id) -> Index Scan using node_name_key on node n (cost=0.00..307.75 rows=1 width=181) (actual time=0.135..11.034 rows=208 loops=1) Filter: ((name ~~ '711%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar)) -> Seq Scan on job_log j (cost=0.00..75445.54 rows=1 width=288) (actual time=273.374..1402.089 rows=22 loops=208) Filter: ((job_name = 'COPY FILES'::bpchar) AND (job_start >= '2005-11-14 00:00:00'::timestamp without time zone) AND ((job_stop <= '2005-11-14 05:00:00'::timestamp without time zone) OR (job_stop IS NULL))) Total runtime: 291662.482 ms (7 rows) EXPLAIN ANALYSE SELECT n.name, n.type, n.usage FROM node n WHERE n.name LIKE '56x%' AND n.type = 'K' AND n.usage = 'LIVE' AND n.node_id NOT IN (SELECT n.node_id FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '711%' AND n.type = 'K' AND n.usage = 'LIVE' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-14 05:00:00' OR j.job_stop IS NULL)) ORDER BY n.name; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Index Scan using node_name_key on node n (cost=75451.55..75764.94 rows=1 width=177) (actual time=1394.617..1398.609 rows=205 loops=1) Filter: ((name ~~ '56x%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar) AND (NOT (hashed subplan))) SubPlan -> Nested Loop (cost=0.00..75451.54 rows=1 width=4) (actual time=1206.622..1394.462 rows=3 loops=1) -> Seq Scan on job_log j (cost=0.00..75445.54 rows=1 width=4) (actual time=271.361..1393.363 rows=22 loops=1) Filter: ((job_name = 'COPY FILES'::bpchar) AND (job_start >= '2005-11-14 00:00:00'::timestamp without time zone) AND ((job_stop <= '2005-11-14 05:00:00'::timestamp without time zone) OR (job_stop IS NULL))) -> Index Scan using node_id_pkey on node n (cost=0.00..5.99 rows=1 width=4) (actual time=0.042..0.042 rows=0 loops=22) Index Cond: ("outer".node_id = n.node_id) Filter: ((name ~~ '711%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar)) Total runtime: 1398.868 ms (10 rows) #===================================after the new indexes were created Tasks: 114 total, 2 running, 112 sleeping, 0 stopped, 0 zombie Cpu(s): 22.9% us, 27.2% sy, 0.0% ni, 49.7% id, 0.0% wa, 0.2% hi, 0.0% si Mem: 1554788k total, 1414632k used, 140156k free, 14784k buffers Swap: 1020024k total, 28008k used, 992016k free, 623652k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 26409 postgres 25 0 21580 8684 7116 R 99.9 0.6 0:25.38 postmaster Schema | Name | Type | Owner | Table ---------+--------------------+-------+---------+--------- blouser | idx_job_log_filter | index | blouser | job_log blouser | idx_node_filter | index | blouser | node blouser | job_log_id_pkey | index | blouser | job_log blouser | node_id_pkey | index | blouser | node blouser | node_name_key | index | blouser | node (5 rows) EXPLAIN ANALYSE SELECT n.name,n.type, n.usage, j.status, j.job_start,j.job_stop, j.nfiles_in_job,j.job_name FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '711%' AND n.type = 'K' AND n.usage = 'LIVE' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-14 05:00:00' OR j.job_stop IS NULL) ORDER BY n.name; ---------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=18049.23..18049.23 rows=1 width=461) (actual time=223.540..223.543 rows=3 loops=1) Sort Key: n.name -> Nested Loop (cost=0.00..18049.22 rows=1 width=461) (actual time=201.575..223.470 rows=3 loops=1) -> Index Scan using idx_job_log_filter on job_log j (cost=0.00..18043.21 rows=1 width=288) (actual time=52.567..222.855 rows=22 loops=1) Index Cond: ((job_name = 'COPY FILES'::bpchar) AND (job_start >= '2005-11-14 00:00:00'::timestamp without time zone)) Filter: ((job_stop <= '2005-11-14 05:00:00'::timestamp without time zone) OR (job_stop IS NULL)) -> Index Scan using node_id_pkey on node n (cost=0.00..5.99 rows=1 width=181) (actual time=0.022..0.022 rows=0 loops=22) Index Cond: ("outer".node_id = n.node_id) Filter: ((name ~~ '711%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar)) Total runtime: 223.677 ms (10 rows) EXPLAIN ANALYSE SELECT n.name, n.type, n.usage FROM node n WHERE n.name LIKE '56x%' AND n.type = 'K' AND n.usage = 'LIVE' AND n.node_id NOT IN (SELECT n.node_id FROM job_log j INNER JOIN node n ON j.node_id = n.node_id WHERE n.name LIKE '711%' AND n.type = 'K' AND n.usage = 'LIVE' AND j.job_name = 'COPY FILES' AND j.job_start >= '2005-11-14 00:00:00' AND (j.job_stop <= '2005-11-14 05:00:00' OR j.job_stop IS NULL)) ORDER BY n.name; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=18141.89..18141.89 rows=1 width=177) (actual time=223.495..223.627 rows=205 loops=1) Sort Key: name -> Seq Scan on node n (cost=18049.22..18141.88 rows=1 width=177) (actual time=220.293..222.526 rows=205 loops=1) Filter: ((name ~~ '56x%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar) AND (NOT (hashed subplan))) SubPlan -> Nested Loop (cost=0.00..18049.22 rows=1 width=4) (actual time=198.343..220.195 rows=3 loops=1) -> Index Scan using idx_job_log_filter on job_log j (cost=0.00..18043.21 rows=1 width=4) (actual time=50.748..219.741 rows=22 loops=1) Index Cond: ((job_name = 'COPY FILES'::bpchar) AND (job_start >= '2005-11-14 00:00:00'::timestamp without time zone)) Filter: ((job_stop <= '2005-11-14 05:00:00'::timestamp without time zone) OR (job_stop IS NULL)) -> Index Scan using node_id_pkey on node n (cost=0.00..5.99 rows=1 width=4) (actual time=0.015..0.016 rows=0 loops=22) Index Cond: ("outer".node_id = n.node_id) Filter: ((name ~~ '711%'::text) AND ("type" = 'K'::bpchar) AND ("usage" = 'LIVE'::bpchar)) Total runtime: 223.860 ms (13 rows) From pgsql-performance-owner@postgresql.org Thu Nov 24 14:51:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D0A58D838E for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 14:51:44 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84659-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 18:51:44 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay101-f8.bay101.hotmail.com [64.4.56.18]) by svr1.postgresql.org (Postfix) with ESMTP id 3F56DD7945 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 14:51:42 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 24 Nov 2005 10:51:42 -0800 Message-ID: <BAY101-F89370E7A3812718A5D240AD540@phx.gbl> Received: from 64.4.56.200 by by101fd.bay101.hotmail.msn.com with HTTP; Thu, 24 Nov 2005 18:51:42 GMT X-Originating-IP: [84.210.10.106] X-Originating-Email: [bealach_na_bo@hotmail.com] X-Sender: bealach_na_bo@hotmail.com From: "Bealach-na Bo" <bealach_na_bo@hotmail.com> To: pgsql-performance@postgresql.org Subject: Very slow queries - please help Date: Thu, 24 Nov 2005 18:51:42 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 24 Nov 2005 18:51:42.0967 (UTC) FILETIME=[1C894070:01C5F128] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.439 required=5 tests=[AWL=-0.480, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.439 X-Spam-Level: * X-Archive-Number: 200511/503 X-Sequence-Number: 15760 A quick note to say that I'm very grateful for Tom Lane's input also. Tom, I did put you on the list of recipients for my last posting to pgsql-performance, but got: --------------------cut here-------------------- This is an automatically generated Delivery Status Notification. Delivery to the following recipients failed. tgl@sss.pgh.pa.us Many regards, Bealach From pgsql-performance-owner@postgresql.org Thu Nov 24 18:08:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D973BDBD00 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 18:08:01 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06557-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 22:08:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [203.96.152.180]) by svr1.postgresql.org (Postfix) with ESMTP id 1DC67DBCCA for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 18:07:59 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQH00L32C5AXK@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 25 Nov 2005 11:08:00 +1300 (NZDT) Received: from [192.168.1.11] (218-101-28-43.dsl.clear.net.nz [218.101.28.43]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 56F1EEF76AF; Fri, 25 Nov 2005 11:07:52 +1300 (NZDT) Date: Fri, 25 Nov 2005 11:07:50 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <14286.1132849528@sss.pgh.pa.us> To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Greg Stark <gsstark@mit.edu>, Luke Lonergan <llonergan@greenplum.com>, stange@rentec.com, Dave Cramer <pg@fastcrypt.com>, Joshua Marsh <icub3d@gmail.com>, pgsql-performance@postgresql.org Message-id: <438639B6.5090902@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <BFAAB702.1460D%llonergan@greenplum.com> <438583C8.4050809@paradise.net.nz> <87d5kqkpd2.fsf@stark.xeocode.com> <14286.1132849528@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.176 required=5 tests=[AWL=0.176] X-Spam-Score: 0.176 X-Spam-Level: X-Archive-Number: 200511/504 X-Sequence-Number: 15761 Tom Lane wrote: > Greg Stark <gsstark@mit.edu> writes: > >>Last I heard the reason count(*) was so expensive was because its state >>variable was a bigint. That means it doesn't fit in a Datum and has to be >>alloced and stored as a pointer. And because of the Aggregate API that means >>it has to be allocated and freed for every tuple processed. > > > There's a hack in 8.1 to avoid the palloc overhead (courtesy of Neil > Conway IIRC). > It certainly makes quite a difference as I measure it: doing select(1) from a 181000 page table (completely uncached) on my PIII: 8.0 : 32 s 8.1 : 25 s Note that the 'fastcount()' function takes 21 s in both cases - so all the improvement seems to be from the count overhead reduction. Cheers Mark From pgsql-performance-owner@postgresql.org Thu Nov 24 20:03:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 16AEADBA23 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 20:03:09 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44818-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 00:03:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0C23CDBD11 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 19:34:32 -0400 (AST) Received: from [192.168.0.1] (cev75-1-81-57-249-136.fbx.proxad.net [81.57.249.136]) (authenticated bits=0) by mail.rilk.com (8.13.0/8.13.0) with ESMTP id jAONYIjo028081 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 00:34:32 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> Content-Transfer-Encoding: quoted-printable From: Pailloncy Jean-Gerard <jg@rilk.com> Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Date: Fri, 25 Nov 2005 00:34:16 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-DCC-NIET-Metrics: mail.rilk.com 1080; env_From=1 Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/505 X-Sequence-Number: 15762 I redo the test, with a freshly installed data directory. Same result. Note: This is the full log. I just suppress the mistake I do like =20 "sl" for "ls". Jean-G=E9rard Pailloncy Last login: Thu Nov 24 12:52:32 2005 from 192.168.0.1 OpenBSD 3.8 (WDT) #2: Tue Nov 8 00:52:38 CET 2005 Welcome to OpenBSD: The proactively secure Unix-like operating system. Please use the sendbug(1) utility to report bugs in the system. Before reporting a bug, please try to reproduce it with the latest version of the code. With bug reports, please try to ensure that enough information to reproduce the problem is enclosed, and if a known fix for it exists, include that as well. Terminal type? [xterm-color] # cd /mnt2/pg/install/bin/ # mkdir /mnt2/pg/data # chown -R _pgsql:_pgsql /mnt2/pg/data # su _pgsql $ ls clusterdb droplang pg_config pg_resetxlog =20 reindexdb createdb dropuser pg_controldata pg_restore =20 vacuumdb createlang ecpg pg_ctl postgres createuser initdb pg_dump postmaster dropdb ipcclean pg_dumpall psql $ ./initdb -D /mnt2/pg/data The files belonging to this database system will be owned by user =20 "_pgsql". This user must also own the server process. The database cluster will be initialized with locale C. fixing permissions on existing directory /mnt2/pg/data ... ok creating directory /mnt2/pg/data/global ... ok creating directory /mnt2/pg/data/pg_xlog ... ok creating directory /mnt2/pg/data/pg_xlog/archive_status ... ok creating directory /mnt2/pg/data/pg_clog ... ok creating directory /mnt2/pg/data/pg_subtrans ... ok creating directory /mnt2/pg/data/pg_twophase ... ok creating directory /mnt2/pg/data/pg_multixact/members ... ok creating directory /mnt2/pg/data/pg_multixact/offsets ... ok creating directory /mnt2/pg/data/base ... ok creating directory /mnt2/pg/data/base/1 ... ok creating directory /mnt2/pg/data/pg_tblspc ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 1000 creating configuration files ... ok creating template1 database in /mnt2/pg/data/base/1 ... ok initializing pg_authid ... ok enabling unlimited row size for system tables ... ok initializing dependencies ... ok creating system views ... ok loading pg_description ... ok creating conversions ... ok setting privileges on built-in objects ... ok creating information schema ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the -A option the next time you run initdb. Success. You can now start the database server using: ./postmaster -D /mnt2/pg/data or ./pg_ctl -D /mnt2/pg/data -l logfile start $ ./pg_ctl -D /mnt2/pg/data -l /mnt2/pg/data/logfile start postmaster starting $ ./psql postgres Welcome to psql 8.1.0, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit postgres=3D# create table test (id serial, val integer); NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for =20= serial column "test.id" CREATE TABLE postgres=3D# create unique index testid on test (id); CREATE INDEX postgres=3D# create index testval on test (val); CREATE INDEX postgres=3D# insert into test (val) values (round(random()=20 *1024*1024*1024)); INSERT 0 1 postgres=3D# vacuum full analyze; VACUUM postgres=3D# select count(1) from test; count ------- 1 (1 row) postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ---------------------------------------------------------------------- Aggregate (cost=3D1.04..1.05 rows=3D1 width=3D0) -> Unique (cost=3D1.02..1.03 rows=3D1 width=3D8) -> Sort (cost=3D1.02..1.02 rows=3D1 width=3D8) Sort Key: test.val -> Seq Scan on test (cost=3D0.00..1.01 rows=3D1 = width=3D8) (5 rows) postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 1 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 2 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 4 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 8 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 16 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 32 postgres=3D# vacuum full analyze; VACUUM postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ----------------------------------------------------------------------- Aggregate (cost=3D4.68..4.69 rows=3D1 width=3D0) -> Unique (cost=3D3.56..3.88 rows=3D64 width=3D8) -> Sort (cost=3D3.56..3.72 rows=3D64 width=3D8) Sort Key: test.val -> Seq Scan on test (cost=3D0.00..1.64 rows=3D64 = width=3D8) (5 rows) postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 64 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 128 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 256 postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 512 postgres=3D# vacuum full analyze; VACUUM postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ------------ Aggregate (cost=3D55.63..55.64 rows=3D1 width=3D0) -> Unique (cost=3D0.00..42.82 rows=3D1024 width=3D8) -> Index Scan using testval on test (cost=3D0.00..40.26 =20 rows=3D1024 width=3D8) (3 rows) postgres=3D# select count(1) from test; count ------- 1024 (1 row) postgres=3D# set enable_indexscan=3Doff; SET postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= -- Aggregate (cost=3D85.36..85.37 rows=3D1 width=3D0) -> Unique (cost=3D67.44..72.56 rows=3D1024 width=3D8) -> Sort (cost=3D67.44..70.00 rows=3D1024 width=3D8) Sort Key: test.val -> Seq Scan on test (cost=3D0.00..16.24 rows=3D1024 =20= width=3D8) (5 rows) postgres=3D# set enable_indexscan=3Don; SET postgres=3D# insert into test (val) select round(random()=20 *1024*1024*1024) from test; INSERT 0 1024 postgres=3D# vacuum full analyze; VACUUM postgres=3D# explain select count(*) from (select distinct on (val) * =20= from test) as foo; QUERY PLAN ------------------------------------------------------------------------=20= ------------ Aggregate (cost=3D105.25..105.26 rows=3D1 width=3D0) -> Unique (cost=3D0.00..79.65 rows=3D2048 width=3D8) -> Index Scan using testval on test (cost=3D0.00..74.53 =20 rows=3D2048 width=3D8) (3 rows) postgres=3D# From pgsql-performance-owner@postgresql.org Thu Nov 24 22:37:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0BC1EDBCC6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Thu, 24 Nov 2005 22:37:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79409-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 02:37:55 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 67F61DB839 for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 22:37:49 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAP2brcw017381; Thu, 24 Nov 2005 21:37:53 -0500 (EST) To: Pailloncy Jean-Gerard <jg@rilk.com> cc: pgsql-performance@postgresql.org Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan In-reply-to: <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> Comments: In-reply-to Pailloncy Jean-Gerard <jg@rilk.com> message dated "Fri, 25 Nov 2005 00:34:16 +0100" Date: Thu, 24 Nov 2005 21:37:53 -0500 Message-ID: <17380.1132886273@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/506 X-Sequence-Number: 15763 Pailloncy Jean-Gerard <jg@rilk.com> writes: > I redo the test, with a freshly installed data directory. Same result. What "same result"? You only ran it up to 2K rows, not 2M. In any case, EXPLAIN without ANALYZE is pretty poor ammunition for complaining that the planner made the wrong choice. I ran the same test case, and AFAICS the indexscan is the right choice at 2K rows: regression=# explain analyze select count(*) from (select distinct on (val) * from test) as foo; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=105.24..105.25 rows=1 width=0) (actual time=41.561..41.565 rows=1 loops=1) -> Unique (cost=0.00..79.63 rows=2048 width=8) (actual time=0.059..32.459 rows=2048 loops=1) -> Index Scan using testval on test (cost=0.00..74.51 rows=2048 width=8) (actual time=0.049..13.197 rows=2048 loops=1) Total runtime: 41.683 ms (4 rows) regression=# set enable_indexscan TO 0; SET regression=# explain analyze select count(*) from (select distinct on (val) * from test) as foo; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- Aggregate (cost=179.96..179.97 rows=1 width=0) (actual time=59.567..59.571 rows=1 loops=1) -> Unique (cost=144.12..154.36 rows=2048 width=8) (actual time=21.438..50.434 rows=2048 loops=1) -> Sort (cost=144.12..149.24 rows=2048 width=8) (actual time=21.425..30.589 rows=2048 loops=1) Sort Key: test.val -> Seq Scan on test (cost=0.00..31.48 rows=2048 width=8) (actual time=0.014..9.902 rows=2048 loops=1) Total runtime: 60.265 ms (6 rows) regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 25 00:21:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F51DDBD91 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 00:20:59 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19676-02-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 04:20:56 +0000 (GMT) X-Greylist: delayed 01:05:44.879458 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 3AF93DBCA4 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 00:20:55 -0400 (AST) Received: from pillage.dreamhost.com (pillage.dreamhost.com [66.33.213.23]) by svr2.postgresql.org (Postfix) with ESMTP id 30752F0B00 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 03:15:17 +0000 (GMT) Received: from [127.0.0.1] (ip-66-33-217-47.dreamhost.com [66.33.217.47]) by pillage.dreamhost.com (Postfix) with ESMTP id B5B46BE8C for <pgsql-performance@postgresql.org>; Thu, 24 Nov 2005 19:15:12 -0800 (PST) Message-ID: <438681E0.6070006@kylecordes.com> Date: Thu, 24 Nov 2005 21:15:44 -0600 From: Kyle Cordes <kyle@kylecordes.com> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> <17380.1132886273@sss.pgh.pa.us> In-Reply-To: <17380.1132886273@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/507 X-Sequence-Number: 15764 Tom Lane wrote: >What "same result"? You only ran it up to 2K rows, not 2M. In any >case, EXPLAIN without ANALYZE is pretty poor ammunition for complaining >that the planner made the wrong choice. I ran the same > Hello, sorry to jump in mid-stream, but this reminded me of something. I have hit cases where I have a query for which there is a somewhat "obvious" (to a human...) query plan that should make it possible to get a query answer pretty quickly. Yet the query "never" finishes (or rather, after hours of waiting I finally kill it). I assume this is because of a sub-optimal query plan. But, it appears that an EXPLAIN ANALYZE runs the actual query, so it takes as long as the actual query. In such a case, how can I go about tracking down the issue, up to an including a complaint about the query planner? :-) (Overall, I'm pretty pleased with the PG query planner; it often gets better results than another, popular commercial DBMS we use here.... that is just a general impression, not the result of setting up the same schema in each for a comparison.) Kyle Cordes www.kylecordes.com From pgsql-performance-owner@postgresql.org Fri Nov 25 00:50:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A797AD9582 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 00:50:06 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29647-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 04:50:04 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from travis.trilogy.com (unknown [149.75.65.93]) by svr1.postgresql.org (Postfix) with ESMTP id E936CD859B for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 00:50:03 -0400 (AST) To: Tom Lane <tgl@sss.pgh.pa.us> Cc: pgsql-performance@postgresql.org Subject: Re: xlog flush request error MIME-Version: 1.0 X-Mailer: Lotus Notes Release 5.0.9 November 16, 2001 Message-ID: <OF216BE6EA.7FF65954-ON862570C4.001A3FC6@trilogy.com> From: Vipul.Gupta@trilogy.com Date: Thu, 24 Nov 2005 22:48:17 -0600 X-MIMETrack: Serialize by Router on Travis/Trilogy(Release 5.0.12 |February 13, 2003) at 11/24/2005 10:48:22 PM, Serialize complete at 11/24/2005 10:48:22 PM Content-Type: multipart/alternative; boundary="=_alternative 001A79C8652570C4_=" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.551 required=5 tests=[HTML_MESSAGE=0.001, NO_REAL_NAME=0.55] X-Spam-Score: 0.551 X-Spam-Level: X-Archive-Number: 200511/508 X-Sequence-Number: 15765 This is a multipart message in MIME format. --=_alternative 001A79C8652570C4_= Content-Type: text/plain; charset="us-ascii" Hi tom, basically when i run any query with database say, select count(*) from table1; It gives me the following error trace: WARNING: could not write block 297776 of 1663/2110743/2110807 DETAIL: Multiple failures --- write error may be permanent. ERROR: xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324 writing block 297776 of relation 1663/2110743/2110807 xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324 xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324\q i tried using pg_resetxlog but till date, have not been able to solve this problem Regards, Vipul Gupta Tom Lane <tgl@sss.pgh.pa.us> 11/24/2005 09:07 PM To: Vipul.Gupta@trilogy.com cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] xlog flush request error Vipul.Gupta@trilogy.com writes: > Can anyone suggest how do i fix this > xlog flush request 7/7D02338C is not satisfied --- flushed only to > 3/2471E324 This looks like corrupt data to me --- specifically, garbage in the LSN field of a page header. Is that all you get? PG 7.4 and up should tell you the problem page number in a CONTEXT: line. regards, tom lane --=_alternative 001A79C8652570C4_= Content-Type: text/html; charset="us-ascii" <br><font size=2 face="sans-serif">Hi tom,</font> <br> <br><font size=2 face="sans-serif">basically when i run any query with database say,</font> <br> <br><font size=2 face="sans-serif">select count(*) from table1;</font> <br> <br><font size=2 face="sans-serif">It gives me the following error trace: </font> <br><font size=2 face="sans-serif">WARNING:  could not write block 297776 of 1663/2110743/2110807</font> <br><font size=2 face="sans-serif">DETAIL:  Multiple failures --- write error may be permanent.</font> <br><font size=2 face="sans-serif">ERROR:  xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324</font> <br><font size=2 face="sans-serif"> writing block 297776 of relation 1663/2110743/2110807</font> <br><font size=2 face="sans-serif">xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324</font> <br><font size=2 face="sans-serif">xlog flush request 7/7D02338C is not satisfied --- flushed only to 3/2471E324\q</font> <br> <br><font size=2 face="sans-serif">i tried using pg_resetxlog but till date, have not been able to solve this problem </font> <br> <br><font size=2 face="sans-serif">Regards,</font> <br><font size=2 face="sans-serif">Vipul Gupta<br> </font> <br> <br> <br> <table width=100%> <tr valign=top> <td> <td><font size=1 face="sans-serif"><b>Tom Lane <tgl@sss.pgh.pa.us></b></font> <p><font size=1 face="sans-serif">11/24/2005 09:07 PM</font> <br> <td><font size=1 face="Arial">        </font> <br><font size=1 face="sans-serif">        To:        Vipul.Gupta@trilogy.com</font> <br><font size=1 face="sans-serif">        cc:        pgsql-performance@postgresql.org</font> <br><font size=1 face="sans-serif">        Subject:        Re: [PERFORM] xlog flush request error</font></table> <br> <br> <br><font size=2 face="Courier New">Vipul.Gupta@trilogy.com writes:<br> > Can anyone suggest how do i fix this<br> <br> >  xlog flush request 7/7D02338C is not satisfied --- flushed only to <br> > 3/2471E324<br> <br> This looks like corrupt data to me --- specifically, garbage in the LSN<br> field of a page header.  Is that all you get?  PG 7.4 and up should tell<br> you the problem page number in a CONTEXT: line.<br> <br>                                                   regards, tom lane<br> <br> </font> <br> <br> --=_alternative 001A79C8652570C4_=-- From pgsql-performance-owner@postgresql.org Fri Nov 25 00:59:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF456DA206 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 00:59:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28155-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 04:59:28 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4E2ADD9C61 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 00:59:26 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAP4xQdc018822; Thu, 24 Nov 2005 23:59:26 -0500 (EST) To: Vipul.Gupta@trilogy.com cc: pgsql-performance@postgresql.org Subject: Re: xlog flush request error In-reply-to: <OF216BE6EA.7FF65954-ON862570C4.001A3FC6@trilogy.com> References: <OF216BE6EA.7FF65954-ON862570C4.001A3FC6@trilogy.com> Comments: In-reply-to Vipul.Gupta@trilogy.com message dated "Thu, 24 Nov 2005 22:48:17 -0600" Date: Thu, 24 Nov 2005 23:59:26 -0500 Message-ID: <18821.1132894766@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/509 X-Sequence-Number: 15766 Vipul.Gupta@trilogy.com writes: > ERROR: xlog flush request 7/7D02338C is not satisfied --- flushed only to > 3/2471E324 > writing block 297776 of relation 1663/2110743/2110807 You need to fix or zero out that data block ... regards, tom lane From pgsql-performance-owner@postgresql.org Fri Nov 25 07:40:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBFF6D6ED8 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 07:40:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82999-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 11:40:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 1E872D78B6 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 07:40:45 -0400 (AST) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Efbwc-0007Km-3Z for pgsql-performance@postgresql.org; Fri, 25 Nov 2005 12:40:47 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Efbw9-0002mz-00 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 12:40:17 +0100 Date: Fri, 25 Nov 2005 12:40:17 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Message-ID: <20051125114017.GA10575@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> <17380.1132886273@sss.pgh.pa.us> <438681E0.6070006@kylecordes.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <438681E0.6070006@kylecordes.com> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/510 X-Sequence-Number: 15767 On Thu, Nov 24, 2005 at 09:15:44PM -0600, Kyle Cordes wrote: > I have hit cases where I have a query for which there is a somewhat > "obvious" (to a human...) query plan that should make it possible to get > a query answer pretty quickly. Yet the query "never" finishes (or > rather, after hours of waiting I finally kill it). I assume this is > because of a sub-optimal query plan. But, it appears that an EXPLAIN > ANALYZE runs the actual query, so it takes as long as the actual query. In this case, you probably can't do better than EXPLAIN. Look at the estimates, find out if the cost is way high somewhere. If a simple query estimates a billion disk page fetches, something is probably wrong, ie. the planner did for some reason overlook the query plan you were thinking of. (A common problem here used to include data type mismatches leading to less efficient joins, lack of index scans and less efficient IN/NOT IN; most of that is fixed, but a few cases still remain.) If the query is estimated at a reasonable amount of disk page fetches but still takes forever, look at the number of estimated rows returned. Do they make sense? If you run subsets of your query, are they about right? If not, you probably want to fiddle with the statistics targets. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Nov 25 08:31:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A1B58D7281 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 08:31:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88048-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 12:31:51 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by svr1.postgresql.org (Postfix) with ESMTP id A8843D721C for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 08:31:46 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 25 Nov 2005 09:32:41 -0300 Received: from alvh.no-ip.org (200.85.218.89) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43501597005A0448 for pgsql-performance@postgresql.org; Fri, 25 Nov 2005 09:31:49 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id C5E33C30B0D; Fri, 25 Nov 2005 09:32:00 -0300 (CLST) Date: Fri, 25 Nov 2005 09:32:00 -0300 From: Alvaro Herrera <alvherre@commandprompt.com> To: pgsql-performance@postgresql.org Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Message-ID: <20051125123200.GD14707@surnet.cl> Mail-Followup-To: pgsql-performance@postgresql.org References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> <17380.1132886273@sss.pgh.pa.us> <438681E0.6070006@kylecordes.com> <20051125114017.GA10575@uio.no> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051125114017.GA10575@uio.no> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=3.487 required=5 tests=[AWL=-0.582, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_NJABL_PROXY=0.327, RCVD_IN_SORBS_SOCKS=1.823] X-Spam-Score: 3.487 X-Spam-Level: *** X-Archive-Number: 200511/511 X-Sequence-Number: 15768 Steinar H. Gunderson wrote: > On Thu, Nov 24, 2005 at 09:15:44PM -0600, Kyle Cordes wrote: > > I have hit cases where I have a query for which there is a somewhat > > "obvious" (to a human...) query plan that should make it possible to get > > a query answer pretty quickly. Yet the query "never" finishes (or > > rather, after hours of waiting I finally kill it). I assume this is > > because of a sub-optimal query plan. But, it appears that an EXPLAIN > > ANALYZE runs the actual query, so it takes as long as the actual query. > > In this case, you probably can't do better than EXPLAIN. Look at the > estimates, find out if the cost is way high somewhere. Also you want to make absolutely sure all the involved tables have been ANALYZEd recently. If you have weird cases where there is an obvious query plan and the optimizer is not using it, by all means submit it so that developers can take a look at how to improve the optimizer. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. From pgsql-performance-owner@postgresql.org Fri Nov 25 10:47:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D8106DBD8C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 10:47:31 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20737-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 14:47:34 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) by svr1.postgresql.org (Postfix) with ESMTP id A57DEDBD8B for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 10:47:28 -0400 (AST) Received: from [192.168.0.1] (cev75-1-81-57-249-136.fbx.proxad.net [81.57.249.136]) (authenticated bits=0) by mail.rilk.com (8.13.0/8.13.0) with ESMTP id jAPElIwn012874 (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 15:47:32 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <17380.1132886273@sss.pgh.pa.us> References: <334D9941-B5B3-4D18-8312-F85D0FB054ED@rilk.com> <A6F55E12-4479-49F6-B3EE-8CFCC8541179@rilk.com> <17380.1132886273@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <78D03263-E40B-4E49-964C-D8013225247F@rilk.com> Content-Transfer-Encoding: quoted-printable From: Pailloncy Jean-Gerard <jg@rilk.com> Subject: Re: 8.1 count(*) distinct: IndexScan/SeqScan Date: Fri, 25 Nov 2005 15:47:16 +0100 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-DCC-CTc-dcc2-Metrics: mail.rilk.com 1031; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/512 X-Sequence-Number: 15769 > What "same result"? You only ran it up to 2K rows, not 2M. In any Sorry, I do this over and over until xxx.000 rows but I do not write =20 in the mail. I do it again. initdb, create table, insert, vacuum full analyze, =20 explain analyze at each stage. And there was no problem. So I make a copy of the offending data directory, and try again. And =20 I got IndexScan only. I will get an headheak ;-) Too big to be send by mail: http://rilk.com/pg81.html Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Fri Nov 25 15:36:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06C01DBDF9 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 15:36:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73941-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 19:36:38 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id 97137DBDF8 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 15:36:35 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 55so714650wri for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 11:36:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Y4ngQ8e4GRwETACod41hWBFRmXd2/Lbc6yVcPSCQYweagTH86PRjucJTu6Do68ky55uBF1n3TJ7oTw26Z3LLGop+4yurxDY+oTFza34EqZI7fY2QiYUdpJeCm1NTAz7obqE6pOP0AwzqUXvk/bt6C2sA081cNiD0nX5QkXgOGrw= Received: by 10.65.137.14 with SMTP id p14mr8966872qbn; Fri, 25 Nov 2005 11:36:36 -0800 (PST) Received: by 10.65.177.1 with HTTP; Fri, 25 Nov 2005 11:36:35 -0800 (PST) Message-ID: <3cf983d0511251136j1afa0ec4i9a3987d250befe47@mail.gmail.com> Date: Fri, 25 Nov 2005 19:36:35 +0000 From: Rodrigo Madera <rodrigo.madera@gmail.com> To: pgsql-performance@postgresql.org Subject: Newbie question: ultra fast count(*) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/513 X-Sequence-Number: 15770 I have been reading all this technical talk about costs and such that I don't (_yet_) understand. Now I'm scared... what's the fastest way to do an equivalent of count(*) on a table to know how many items it has? Thanks, Rodrigo From pgsql-performance-owner@postgresql.org Fri Nov 25 15:40:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 19FB4D7F97 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 15:40:10 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76037-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Fri, 25 Nov 2005 19:40:09 +0000 (GMT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.202]) by svr1.postgresql.org (Postfix) with ESMTP id 63AB5D6FE3 for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 15:40:05 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s19so1565452wxc for <pgsql-performance@postgresql.org>; Fri, 25 Nov 2005 11:40:06 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SWqUATreWpkUqOlNonwH4bX2BtsD7rmaX6V6RW7YnYPAz3ST5YMsfFcIFRSitdJ4j71XGdpWojiku4gYk3PT8DxsYkr8O6jSQu4xyc0VXZmgomcGRGIO+FnJ11CEWLr1AfXi2yruFXKOcK66f+PadaW821tbE8Rlaa/4UpNSCjI= Received: by 10.65.206.3 with SMTP id i3mr8690384qbq; Fri, 25 Nov 2005 11:40:06 -0800 (PST) Received: by 10.65.180.14 with HTTP; Fri, 25 Nov 2005 11:40:06 -0800 (PST) Message-ID: <c2d9e70e0511251140x5f2a6c2ah6fc81d88fcfb2213@mail.gmail.com> Date: Fri, 25 Nov 2005 14:40:06 -0500 From: Jaime Casanova <systemguards@gmail.com> To: Rodrigo Madera <rodrigo.madera@gmail.com> Subject: Re: Newbie question: ultra fast count(*) Cc: pgsql-performance@postgresql.org In-Reply-To: <3cf983d0511251136j1afa0ec4i9a3987d250befe47@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3cf983d0511251136j1afa0ec4i9a3987d250befe47@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.364 required=5 tests=[AWL=0.364] X-Spam-Score: 0.364 X-Spam-Level: X-Archive-Number: 200511/514 X-Sequence-Number: 15771 On 11/25/05, Rodrigo Madera <rodrigo.madera@gmail.com> wrote: > I have been reading all this technical talk about costs and such that > I don't (_yet_) understand. > > Now I'm scared... what's the fastest way to do an equivalent of > count(*) on a table to know how many items it has? > > Thanks, > Rodrigo > you really *need* this? you can do SELECT reltuples FROM pg_class WHERE relname =3D 'your_table_name'; but this will give you an estimate... if you want real values you can make a TRIGGER that maintain a counter in another table -- regards, Jaime Casanova (DBA: DataBase Aniquilator ;) From pgsql-performance-owner@postgresql.org Sun Nov 27 00:40:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F265DA7E2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 00:40:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72345-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 04:40:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by svr1.postgresql.org (Postfix) with ESMTP id 7056DD778E for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 00:40:22 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 6E43A1AC3E9 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 17:36:57 -0800 (PST) Date: Sat, 26 Nov 2005 06:28:50 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input Message-ID: <Pine.LNX.4.62.0511260608030.2790@qnivq.ynat.uz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.746 required=5 tests=[DATE_IN_PAST_06_12=0.746] X-Spam-Score: 0.746 X-Spam-Level: X-Archive-Number: 200511/520 X-Sequence-Number: 15777 Ok, I've subscribed (hopefully list volume won't kill me :-) I'm covering several things in this message since I didn't receive the prior messages in the thread first off these benchamrks are not being sponsered by my employer, they need the machines burned in and so I'm going to use them for the tests while burning them in. I can spend a little official time on this, justifying it as learning the proper config/tuneing settings for our project, but not too much. and I'm deliberatly not useing my work e-mail and am not mentioning the company name, so please respect this and keep the two seperate (some of you have dealt with us formally, others will over the next few months) this means no remote access for people (but I am willing to run tests and send configs around). in fact the machines will not have Internet access for the duration of the tests. it also means I'm doing almost all the configuration work for this on my own time (nights and weekends). the machines will not be moved to production for a couple of months. this should mean that we can go back and forth with questions and answers (albeit somewhat slowly, with me checking in every night) while whatever tests are done happen during the day. once we get past the system tuneing and start doing different tests it would probably be helpful if people can send me scripts to run that I can just let loose. I don't have any money to pay for benchmark suites, so if things like the TPC benchmarks cost money to do I won't be able to do them to clarify the hardware I have 5 machines total to work with, this includes client machines to make the queries (I may be able to get hold of 2-3 more, but they are similar configs) none of these have dual-core processors on them, the CPU's are 246 or 252 Opterons (I'll have to double check which is in which machine, I think the large disk machine has 246's and the others 252's) I have access to a gig-E switch that's on a fairly idle network to use to connect these machines the large-disk machine has 3ware 9500 series 8-port SATA controllers in them with battery backup. in our official dealings with Greenplum we attempted to do a set of benchmarks on that machine, but had horrible timing with me being too busy when they worked with us on this and we never did figure out the best setting to use for this machine. Part of the reason I posted this to /. rather then just contacting you and MySQL folks directly is that I would like to see a reasonable set of benchmarks agreed to and have people with different hardware then I have run the same sets of tests. I know the tuneing will be different for different hardware, but if we can have a bunch of people run similar tests we should learn a lot. David Lang From pgsql-performance-owner@postgresql.org Sun Nov 27 01:47:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 05870D9DA2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 01:47:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77422-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 05:47:09 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by svr1.postgresql.org (Postfix) with ESMTP id 63264D8DAF for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 01:47:08 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id DF9B11AC3EA for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 19:08:39 -0800 (PST) Date: Sat, 26 Nov 2005 08:00:33 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: pgsql-performance@postgresql.org Subject: Open request for benchmarking input Message-ID: <Pine.LNX.4.62.0511260745370.2790@qnivq.ynat.uz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.746 required=5 tests=[DATE_IN_PAST_06_12=0.746] X-Spam-Score: 0.746 X-Spam-Level: X-Archive-Number: 200511/522 X-Sequence-Number: 15779 >These boxes don't look like being designed for a DB server. The first are >very CPU bound, and the third may be a good choice for very large amounts >of streamed data, but not optimal for TP random access. I don't know what you mean when you say that the first ones are CPU bound, they have far more CPU then they do disk I/O however I will agree that they were not designed to be DB servers, they weren't. they happen to be the machines that I have available. they only have a pair of disks each, which would not be reasonable for most production DB uses, and they have far more CPU then is normally reccomended. So I'll have to run raid 0 instead of 0+1 (or not use raid) which would be unacceptable in a production environment, but can still give some useful info. the 5th box _was_ purchased to be a DB server, but one to store and analyse large amounts of log data, so large amounts of data storage were more important then raw DB performance (although we did max out the RAM at 16G to try and make up for it). it was a deliberate price/performance tradeoff. this machine ran ~$20k, but a similar capacity with SCSI drives would have been FAR more expensive (IIRC a multiple of 4x or more more expensive). >Hopefully, when publicly visible benchmarks are performed, machines are >used that comply with common engineering knowledge, ignoring those guys >who still believe that sequential performance is the most important issue >on disk subsystems for DBMS. are you saying that I shouldn't do any benchmarks becouse the machines aren't what you would consider good enough? if so I disagree with you and think that benchmarks should be done on even worse machines, but should also be done on better machines. (are you volunteering to provide time on better machines for benchmarks?) not everyone will buy a lot of high-end hardware before they start useing a database. in fact most companies will start with a database on lower end hardware and then as their requirements grow they will move to better hardware. I'm willing to bet that what I have available is better then the starting point for most places. Postgres needs to work on the low end stuff as well as the high end stuff or people will write their app to work with things that DO run on low end hardware and they spend much more money then is needed to scale the hardware up rather then re-writing their app. Part of the reason that I made the post on /. to start this was the hope that a reasonable set of benchmarks could be hammered out and then more people then just me could run them to get a wider range of results. David Lang From pgsql-performance-owner@postgresql.org Sun Nov 27 00:40:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8CA5BDA924 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 00:40:29 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72048-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 04:40:27 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by svr1.postgresql.org (Postfix) with ESMTP id 750B5DA537 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 00:40:22 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 3BBE21AC3EB for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 19:21:51 -0800 (PST) Date: Sat, 26 Nov 2005 08:13:40 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input Message-ID: <Pine.LNX.4.62.0511260812460.2790@qnivq.ynat.uz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.746 required=5 tests=[DATE_IN_PAST_06_12=0.746] X-Spam-Score: 0.746 X-Spam-Level: X-Archive-Number: 200511/521 X-Sequence-Number: 15778 by the way, this is the discussion that promped me to start this project http://lwn.net/Articles/161323/ David Lang From pgsql-performance-owner@postgresql.org Sat Nov 26 14:28:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7091BDBDCB for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 14:28:54 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74544-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 18:28:52 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp112.sbc.mail.mud.yahoo.com (smtp112.sbc.mail.mud.yahoo.com [68.142.198.211]) by svr1.postgresql.org (Postfix) with SMTP id 254C4DBDA4 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 14:28:49 -0400 (AST) Received: (qmail 91055 invoked from network); 26 Nov 2005 18:28:46 -0000 Received: from unknown (HELO discord.dyndns.org) (jeffroe996@sbcglobal.net@69.227.55.89 with plain) by smtp112.sbc.mail.mud.yahoo.com with SMTP; 26 Nov 2005 18:28:45 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by discord.dyndns.org (8.13.4/8.13.4) with ESMTP id jAQISbL4006064 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 10:28:39 -0800 Date: Sat, 26 Nov 2005 10:28:36 -0800 (PST) From: Jeff Frost <jeff@frostconsultingllc.com> X-X-Sender: jeff@discord.dyndns.org To: pgsql-performance@postgresql.org Subject: Open request for benchmarking input Message-ID: <Pine.LNX.4.64.0511261025140.16022@discord.dyndns.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.028 required=5 tests=[AWL=0.028] X-Spam-Score: 0.028 X-Spam-Level: X-Archive-Number: 200511/515 X-Sequence-Number: 15772 Did you folks see this article on Slashdot with a fellow requesting input on what sort of benchmarks to run to get a good Postgresql vs Mysql dataset? Perhaps this would be a good opportunity for us to get some good benchmarking done. Here's the article link and top text: http://ask.slashdot.org/article.pl?sid=05/11/26/0317213 David Lang asks: "With the release of MySQL 5.0, PostgreSQL 8.1, and the flap over Oracle purchasing InnoDB, the age old question of performance is coming up again. I've got some boxes that were purchased for a data warehouse project that isn't going to be installed for a month or two, and could probably squeeze some time in to do some benchmarks on the machines. However, the question is: what should be done that's reasonably fair to both MySQL and PostgreSQL? We all know that careful selection of the benchmark can seriously skew the results, and I want to avoid that (in fact I would consider it close to ideal if the results came out that each database won in some tests). I would also not like to spend time generating the benchmarks only to have the losing side accuse me of being unfair. So, for both MySQL and PostgreSQL advocates, what would you like to see in a series of benchmarks?" "The hardware I have available is as follows: * 2x dual Opteron 8G ram, 2x144G 15Krpm SCSI * 2x dual Opteron 8G ram, 2x72G 15Krpm SCSI * 1x dual Opteron 16G ram, 2x36G 15Krpm SCSI 16x400G 7200rpm SATA I would prefer to use Debian Sarge as the base install of the systems (with custom built kernels), but would compile the databases from source rather then using binary packages. For my own interests, I would like to at least cover the following bases: 32 bit vs 64 bit vs 64 bit kernel + 32 bit user-space; data warehouse type tests (data >> memory); and web prefs test (active data RAM) What specific benchmarks should be run, and what other things should be tested? Where should I go for assistance on tuning each database, evaluating the benchmark results, and re-tuning them?" --- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954 From pgsql-performance-owner@postgresql.org Sun Nov 27 01:59:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50736D778E for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 01:59:08 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78305-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 05:59:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by svr1.postgresql.org (Postfix) with ESMTP id 8D34EDBE01 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 01:59:05 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 15F3B1AC3E9 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 21:59:25 -0800 (PST) Date: Sat, 26 Nov 2005 10:51:18 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( Message-ID: <Pine.LNX.4.62.0511261040500.2790@qnivq.ynat.uz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.746 required=5 tests=[DATE_IN_PAST_06_12=0.746] X-Spam-Score: 0.746 X-Spam-Level: X-Archive-Number: 200511/523 X-Sequence-Number: 15780 >Another thought - I priced out a maxed out machine with 16 cores and >128GB of RAM and 1.5TB of usable disk - $71,000. > >You could instead buy 8 machines that total 16 cores, 128GB RAM and 28TB >of disk for $48,000, and it would be 16 times faster in scan rate, which >is the most important factor for large databases. The size would be 16 >rack units instead of 5, and you'd have to add a GigE switch for $1500. > >Scan rate for above SMP: 200MB/s > >Scan rate for above cluster: 3,200Mb/s > >You could even go dual core and double the memory on the cluster and >you'd about match the price of the "god box". > >- Luke Luke, I assume you are talking about useing the Greenplum MPP for this (otherwise I don't know how you are combining all the different systems). If you are, then you are overlooking one very significant factor, the cost of the MPP software, at $10/cpu the cluster has an extra $160K in software costs, which is double the hardware costs. if money is no object then go for it, but if it is then you comparison would be (ignoring software maintinance costs) the 16 core 128G ram system vs ~3xsmall systems totaling 6 cores and 48G ram. yes if scan speed is the bottleneck you still win with the small systems, but for most other uses the large system would win easily. and in any case it's not the open and shut case that you keep presenting it as. David Lang From pgsql-performance-owner@postgresql.org Sat Nov 26 14:57:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ACC32DBDC5 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 14:57:00 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83125-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 18:57:00 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id A443DDBDD9 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 14:56:57 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 379BF308DA; Sat, 26 Nov 2005 19:56:58 +0100 (MET) From: "Qingqing Zhou" <zhouqq@cs.toronto.edu> X-Newsgroups: pgsql.performance Subject: Re: Open request for benchmarking input Date: Sat, 26 Nov 2005 13:57:47 -0500 Organization: Hub.Org Networking Services Lines: 38 Message-ID: <dmab5n$226n$1@news.hub.org> References: <Pine.LNX.4.64.0511261025140.16022@discord.dyndns.org> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.055 required=5 tests=[AWL=0.055] X-Spam-Score: 0.055 X-Spam-Level: X-Archive-Number: 200511/516 X-Sequence-Number: 15773 "Jeff Frost" <jeff@frostconsultingllc.com> wrote > > Did you folks see this article on Slashdot with a fellow requesting input > on what sort of benchmarks to run to get a good Postgresql vs Mysql > dataset? Perhaps this would be a good opportunity for us to get some good > benchmarking done. > "The hardware I have available is as follows: > > * 2x dual Opteron 8G ram, 2x144G 15Krpm SCSI > * 2x dual Opteron 8G ram, 2x72G 15Krpm SCSI > * 1x dual Opteron 16G ram, 2x36G 15Krpm SCSI 16x400G 7200rpm SATA > I see this as a good chance to evaluate and boost PostgreSQL performance in general. My two concerns: (1) How long will David Lang spend on the benchmarking? We need *continous* feedback after each tuning. This is important and Mark Wong has done great job on this. (2) The hardware configuration may not reflect all potentials of PostgreSQL. For example, so far, PostgreSQL does not pay much attention in reducing I/O cost, so a stronger RAID definitely will benefit PostgreSQL performance. > > For my own interests, I would like to at least cover the following bases: > 32 bit vs 64 bit vs 64 bit kernel + 32 bit user-space; data warehouse type > tests (data >> memory); and web prefs test (active data RAM) > Don't forget TPCC (data > memory, with intensive updates). So the benchmarks in my mind include TPCC, TPCH and TPCW. Regards, Qingqing From pgsql-performance-owner@postgresql.org Sun Nov 27 02:42:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 19372DA7F3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 02:42:04 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82569-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 06:42:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by svr1.postgresql.org (Postfix) with ESMTP id 80EEBDA7E2 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 02:42:01 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 3AA811AC3E9; Sat, 26 Nov 2005 22:42:21 -0800 (PST) Date: Sat, 26 Nov 2005 11:34:14 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: Luke Lonergan <LLonergan@greenplum.com> Cc: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.com> Message-ID: <Pine.LNX.4.62.0511261129040.2790@qnivq.ynat.uz> References: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.746 required=5 tests=[DATE_IN_PAST_06_12=0.746] X-Spam-Score: 0.746 X-Spam-Level: X-Archive-Number: 200511/525 X-Sequence-Number: 15782 On Sun, 27 Nov 2005, Luke Lonergan wrote: > For data warehousing its pretty well open and shut. To use all cpus and > io channels on each query you will need mpp. > > Has anyone done the math.on the original post? 5TB takes how long to > scan once? If you want to wait less than a couple of days just for a > seq scan, you'd better be in the multi-gb per second range. if you truely need to scan the entire database then you are right, however indexes should be able to cut the amount you need to scan drasticly. David Lang From pgsql-performance-owner@postgresql.org Sat Nov 26 16:17:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B9AB3D7A7E for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 16:17:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94524-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 20:17:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 5EE81D6ED8 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 16:17:03 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sat, 26 Nov 2005 15:16:50 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sat, 26 Nov 2005 15:15:29 -0500 Received: from 208.54.15.129 ([208.54.15.129]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sat, 26 Nov 2005 20:15:29 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sat, 26 Nov 2005 12:15:28 -0800 Subject: Re: Open request for benchmarking input From: "Luke Lonergan" <llonergan@greenplum.com> To: "Qingqing Zhou" <zhouqq@cs.toronto.edu>, pgsql-performance@postgresql.org Message-ID: <BFAE0260.147E6%llonergan@greenplum.com> Thread-Topic: [PERFORM] Open request for benchmarking input Thread-Index: AcXyxiSDYvHeB165EdqEvAANk63kWA== In-Reply-To: <dmab5n$226n$1@news.hub.org> MIME-Version: 1.0 X-OriginalArrivalTime: 26 Nov 2005 20:15:29.0535 (UTC) FILETIME=[256E28F0:01C5F2C6] X-WSS-ID: 6F961D3B2UO5510355-07-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.398 required=5 tests=[AWL=-0.091, RCVD_IN_SORBS_WEB=1.236, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 2.398 X-Spam-Level: ** X-Archive-Number: 200511/517 X-Sequence-Number: 15774 Jeff, Qingqing, On 11/26/05 10:57 AM, "Qingqing Zhou" <zhouqq@cs.toronto.edu> wrote: > > "Jeff Frost" <jeff@frostconsultingllc.com> wrote >> >> Did you folks see this article on Slashdot with a fellow requesting input >> on what sort of benchmarks to run to get a good Postgresql vs Mysql >> dataset? Perhaps this would be a good opportunity for us to get some good >> benchmarking done. >> "The hardware I have available is as follows: >> >> * 2x dual Opteron 8G ram, 2x144G 15Krpm SCSI >> * 2x dual Opteron 8G ram, 2x72G 15Krpm SCSI >> * 1x dual Opteron 16G ram, 2x36G 15Krpm SCSI 16x400G 7200rpm SATA >> I suggest specifying a set of basic system / HW benchmarks to baseline the hardware before each benchmark is run. This has proven to be a major issue with most performance tests. My pick for I/O is bonnie++. Your equipment allows you the opportunity to benchmark all 5 machines running together as a cluster - this is important to measure maturity of solutions for high performance warehousing. Greenplum can provide you a license for Bizgres MPP for this purpose. > (2) The hardware configuration may not reflect all potentials of PostgreSQL. > For example, so far, PostgreSQL does not pay much attention in reducing I/O > cost, so a stronger RAID definitely will benefit PostgreSQL performance. The 16x SATA drives should be great, provided you have a high performance RAID adapter configured properly. You should be able to get 800MB/s of sequential scan performance by using a card like the 3Ware 9550SX. I've also heard that the Areca cards are good (how good?). Configuration of the I/O must be validated though - I've seen as low as 25MB/s from a misconfigured system. >> For my own interests, I would like to at least cover the following bases: >> 32 bit vs 64 bit vs 64 bit kernel + 32 bit user-space; data warehouse type >> tests (data >> memory); and web prefs test (active data RAM) >> > > Don't forget TPCC (data > memory, with intensive updates). So the benchmarks > in my mind include TPCC, TPCH and TPCW. I agree with Qingqing, though I think the OSTG DBT-3 (very similar to TPC-H) is sufficient for data warehousing. This is a fairly ambitious project - one problem I see is that MySQL may not run all of these benchmarks, particularly the DBT-3. Also - would the rules allow for mixing / matching pluggable features of the DBMS? Innodb versus MyISAM? - Luke From pgsql-performance-owner@postgresql.org Sat Nov 26 16:31:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 435E3D8D18 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 16:31:40 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01625-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 20:31:40 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth10.mail.atl.earthlink.net (smtpauth10.mail.atl.earthlink.net [209.86.89.70]) by svr1.postgresql.org (Postfix) with ESMTP id 4F5D5D7A7E for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 16:31:37 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=RiLeNQ1+vLZ+KGjVed+j1DCIP+SYXTwSmPPVXUYGHCFn+BuSSx3t03sH0sIxAxEE; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [71.243.20.20] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth10.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1Eg6ht-0003sl-HC; Sat, 26 Nov 2005 15:31:37 -0500 Message-Id: <6.2.5.6.0.20051126152139.01d97350@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Sat, 26 Nov 2005 15:31:33 -0500 To: "Luke Lonergan" <llonergan@greenplum.com>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Open request for benchmarking input In-Reply-To: <BFAE0260.147E6%llonergan@greenplum.com> References: <dmab5n$226n$1@news.hub.org> <BFAE0260.147E6%llonergan@greenplum.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc6cd3634bb62a8cbfc2259616b14a72d1350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 71.243.20.20 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200511/518 X-Sequence-Number: 15775 At 03:15 PM 11/26/2005, Luke Lonergan wrote: >I suggest specifying a set of basic system / HW benchmarks to baseline the >hardware before each benchmark is run. This has proven to be a major issue >with most performance tests. My pick for I/O is bonnie++. > >Your equipment allows you the opportunity to benchmark all 5 machines >running together as a cluster - this is important to measure maturity of >solutions for high performance warehousing. Greenplum can provide you a >license for Bizgres MPP for this purpose. ...and detailed config / tuning specs as well for it or everyone is probably wasting their time. For instance, it seems fairly clear that the default 8KB table size and default read ahead size are both pessimal, at least for non OLTP-like apps. In addition, there's been a reasonable amount of evidence that xfs should be the file system of choice for pg. Things like optimal RAID strip size, how to allocate tables to various IO HW, and what levels of RAID to use for each RAID set also have to be defined. >The 16x SATA drives should be great, provided you have a high performance >RAID adapter configured properly. You should be able to get 800MB/s of >sequential scan performance by using a card like the 3Ware 9550SX. I've >also heard that the Areca cards are good (how good?). Configuration of the >I/O must be validated though - I've seen as low as 25MB/s from a >misconfigured system. The Areca cards, particularly with 1-2GB of buffer cache, are the current commodity RAID controller performance leader. Better performance can be gotten out of HW from vendors like Xyratex, but it will cost much more. Ron From pgsql-performance-owner@postgresql.org Sat Nov 26 20:12:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 60F0FDA5AF for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sat, 26 Nov 2005 20:12:03 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34708-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 00:12:05 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by svr1.postgresql.org (Postfix) with ESMTP id 61445DA531 for <pgsql-performance@postgresql.org>; Sat, 26 Nov 2005 20:11:59 -0400 (AST) Received: from [84.143.22.121] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), id 0ML29c-1EgA9C393d-0002u4; Sun, 27 Nov 2005 01:12:02 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1EgA9B-0001gC-Gq; Sun, 27 Nov 2005 01:12:01 +0100 Message-ID: <4388F9D1.6080609@pse-consulting.de> Date: Sun, 27 Nov 2005 00:12:01 +0000 From: Andreas Pflug <pgadmin@pse-consulting.de> User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Qingqing Zhou <zhouqq@cs.toronto.edu> CC: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input References: <Pine.LNX.4.64.0511261025140.16022@discord.dyndns.org> <dmab5n$226n$1@news.hub.org> In-Reply-To: <dmab5n$226n$1@news.hub.org> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200511/519 X-Sequence-Number: 15776 Qingqing Zhou wrote: > "Jeff Frost" <jeff@frostconsultingllc.com> wrote >> "The hardware I have available is as follows: >> >> * 2x dual Opteron 8G ram, 2x144G 15Krpm SCSI >> * 2x dual Opteron 8G ram, 2x72G 15Krpm SCSI >> * 1x dual Opteron 16G ram, 2x36G 15Krpm SCSI 16x400G 7200rpm SATA >> > (2) The hardware configuration may not reflect all potentials of PostgreSQL. These boxes don't look like being designed for a DB server. The first are very CPU bound, and the third may be a good choice for very large amounts of streamed data, but not optimal for TP random access. Hopefully, when publicly visible benchmarks are performed, machines are used that comply with common engineering knowledge, ignoring those guys who still believe that sequential performance is the most important issue on disk subsystems for DBMS. Regards, Andreas From pgsql-performance-owner@postgresql.org Sun Nov 27 02:28:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97B97DBE0D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 02:28:34 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82559-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 06:28:33 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) by svr1.postgresql.org (Postfix) with ESMTP id 6369CDBE27 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 02:28:31 -0400 (AST) Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D1)); Sun, 27 Nov 2005 01:28:21 -0500 X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 27 Nov 2005 01:18:56 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Sun, 27 Nov 2005 01:18:54 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXzF8NDXvQ92WFDRy2E6gcFtbBBQAAAq3Jp From: "Luke Lonergan" <LLonergan@greenplum.com> To: dlang@invendra.net, pgsql-performance@postgresql.org X-OriginalArrivalTime: 27 Nov 2005 06:18:56.0403 (UTC) FILETIME=[7267C630:01C5F31A] X-WSS-ID: 6F978E743284409080-15-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.042 required=5 tests=[AWL=0.042] X-Spam-Score: 0.042 X-Spam-Level: X-Archive-Number: 200511/524 X-Sequence-Number: 15781 Rm9yIGRhdGEgd2FyZWhvdXNpbmcgaXRzIHByZXR0eSB3ZWxsIG9wZW4gYW5kIHNodXQuICBUbyB1 c2UgYWxsIGNwdXMgYW5kIGlvIGNoYW5uZWxzIG9uIGVhY2ggcXVlcnkgeW91IHdpbGwgbmVlZCBt cHAuDQoNCkhhcyBhbnlvbmUgZG9uZSB0aGUgbWF0aC5vbiB0aGUgb3JpZ2luYWwgcG9zdD8gIDVU QiB0YWtlcyBob3cgbG9uZyB0byBzY2FuIG9uY2U/ICBJZiB5b3Ugd2FudCB0byB3YWl0IGxlc3Mg dGhhbiBhIGNvdXBsZSBvZiBkYXlzIGp1c3QgZm9yIGEgc2VxIHNjYW4sIHlvdSdkIGJldHRlciBi ZSBpbiB0aGUgbXVsdGktZ2IgcGVyIHNlY29uZCByYW5nZS4NCg0KLSBMdWtlDQotLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLQ0KU2VudCBmcm9tIG15IEJsYWNrQmVycnkgV2lyZWxlc3MgRGV2aWNl DQoNCg0KLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCkZyb206IHBnc3FsLXBlcmZvcm1hbmNl LW93bmVyQHBvc3RncmVzcWwub3JnIDxwZ3NxbC1wZXJmb3JtYW5jZS1vd25lckBwb3N0Z3Jlc3Fs Lm9yZz4NClRvOiBwZ3NxbC1wZXJmb3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZyA8cGdzcWwtcGVyZm9y bWFuY2VAcG9zdGdyZXNxbC5vcmc+DQpTZW50OiBTYXQgTm92IDI2IDEzOjUxOjE4IDIwMDUNClN1 YmplY3Q6IFJlOiBbUEVSRk9STV0gSGFyZHdhcmUvT1MgcmVjb21tZW5kYXRpb25zIGZvciBsYXJn ZSBkYXRhYmFzZXMgKA0KDQo+QW5vdGhlciB0aG91Z2h0IC0gSSBwcmljZWQgb3V0IGEgbWF4ZWQg b3V0IG1hY2hpbmUgd2l0aCAxNiBjb3JlcyBhbmQNCj4xMjhHQiBvZiBSQU0gYW5kIDEuNVRCIG9m IHVzYWJsZSBkaXNrIC0gJDcxLDAwMC4NCj4NCj5Zb3UgY291bGQgaW5zdGVhZCBidXkgOCBtYWNo aW5lcyB0aGF0IHRvdGFsIDE2IGNvcmVzLCAxMjhHQiBSQU0gYW5kIDI4VEINCj5vZiBkaXNrIGZv ciAkNDgsMDAwLCBhbmQgaXQgd291bGQgYmUgMTYgdGltZXMgZmFzdGVyIGluIHNjYW4gcmF0ZSwg d2hpY2gNCj5pcyB0aGUgbW9zdCBpbXBvcnRhbnQgZmFjdG9yIGZvciBsYXJnZSBkYXRhYmFzZXMu ICBUaGUgc2l6ZSB3b3VsZCBiZSAxNg0KPnJhY2sgdW5pdHMgaW5zdGVhZCBvZiA1LCBhbmQgeW91 J2QgaGF2ZSB0byBhZGQgYSBHaWdFIHN3aXRjaCBmb3IgJDE1MDAuDQo+DQo+U2NhbiByYXRlIGZv ciBhYm92ZSBTTVA6IDIwME1CL3MNCj4NCj5TY2FuIHJhdGUgZm9yIGFib3ZlIGNsdXN0ZXI6IDMs MjAwTWIvcw0KPg0KPllvdSBjb3VsZCBldmVuIGdvIGR1YWwgY29yZSBhbmQgZG91YmxlIHRoZSBt ZW1vcnkgb24gdGhlIGNsdXN0ZXIgYW5kDQo+eW91J2QgYWJvdXQgbWF0Y2ggdGhlIHByaWNlIG9m IHRoZSAiZ29kIGJveCIuDQo+DQo+LSBMdWtlDQoNCkx1a2UsIEkgYXNzdW1lIHlvdSBhcmUgdGFs a2luZyBhYm91dCB1c2VpbmcgdGhlIEdyZWVucGx1bSBNUFAgZm9yIHRoaXMgDQoob3RoZXJ3aXNl IEkgZG9uJ3Qga25vdyBob3cgeW91IGFyZSBjb21iaW5pbmcgYWxsIHRoZSBkaWZmZXJlbnQgc3lz dGVtcykuDQoNCklmIHlvdSBhcmUsIHRoZW4geW91IGFyZSBvdmVybG9va2luZyBvbmUgdmVyeSBz aWduaWZpY2FudCBmYWN0b3IsIHRoZSBjb3N0IA0Kb2YgdGhlIE1QUCBzb2Z0d2FyZSwgYXQgJDEw L2NwdSB0aGUgY2x1c3RlciBoYXMgYW4gZXh0cmEgJDE2MEsgaW4gc29mdHdhcmUgDQpjb3N0cywg d2hpY2ggaXMgZG91YmxlIHRoZSBoYXJkd2FyZSBjb3N0cy4NCg0KaWYgbW9uZXkgaXMgbm8gb2Jq ZWN0IHRoZW4gZ28gZm9yIGl0LCBidXQgaWYgaXQgaXMgdGhlbiB5b3UgY29tcGFyaXNvbiANCndv dWxkIGJlIChpZ25vcmluZyBzb2Z0d2FyZSBtYWludGluYW5jZSBjb3N0cykgdGhlIDE2IGNvcmUg MTI4RyByYW0gc3lzdGVtIA0KdnMgfjN4c21hbGwgc3lzdGVtcyB0b3RhbGluZyA2IGNvcmVzIGFu ZCA0OEcgcmFtLg0KDQp5ZXMgaWYgc2NhbiBzcGVlZCBpcyB0aGUgYm90dGxlbmVjayB5b3Ugc3Rp bGwgd2luIHdpdGggdGhlIHNtYWxsIHN5c3RlbXMsIA0KYnV0IGZvciBtb3N0IG90aGVyIHVzZXMg dGhlIGxhcmdlIHN5c3RlbSB3b3VsZCB3aW4gZWFzaWx5LiBhbmQgaW4gYW55IGNhc2UgDQppdCdz IG5vdCB0aGUgb3BlbiBhbmQgc2h1dCBjYXNlIHRoYXQgeW91IGtlZXAgcHJlc2VudGluZyBpdCBh cy4NCg0KRGF2aWQgTGFuZw0KDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0oZW5kIG9mIGJy b2FkY2FzdCktLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NClRJUCA2OiBleHBsYWluIGFuYWx5 emUgaXMgeW91ciBmcmllbmQNCg0K From pgsql-performance-owner@postgresql.org Sun Nov 27 04:05:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF09BDAEDD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 04:05:07 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93005-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 08:05:07 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id B5443DAEF0 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 04:05:01 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sun, 27 Nov 2005 03:03:00 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 27 Nov 2005 03:02:50 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: Hardware/OS recommendations for large databases ( Date: Sun, 27 Nov 2005 03:02:48 -0500 Message-ID: <3E37B936B592014B978C4415F90D662DE11EBD@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXzHa65mkCBSYYzTbuyZD3EIGmc7gAC0YgZ From: "Luke Lonergan" <LLonergan@greenplum.com> To: dlang@invendra.net cc: pgsql-performance@postgresql.org X-OriginalArrivalTime: 27 Nov 2005 08:02:50.0325 (UTC) FILETIME=[F61CC850:01C5F328] X-WSS-ID: 6F97B7A32UO6060124-02-01 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.037 required=5 tests=[AWL=0.037] X-Spam-Score: 0.037 X-Spam-Level: X-Archive-Number: 200511/526 X-Sequence-Number: 15783 SGF2ZSB5b3UgZmFjdG9yZWQgaW4gaG93IGxvbmcgaXQgdGFrZXMgdG8gYnVpbGQgYW4gaW5kZXgg b24gNVRCPyAgQW5kIHRoZSBpbmRleCBzaXplPw0KDQpSZWFsbHksIGl0J3MgYSB3aG9sZSBkaWZm ZXJlbnQgd29ybGQgYXQgbXVsdGktVEIsIGV2ZXJ5dGhpbmcgaGFzIHRvIHNjYWxlLg0KDQpCdHcg d2UgZG9uJ3QganVzdCBzY2FuIGluIHBhcmFsbGVsLCB3ZSBkbyBhbGwgaW4gcGFyYWxsZWwsIGNo ZWNrIHRoZSBzb3J0IG51bWJlciBvbiB0aGlzIHRocmVhZC4gIE1wcCBpcyBmb3IgdGhlIGdvZCBi b3ggdG9vLg0KDQpBbmQgeW91ciBwcmljZSBpcyB3cm9uZyAtIGJ1dCBpZiB5b3Ugd2FudCBmcmVl IHRoZW4geW91J2xsIGhhdmUgdG8gZmluZCBhbm90aGVyIHdheSB0byBnZXQgeW91ciB3b3JrIGRv bmUuDQoNCi0gTHVrZQ0KLSBMdWtlDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KU2VudCBm cm9tIG15IEJsYWNrQmVycnkgV2lyZWxlc3MgRGV2aWNlDQoNCg0KLS0tLS1PcmlnaW5hbCBNZXNz YWdlLS0tLS0NCkZyb206IERhdmlkIExhbmcgPGRsYW5nQGludmVuZHJhLm5ldD4NClRvOiBMdWtl IExvbmVyZ2FuIDxMTG9uZXJnYW5AZ3JlZW5wbHVtLmNvbT4NCkNDOiBwZ3NxbC1wZXJmb3JtYW5j ZUBwb3N0Z3Jlc3FsLm9yZyA8cGdzcWwtcGVyZm9ybWFuY2VAcG9zdGdyZXNxbC5vcmc+DQpTZW50 OiBTYXQgTm92IDI2IDE0OjM0OjE0IDIwMDUNClN1YmplY3Q6IFJlOiBbUEVSRk9STV0gSGFyZHdh cmUvT1MgcmVjb21tZW5kYXRpb25zIGZvciBsYXJnZSBkYXRhYmFzZXMgKA0KDQpPbiBTdW4sIDI3 IE5vdiAyMDA1LCBMdWtlIExvbmVyZ2FuIHdyb3RlOg0KDQo+IEZvciBkYXRhIHdhcmVob3VzaW5n IGl0cyBwcmV0dHkgd2VsbCBvcGVuIGFuZCBzaHV0LiAgVG8gdXNlIGFsbCBjcHVzIGFuZCANCj4g aW8gY2hhbm5lbHMgb24gZWFjaCBxdWVyeSB5b3Ugd2lsbCBuZWVkIG1wcC4NCj4NCj4gSGFzIGFu eW9uZSBkb25lIHRoZSBtYXRoLm9uIHRoZSBvcmlnaW5hbCBwb3N0PyAgNVRCIHRha2VzIGhvdyBs b25nIHRvIA0KPiBzY2FuIG9uY2U/ICBJZiB5b3Ugd2FudCB0byB3YWl0IGxlc3MgdGhhbiBhIGNv dXBsZSBvZiBkYXlzIGp1c3QgZm9yIGEgDQo+IHNlcSBzY2FuLCB5b3UnZCBiZXR0ZXIgYmUgaW4g dGhlIG11bHRpLWdiIHBlciBzZWNvbmQgcmFuZ2UuDQoNCmlmIHlvdSB0cnVlbHkgbmVlZCB0byBz Y2FuIHRoZSBlbnRpcmUgZGF0YWJhc2UgdGhlbiB5b3UgYXJlIHJpZ2h0LCBob3dldmVyIA0KaW5k ZXhlcyBzaG91bGQgYmUgYWJsZSB0byBjdXQgdGhlIGFtb3VudCB5b3UgbmVlZCB0byBzY2FuIGRy YXN0aWNseS4NCg0KRGF2aWQgTGFuZw0KDQo= From pgsql-performance-owner@postgresql.org Sun Nov 27 18:16:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 12009DAF71 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 18:16:12 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37475-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 18:16:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by svr1.postgresql.org (Postfix) with ESMTP id 73CF7DAEDD for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 18:16:05 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id D87871AC3E9; Sun, 27 Nov 2005 14:16:26 -0800 (PST) Date: Sun, 27 Nov 2005 03:08:17 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: Andreas Pflug <pgadmin@pse-consulting.de> Cc: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input In-Reply-To: <4389A4D4.6030203@pse-consulting.de> Message-ID: <Pine.LNX.4.62.0511270304590.2790@qnivq.ynat.uz> References: <Pine.LNX.4.62.0511260745370.2790@qnivq.ynat.uz> <4389A4D4.6030203@pse-consulting.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.746 required=5 tests=[DATE_IN_PAST_06_12=0.746] X-Spam-Score: 0.746 X-Spam-Level: X-Archive-Number: 200511/534 X-Sequence-Number: 15791 On Sun, 27 Nov 2005, Andreas Pflug wrote: > David Lang wrote: >> >> Postgres needs to work on the low end stuff as well as the high end stuff >> or people will write their app to work with things that DO run on low end >> hardware and they spend much more money then is needed to scale the >> hardware up rather then re-writing their app. > > I agree that pgsql runs on low end stuff, but a dual Opteron with 2x15kSCSI > isn't low end, is it? The CPU/IO performance isn't balanced for the total > cost, you probably could get a single CPU/6x15kRPM machine for the same price > delivering better TP performance in most scenarios. > > Benchmarks should deliver results that are somewhat comparable. If performed > on machines that don't deliver a good CPU/IO power balance for the type of DB > load being tested, they're misleading and hardly usable for comparision > purposes, and even less for learning how to configure a decent server since > you might have to tweak some parameters in an unusual way. a couple things to note, first, when running benchmarks there is a need for client machines to stress the database, these machines are what are available to be clients as well as servers. second, the smaller machines are actually about what I would spec out for a high performance database that's reasonably small, a couple of the boxes have 144G drives, if they are setup as raid1 then the boxes would be reasonable to use for a database up to 50G or larger (assuming you need space on the DB server to dump the database, up to 100G or so if you don't) David Lang From pgsql-performance-owner@postgresql.org Sun Nov 27 08:16:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F9EFDC51B for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 08:16:32 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15572-06-5 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 08:16:24 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 70D7ADBB13 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 07:52:37 -0400 (AST) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1EgL59-0002Rp-M3 for pgsql-performance@postgresql.org; Sun, 27 Nov 2005 12:52:35 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1EgL4V-0004lE-00 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 12:51:55 +0100 Date: Sun, 27 Nov 2005 12:51:55 +0100 From: "Steinar H. Gunderson" <sgunderson@bigfoot.com> To: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input Message-ID: <20051127115155.GB18128@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <Pine.LNX.4.64.0511261025140.16022@discord.dyndns.org> <dmab5n$226n$1@news.hub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <dmab5n$226n$1@news.hub.org> X-Operating-System: Linux 2.6.14 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/527 X-Sequence-Number: 15784 On Sat, Nov 26, 2005 at 01:57:47PM -0500, Qingqing Zhou wrote: > Don't forget TPCC (data > memory, with intensive updates). So the benchmarks > in my mind include TPCC, TPCH and TPCW. I'm lost in all those acronyms, but am I right in assuming that none of these actually push the planner very hard? We keep on pushing that "PostgreSQL is a lot better than MySQL when it comes to many joins and complex queries" (mostly because the planner is a lot more mature -- does MySQL even keep statistics yet?), but I'm not sure if there are any widely used benchmarks available that actaully excercise that. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Sun Nov 27 08:21:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 27D35DAEDD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 08:21:46 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16374-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 08:21:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by svr1.postgresql.org (Postfix) with ESMTP id 4B818DA85A for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 08:21:43 -0400 (AST) Received: from [84.143.46.71] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2Dk-1EgLXK2yBB-0002gx; Sun, 27 Nov 2005 13:21:43 +0100 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1EgLXJ-0001nu-1W; Sun, 27 Nov 2005 13:21:41 +0100 Message-ID: <4389A4D4.6030203@pse-consulting.de> Date: Sun, 27 Nov 2005 13:21:40 +0100 From: Andreas Pflug <pgadmin@pse-consulting.de> User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Lang <dlang@invendra.net> CC: pgsql-performance@postgresql.org Subject: Re: Open request for benchmarking input References: <Pine.LNX.4.62.0511260745370.2790@qnivq.ynat.uz> In-Reply-To: <Pine.LNX.4.62.0511260745370.2790@qnivq.ynat.uz> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.031 required=5 tests=[AWL=0.031] X-Spam-Score: 0.031 X-Spam-Level: X-Archive-Number: 200511/528 X-Sequence-Number: 15785 David Lang wrote: >> These boxes don't look like being designed for a DB server. The first >> are very CPU bound, and the third may be a good choice for very large >> amounts of streamed data, but not optimal for TP random access. > > > I don't know what you mean when you say that the first ones are CPU > bound, they have far more CPU then they do disk I/O > > however I will agree that they were not designed to be DB servers, they > weren't. they happen to be the machines that I have available. That was what I understood from the specs. > > they only have a pair of disks each, which would not be reasonable for > most production DB uses, and they have far more CPU then is normally > reccomended. So I'll have to run raid 0 instead of 0+1 (or not use raid) > which would be unacceptable in a production environment, but can still > give some useful info. > > the 5th box _was_ purchased to be a DB server, but one to store and > analyse large amounts of log data, so large amounts of data storage were > more important then raw DB performance (although we did max out the RAM > at 16G to try and make up for it). it was a deliberate price/performance > tradeoff. this machine ran ~$20k, but a similar capacity with SCSI > drives would have been FAR more expensive (IIRC a multiple of 4x or more > more expensive). That was my understanding too. For this specific requirement, I'd probably design the server the same way, and running OLAP benchmarks against it sounds very reasonable. > >> Hopefully, when publicly visible benchmarks are performed, machines >> are used that comply with common engineering knowledge, ignoring those >> guys who still believe that sequential performance is the most >> important issue on disk subsystems for DBMS. > > > are you saying that I shouldn't do any benchmarks becouse the machines > aren't what you would consider good enough? > > if so I disagree with you and think that benchmarks should be done on > even worse machines, but should also be done on better machines. (are > you volunteering to provide time on better machines for benchmarks?) > > not everyone will buy a lot of high-end hardware before they start > useing a database. in fact most companies will start with a database on > lower end hardware and then as their requirements grow they will move to > better hardware. I'm willing to bet that what I have available is better > then the starting point for most places. > > Postgres needs to work on the low end stuff as well as the high end > stuff or people will write their app to work with things that DO run on > low end hardware and they spend much more money then is needed to scale > the hardware up rather then re-writing their app. I agree that pgsql runs on low end stuff, but a dual Opteron with 2x15kSCSI isn't low end, is it? The CPU/IO performance isn't balanced for the total cost, you probably could get a single CPU/6x15kRPM machine for the same price delivering better TP performance in most scenarios. Benchmarks should deliver results that are somewhat comparable. If performed on machines that don't deliver a good CPU/IO power balance for the type of DB load being tested, they're misleading and hardly usable for comparision purposes, and even less for learning how to configure a decent server since you might have to tweak some parameters in an unusual way. Regards, Andreas From pgsql-performance-owner@postgresql.org Sun Nov 27 11:48:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 11884DBF48 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 11:48:02 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43888-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 11:48:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id A1248D7798 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 11:47:59 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id CFEF4356C6; Sun, 27 Nov 2005 07:48:01 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id CE6D635163; Sun, 27 Nov 2005 07:48:01 -0800 (PST) Date: Sun, 27 Nov 2005 07:48:01 -0800 (PST) From: Stephan Szabo <sszabo@megazone.bigpanda.com> To: Luke Lonergan <LLonergan@greenplum.com> Cc: dlang@invendra.net, pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.com> Message-ID: <20051127072933.Q62040@megazone.bigpanda.com> References: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/529 X-Sequence-Number: 15786 On Sun, 27 Nov 2005, Luke Lonergan wrote: > Has anyone done the math.on the original post? 5TB takes how long to > scan once? If you want to wait less than a couple of days just for a > seq scan, you'd better be in the multi-gb per second range. Err, I get about 31 megabytes/second to do 5TB in 170,000 seconds. I think perhaps you were exaggerating a bit or adding additional overhead not obvious from the above. ;) --- At 1 gigabyte per second, 1 terrabyte should take about 1000 seconds (between 16 and 17 minutes). The impressive 3.2 gigabytes per second listed before (if it actually scans consistently at that rate), puts it at a little over 5 minutes I believe for 1, so about 26 for 5 terrabytes. The 200 megabyte per second number puts it about 7 hours for 5 terrabytes AFAICS. From pgsql-performance-owner@postgresql.org Sun Nov 27 13:10:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 16F75DBFCF for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 13:10:56 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68560-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 13:10:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth07.mail.atl.earthlink.net (smtpauth07.mail.atl.earthlink.net [209.86.89.67]) by svr1.postgresql.org (Postfix) with ESMTP id 7E7F5D7798 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 13:10:53 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=smSxls9bRxZLcZV7ZCzkGfNTQWHVqHCoNt55GX1uxE9XpY0N3PWE1SE/C83UkIQI; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth07.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EgQ3A-0003wt-0m; Sun, 27 Nov 2005 12:10:52 -0500 Message-Id: <6.2.5.6.0.20051127114155.01dbf868@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Sun, 27 Nov 2005 12:10:44 -0500 To: "Luke Lonergan" <LLonergan@greenplum.com>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.co m> References: <3E37B936B592014B978C4415F90D662DE11EBC@MI8NYCMAIL06.Mi8.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcdbd45f42b791e69503975ada0daad77b350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/530 X-Sequence-Number: 15787 At 01:18 AM 11/27/2005, Luke Lonergan wrote: >For data warehousing its pretty well open and shut. To use all cpus >and io channels on each query you will need mpp. > >Has anyone done the math.on the original post? 5TB takes how long >to scan once? If you want to wait less than a couple of days just >for a seq scan, you'd better be in the multi-gb per second range. More than a bit of hyperbole there Luke. Some common RW scenarios: Dual 1GbE NICs => 200MBps => 5TB in 5x10^12/2x10^8= 25000secs= ~6hrs57mins. Network stuff like re-transmits of dropped packets can increase this, so network SLA's are critical. Dual 10GbE NICs => ~1.6GBps (10GbE NICs can't yet do over ~800MBps apiece) => 5x10^12/1.6x10^9= 3125secs= ~52mins. SLA's are even moire critical here. If you are pushing 5TB around on a regular basis, you are not wasting your time & money on commodity <= 300MBps RAID HW. You'll be using 800MBps and 1600MBps high end stuff, which means you'll need ~1-2hrs to sequentially scan 5TB on physical media. Clever use of RAM can get a 5TB sequential scan down to ~17mins. Yes, it's a lot of data. But sequential scan times should be in the mins or low single digit hours, not days. Particularly if you use RAM to maximum advantage. Ron From pgsql-performance-owner@postgresql.org Sun Nov 27 15:14:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8BB81DC58A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 15:14:03 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13682-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 15:14:02 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.Mi8.com (d01gw03.mi8.com [63.240.6.42]) by svr1.postgresql.org (Postfix) with ESMTP id C182ADC5D7 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 15:14:00 -0400 (AST) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D3)); Sun, 27 Nov 2005 14:13:51 -0500 X-Server-Uuid: E847189C-FC88-4913-9CD4-DE66914F83C0 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 27 Nov 2005 14:11:53 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sun, 27 Nov 2005 19:11:53 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sun, 27 Nov 2005 11:11:53 -0800 Subject: Re: Hardware/OS recommendations for large databases From: "Luke Lonergan" <llonergan@greenplum.com> To: "Ron" <rjpeace@earthlink.net>, pgsql-performance@postgresql.org Message-ID: <BFAF44F9.14865%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases Thread-Index: AcXzf2L/4YrM1hDySwKeNGP6hx/XsgABwoDi In-Reply-To: <6.2.5.6.0.20051127114155.01dbf868@earthlink.net> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Nov 2005 19:11:53.0725 (UTC) FILETIME=[6D7182D0:01C5F386] X-WSS-ID: 6F94DAE519O4545944-04-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/531 X-Sequence-Number: 15788 Ron, On 11/27/05 9:10 AM, "Ron" <rjpeace@earthlink.net> wrote: > Clever use of RAM can get a 5TB sequential scan down to ~17mins. > > Yes, it's a lot of data. But sequential scan times should be in the > mins or low single digit hours, not days. Particularly if you use > RAM to maximum advantage. Unfortunately, RAM doesn't help with scanning from disk at all. WRT using network interfaces to help - it's interesting, but I think what you'd want to connect to is other machines with storage on them. - Luke From pgsql-performance-owner@postgresql.org Sun Nov 27 15:38:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30C27DC55A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 15:38:11 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14918-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 15:38:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id 6A537DBFCF for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 15:38:08 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Sun, 27 Nov 2005 14:37:47 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 27 Nov 2005 14:31:25 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sun, 27 Nov 2005 19:31:24 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Sun, 27 Nov 2005 11:31:24 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Stephan Szabo" <sszabo@megazone.bigpanda.com>, "Postgresql Performance" <pgsql-performance@postgresql.org>, "David Lang" <dlang@invendra.net> Message-ID: <BFAF498C.14869%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXzafwD25Gxo/A9SmmAhK9e/JqThQAHyr5r In-Reply-To: <20051127072933.Q62040@megazone.bigpanda.com> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Nov 2005 19:31:25.0030 (UTC) FILETIME=[27987860:01C5F389] X-WSS-ID: 6F94D4802UO6565240-09-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/532 X-Sequence-Number: 15789 Stephan, On 11/27/05 7:48 AM, "Stephan Szabo" <sszabo@megazone.bigpanda.com> wrote: > On Sun, 27 Nov 2005, Luke Lonergan wrote: > >> Has anyone done the math.on the original post? 5TB takes how long to >> scan once? If you want to wait less than a couple of days just for a >> seq scan, you'd better be in the multi-gb per second range. > > Err, I get about 31 megabytes/second to do 5TB in 170,000 seconds. I think > perhaps you were exaggerating a bit or adding additional overhead not > obvious from the above. ;) Thanks - the calculator on my blackberry was broken ;-) > At 1 gigabyte per second, 1 terrabyte should take about 1000 seconds > (between 16 and 17 minutes). The impressive 3.2 gigabytes per second > listed before (if it actually scans consistently at that rate), puts it at > a little over 5 minutes I believe for 1, so about 26 for 5 terrabytes. > The 200 megabyte per second number puts it about 7 hours for 5 > terrabytes AFAICS. 7 hours, days, same thing ;-) On the reality of sustained scan rates like that: We're getting 2.5GB/s sustained on a 2 year old machine with 16 hosts and 96 disks. We run them in RAID0, which is only OK because MPP has built-in host to host mirroring for fault management. We just purchased a 4-way cluster with 8 drives each using the 3Ware 9550SX. Our thought was to try the simplest approach first, which is a single RAID5, which gets us 7 drives worth of capacity and performance. As I posted earlier, we get about 400MB/s seq scan rate on the RAID, but the Postgres 8.0 current scan rate limit is 64% of 400MB/s or 256MB/s per host. The 8.1 mods (thanks Qingqing and Tom!) may increase that significantly toward the 400 max - we've already merged the 8.1 codebase into MPP so we'll also feature the same enhancements. Our next approach is to run these machines in a split RAID0 configuration, or RAID0 on 4 and 4 drives. We then run an MPP "segment instance" bound to each CPU and I/O channel. At that point, we'll have all 8 drives of performance and capacity per host and we should get 333MB/s with current MPP and perhaps over 400MB/s with MPP/8.1. That would get us up to the 3.2GB/s for 8 hosts. Even better, all operators are executed on all CPUs for each query, so sorting, hashing, agg, etc etc are run on all CPUs in the cluster. - Luke From pgsql-performance-owner@postgresql.org Sun Nov 27 16:25:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4166FD9F77 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 16:25:43 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18929-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 16:25:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth10.mail.atl.earthlink.net (smtpauth10.mail.atl.earthlink.net [209.86.89.70]) by svr1.postgresql.org (Postfix) with ESMTP id 914DCD7EF9 for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 16:25:40 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=eabyL8b5qSo80nUKJpwT+1jxZOz4+ckPRy/D82BfvNL7PZxzeoDpINvq/frw7H1J; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth10.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EgT5h-0004oA-0n; Sun, 27 Nov 2005 15:25:41 -0500 Message-Id: <6.2.5.6.0.20051127150022.03880848@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Sun, 27 Nov 2005 15:25:36 -0500 To: "Luke Lonergan" <llonergan@greenplum.com>, pgsql-performance@postgresql.org From: Ron <rjpeace@earthlink.net> Subject: Re: Hardware/OS recommendations for large databases In-Reply-To: <BFAF44F9.14865%llonergan@greenplum.com> References: <6.2.5.6.0.20051127114155.01dbf868@earthlink.net> <BFAF44F9.14865%llonergan@greenplum.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc1c93f0902af1e3d2146ea26d907e6145350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/533 X-Sequence-Number: 15790 At 02:11 PM 11/27/2005, Luke Lonergan wrote: >Ron, > >On 11/27/05 9:10 AM, "Ron" <rjpeace@earthlink.net> wrote: > > > Clever use of RAM can get a 5TB sequential scan down to ~17mins. > > > > Yes, it's a lot of data. But sequential scan times should be in the > > mins or low single digit hours, not days. Particularly if you use > > RAM to maximum advantage. > >Unfortunately, RAM doesn't help with scanning from disk at all. I agree with you if you are scanning a table "cold", having never loaded it before, or if the system is not (or can't be) set up properly with appropriate buffers. However, outside of those 2 cases there are often tricks you can use with enough RAM (and no, you don't need RAM equal to the size of the item(s) being scanned) to substantially speed things up. Best case, you can get performance approximately equal to that of a RAM resident scan. >WRT using network interfaces to help - it's interesting, but I think what >you'd want to connect to is other machines with storage on them. Maybe. Or maybe you want to concentrate your storage in a farm that is connected by network or Fiber Channel to the rest of your HW. That's what a NAS or SAN is after all. "The rest of your HW" nowadays is often a cluster of RAM rich hosts. Assuming 64GB per host, 5TB can be split across ~79 hosts if you want to make it all RAM resident. Most don't have that kind of budget, but thankfully it is not usually necessary to make all of the data RAM resident in order to obtain if not all of the performance benefits you'd get if all of the data was. Ron From pgsql-performance-owner@postgresql.org Sun Nov 27 20:07:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24052DBE8A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 20:07:32 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54079-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Sun, 27 Nov 2005 20:07:33 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 7F68EDBE5D for <pgsql-performance@postgresql.org>; Sun, 27 Nov 2005 20:07:28 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1E0DF3514F; Sun, 27 Nov 2005 16:07:32 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1C6083513F; Sun, 27 Nov 2005 16:07:32 -0800 (PST) Date: Sun, 27 Nov 2005 16:07:32 -0800 (PST) From: Stephan Szabo <sszabo@megazone.bigpanda.com> To: Luke Lonergan <llonergan@greenplum.com> Cc: Postgresql Performance <pgsql-performance@postgresql.org>, David Lang <dlang@invendra.net> Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <BFAF498C.14869%llonergan@greenplum.com> Message-ID: <20051127160216.V96828@megazone.bigpanda.com> References: <BFAF498C.14869%llonergan@greenplum.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/535 X-Sequence-Number: 15792 On Sun, 27 Nov 2005, Luke Lonergan wrote: > Stephan, > > On 11/27/05 7:48 AM, "Stephan Szabo" <sszabo@megazone.bigpanda.com> wrote: > > > On Sun, 27 Nov 2005, Luke Lonergan wrote: > > > >> Has anyone done the math.on the original post? 5TB takes how long to > >> scan once? If you want to wait less than a couple of days just for a > >> seq scan, you'd better be in the multi-gb per second range. > > > > Err, I get about 31 megabytes/second to do 5TB in 170,000 seconds. I think > > perhaps you were exaggerating a bit or adding additional overhead not > > obvious from the above. ;) > > Thanks - the calculator on my blackberry was broken ;-) Well, it was suspiciously close to a factor of 60 off, which when working in time could have just been a simple math error. > > At 1 gigabyte per second, 1 terrabyte should take about 1000 seconds > > (between 16 and 17 minutes). The impressive 3.2 gigabytes per second > > listed before (if it actually scans consistently at that rate), puts it at > > a little over 5 minutes I believe for 1, so about 26 for 5 terrabytes. > > The 200 megabyte per second number puts it about 7 hours for 5 > > terrabytes AFAICS. > > 7 hours, days, same thing ;-) > > On the reality of sustained scan rates like that: Well, the reason I asked was that IIRC the 3.2 used earlier in the discussion was exactly multiplying scanners and base rate (ie, no additional overhead). I couldn't tell if that was back of the envelope or if the overhead was in fact negligible. (Or I could be misremembering the conversation). I don't doubt that it's possible to get the rate, just wasn't sure if the rate was actually applicable to the ongoing discussion of the comparison. From pgsql-performance-owner@postgresql.org Tue Nov 29 01:50:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BF6D79DCAB3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 01:50:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14214-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 01:50:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id E51839DCAB2 for <pgsql-performance@postgresql.org>; Tue, 29 Nov 2005 01:50:21 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id 8C6E71AC3E9; Mon, 28 Nov 2005 19:09:26 -0800 (PST) Date: Sun, 27 Nov 2005 19:09:04 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: Brendan Duddridge <brendan@clickspace.com> Cc: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <179B5137-F0BB-4037-A5AD-3459B914E580@clickspace.com> Message-ID: <Pine.LNX.4.62.0511271903180.2807@qnivq.ynat.uz> References: <BFB0BF1B.1495C%llonergan@greenplum.com> <179B5137-F0BB-4037-A5AD-3459B914E580@clickspace.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.78 required=5 tests=[AWL=-0.025, DATE_IN_PAST_24_48=0.805] X-Spam-Score: 0.78 X-Spam-Level: X-Archive-Number: 200511/549 X-Sequence-Number: 15806 On Mon, 28 Nov 2005, Brendan Duddridge wrote: > Forgive my ignorance, but what is MPP? Is that part of Bizgres? Is it > possible to upgrade from Postgres 8.1 to Bizgres? MPP is the Greenplum propriatary extention to postgres that spreads the data over multiple machines, (raid, but with entire machines not just drives, complete with data replication within the cluster to survive a machine failing) for some types of queries they can definantly scale lineraly with the number of machines (other queries are far more difficult and the overhead of coordinating the machines shows more. this is one of the key things that the new version they recently announced the beta for is supposed to be drasticly improving) early in the year when I first looked at them their prices were exorbadent, but Luke says I'm wildly mistake on their current prices so call them for details it uses the same interfaces as postgres so it should be a drop in replacement to replace a single server with a cluster. it's facinating technology to read about. I seem to remember reading that one of the other postgres companies is also producing a clustered version of postgres, but I don't remember who and know nothing about them. David Lang From pgsql-performance-owner@postgresql.org Tue Nov 29 01:48:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7E10D9DCD39 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 01:48:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12644-03-11 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 01:48:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.invendra.net (sbx-01.invendra.net [66.139.76.16]) by postgresql.org (Postfix) with ESMTP id CBC9B9DCA9F for <pgsql-performance@postgresql.org>; Tue, 29 Nov 2005 01:17:03 -0400 (AST) Received: from david.lang.hm (dsl081-044-215.lax1.dsl.speakeasy.net [64.81.44.215]) by mail.invendra.net (Postfix) with ESMTP id BBC3C1AC3EA; Mon, 28 Nov 2005 20:01:27 -0800 (PST) Date: Sun, 27 Nov 2005 20:01:05 -0800 (PST) From: David Lang <dlang@invendra.net> X-X-Sender: dlang@david.lang.hm To: Brendan Duddridge <brendan@clickspace.com> Cc: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <3017A204-1BAF-4E62-ADA6-695E34557645@clickspace.com> Message-ID: <Pine.LNX.4.62.0511271940400.2807@qnivq.ynat.uz> References: <BFB0BF1B.1495C%llonergan@greenplum.com> <179B5137-F0BB-4037-A5AD-3459B914E580@clickspace.com> <Pine.LNX.4.62.0511271903180.2807@qnivq.ynat.uz> <3017A204-1BAF-4E62-ADA6-695E34557645@clickspace.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.776 required=5 tests=[AWL=-0.030, DATE_IN_PAST_24_48=0.805] X-Spam-Score: 0.776 X-Spam-Level: X-Archive-Number: 200511/548 X-Sequence-Number: 15805 On Mon, 28 Nov 2005, Brendan Duddridge wrote: > Hi David, > > Thanks for your reply. So how is that different than something like Slony2 or > pgcluster with multi-master replication? Is it similar technology? We're > currently looking for a good clustering solution that will work on our Apple > Xserves and Xserve RAIDs. MPP doesn't just split up the data, it splits up the processing as well, so if you have a 5 machine cluster, each machine holds 1/5 of your data (plus a backup for one of the other machines) and when you do a query MPP slices and dices the query to send a subset of the query to each machine, it then gets the responses from all the machines and combines them if you ahve to do a full table scan for example, wach machine would only have to go through 20% of the data a Slony of pgcluster setup has each machine with a full copy of all the data, only one machine can work on a given query at a time, and if you have to do a full table scan one machine needs to read 100% of the data. in many ways this is the holy grail of databases. almost all other areas of computing can now be scaled by throwing more machines at the problem in a cluster, with each machine just working on it's piece of the problem, but databases have had serious trouble doing the same and so have been ruled by the 'big monster machine'. Oracle has been selling Oracle Rac for a few years, and reports from people who have used it range drasticly (from it works great, to it's a total disaster), in part depending on the types of queries that have been made. Greenplum thinks that they have licked the problems for the more general case (and that commodity networks are now fast enough to match disk speeds in processing the data) if they are right then when they hit full release with the new version they should be cracking a lot of the price/performance records on the big database benchmarks (TPC and similar), and if their pricing is reasonable, they may be breaking them by an order of magnatude or more (it's not unusual for the top machines to spend more then $1,000,000 on just their disk arrays for those systems, MPP could conceivably put togeather a cluster of $5K machines that runs rings around them (and probably will for at least some of the subtests, the big question is if they can sweep the board and take the top spots outright) they have more details (and marketing stuff) on their site at http://www.greenplum.com/prod_deepgreen_cluster.html don't get me wrong, I am very impressed with their stuff, but (haveing ranted a little here on the list about them) I think MPP and it's performace is a bit off topic for the postgres performance list (at least until the postgres project itself starts implementing similar features :-) David Lang > Thanks, > > ____________________________________________________________________ > Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com > > ClickSpace Interactive Inc. > Suite L100, 239 - 10th Ave. SE > Calgary, AB T2G 0V9 > > http://www.clickspace.com > > On Nov 27, 2005, at 8:09 PM, David Lang wrote: > >> On Mon, 28 Nov 2005, Brendan Duddridge wrote: >> >>> Forgive my ignorance, but what is MPP? Is that part of Bizgres? Is it >>> possible to upgrade from Postgres 8.1 to Bizgres? >> >> MPP is the Greenplum propriatary extention to postgres that spreads the >> data over multiple machines, (raid, but with entire machines not just >> drives, complete with data replication within the cluster to survive a >> machine failing) >> >> for some types of queries they can definantly scale lineraly with the >> number of machines (other queries are far more difficult and the overhead >> of coordinating the machines shows more. this is one of the key things that >> the new version they recently announced the beta for is supposed to be >> drasticly improving) >> >> early in the year when I first looked at them their prices were exorbadent, >> but Luke says I'm wildly mistake on their current prices so call them for >> details >> >> it uses the same interfaces as postgres so it should be a drop in >> replacement to replace a single server with a cluster. >> >> it's facinating technology to read about. >> >> I seem to remember reading that one of the other postgres companies is also >> producing a clustered version of postgres, but I don't remember who and >> know nothing about them. >> >> David Lang >> > > From pgsql-performance-owner@postgresql.org Mon Nov 28 09:31:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DD08D9DCAB3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 09:31:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26752-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 09:31:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 3317D9DCA94 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 09:30:58 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Newbie question: ultra fast count(*) Date: Mon, 28 Nov 2005 08:31:06 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD965@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Newbie question: ultra fast count(*) Thread-Index: AcX0Hg/Vna54jEGaREyT2R7cZTCHVgAAY40g From: "Merlin Moncure" <merlin.moncure@rcsonline.com> To: "Rodrigo Madera" <rodrigo.madera@gmail.com> Cc: <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/536 X-Sequence-Number: 15793 > I have been reading all this technical talk about costs and such that > I don't (_yet_) understand. >=20 > Now I'm scared... what's the fastest way to do an equivalent of > count(*) on a table to know how many items it has? Make sure to analyze the database frequently and check pg_class for reltuples field. This gives 0 time approximations of # row in table at the time of the last analyze. Many other approaches...check archives. Also your requirements are probably not as high as you think they are ;) Merlin From pgsql-performance-owner@postgresql.org Mon Nov 28 12:27:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 34BEA9DCBAF for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 12:27:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65197-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 12:27:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) by postgresql.org (Postfix) with ESMTP id F26739DCB0B for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 12:27:11 -0400 (AST) Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D4)); Mon, 28 Nov 2005 11:26:54 -0500 X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 28 Nov 2005 11:26:21 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Mon, 28 Nov 2005 16:26:21 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 28 Nov 2005 08:26:21 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: pgsql-performance@postgresql.org cc: "eng@intranet.greenplum.com" <eng@intranet.greenplum.com> Message-ID: <BFB06FAD.148EC%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcXvIxdwfLDwWrP8Q669kHxJ85F1twBrF12iABLTyBIAx2zelg== In-Reply-To: <BFAB355B.1468A%llonergan@greenplum.com> MIME-Version: 1.0 X-OriginalArrivalTime: 28 Nov 2005 16:26:21.0905 (UTC) FILETIME=[7807CC10:01C5F438] X-WSS-ID: 6F95F0402UO7731728-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[AWL=0.000, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/537 X-Sequence-Number: 15794 The MPP test I ran was with the release version 2.0 of MPP which is based on Postgres 8.0, the upcoming 2.1 release is based on 8.1, and 8.1 is far faster at seq scan + agg. 12,937MB were counted in 4.5 seconds, or 2890MB/s from I/O cache. That's 722MB/s per host, and 360MB/s per Postgres instance, up from 267 previously with 8.0.3. I'm going to apply Tom's pre-8.2 seq scan locking optimization and see how much better we can get! - Luke ========================================================== Bizgres MPP CVS tip (2.1 pre), 8 data segments, 1 per CPU ========================================================== llonergan=# \timing Timing is on. llonergan=# explain select count(1) from lineitem; QUERY PLAN -------------------------------------------------------------------------- Aggregate (cost=0.01..0.01 rows=1 width=0) -> Gather Motion (cost=0.01..0.01 rows=1 width=0) -> Aggregate (cost=0.01..0.01 rows=1 width=0) -> Seq Scan on lineitem (cost=0.00..0.00 rows=1 width=0) (4 rows) Time: 1.464 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 4478.563 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 4550.917 ms llonergan=# select count(1) from lineitem; count ---------- 59986052 (1 row) Time: 4482.261 ms On 11/24/05 9:16 AM, "Luke Lonergan" <LLonergan@greenplum.com> wrote: > The same 12.9GB distributed across 4 machines using Bizgres MPP fits into > I/O cache. The interesting result is that the query "select count(1)" is > limited in speed to 280 MB/s per CPU when run on the lineitem table. So > when I run it spread over 4 machines, one CPU per machine I get this: > > ====================================================== > Bizgres MPP, 4 data segments, 1 per 2 CPUs > ====================================================== > llonergan=# explain select count(1) from lineitem; > QUERY PLAN > ---------------------------------------------------------------------------- > ---------- > Aggregate (cost=582452.00..582452.00 rows=1 width=0) > -> Gather Motion (cost=582452.00..582452.00 rows=1 width=0) > -> Aggregate (cost=582452.00..582452.00 rows=1 width=0) > -> Seq Scan on lineitem (cost=0.00..544945.00 rows=15002800 > width=0) > (4 rows) > > llonergan=# \timing > Timing is on. > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 12191.435 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 11986.109 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 11448.941 ms > ====================================================== > > That's 12,937 MB in 11.45 seconds, or 1,130 MB/s. When you divide out the > number of Postgres instances (4), that's 283MB/s per Postgres instance. > > To verify that this has nothing to do with MPP, I ran it in a special > internal mode on one instance and got the same result. > > So - we should be able to double this rate by running one segment per CPU, > or two per host: > > ====================================================== > Bizgres MPP, 8 data segments, 1 per CPU > ====================================================== > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 6484.594 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 6156.729 ms > llonergan=# select count(1) from lineitem; > count > ---------- > 59986052 > (1 row) > > Time: 6063.416 ms > ====================================================== > That's 12,937 MB in 11.45 seconds, or 2,134 MB/s. When you divide out the > number of Postgres instances (8), that's 267MB/s per Postgres instance. > > So, if you want to "select count(1)", using more CPUs is a good idea! For > most complex queries, having lots of CPUs + MPP is a good combo. > > Here is an example of a sorting plan - this should probably be done with a > hash aggregation, but using 8 CPUs makes it go 8x faster: > > ====================================================== > Bizgres MPP, 8 data segments, 1 per CPU > ====================================================== > llonergan=# \timing > Timing is on. > llonergan=# explain select l_orderkey from lineitem order by l_shipdate, > l_extendedprice limit 10; > QUERY PLAN > ---------------------------------------------------------------------------- > ----- > Limit (cost=0.01..0.02 rows=1 width=24) > -> Gather Motion (cost=0.01..0.02 rows=1 width=24) > Merge Key: l_shipdate, l_extendedprice > -> Limit (cost=0.01..0.02 rows=1 width=24) > -> Sort (cost=0.01..0.02 rows=1 width=24) > Sort Key: l_shipdate, l_extendedprice > -> Seq Scan on lineitem (cost=0.00..0.00 rows=1 > width=24) > (7 rows) > > Time: 0.592 ms > llonergan=# select l_orderkey from lineitem order by l_shipdate, > l_extendedprice limit 10; > l_orderkey > ------------ > 51829667 > 26601603 > 16579717 > 40046023 > 41707078 > 22880928 > 35584422 > 31272229 > 49914018 > 42309990 > (10 rows) > > Time: 93469.443 ms > > ====================================================== > > So that's 60M rows and 12.9GB sorted in 93.5 seconds. > > - Luke > > From pgsql-performance-owner@postgresql.org Mon Nov 28 14:10:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D4F739DCAD6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 14:10:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78685-08 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 14:10:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 36CD29DCAB7 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 14:10:03 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Hardware/OS recommendations for large databases ( Date: Mon, 28 Nov 2005 13:10:07 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD97C@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcX0Har25nxnYObrS3+XepwMdgqpDgAKRLww From: "Merlin Moncure" <merlin.moncure@rcsonline.com> To: "Mark Kirkwood" <markir@paradise.net.nz> Cc: <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/538 X-Sequence-Number: 15795 >=20 > It certainly makes quite a difference as I measure it: >=20 > doing select(1) from a 181000 page table (completely uncached) on my PIII: >=20 > 8.0 : 32 s > 8.1 : 25 s >=20 > Note that the 'fastcount()' function takes 21 s in both cases - so all > the improvement seems to be from the count overhead reduction. Are you running windows? There is a big performance improvement in count(*) on pg 8.0->8.1 on win32 that is not relevant to this debate... Merlin From pgsql-performance-owner@postgresql.org Mon Nov 28 17:45:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4501C9DCC34 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 17:45:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54723-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 17:45:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [203.96.152.181]) by postgresql.org (Postfix) with ESMTP id 7856E9DCC2A for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 17:45:49 -0400 (AST) Received: from smtp-1.paradise.net.nz (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IQO00G8VPSBIV@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 29 Nov 2005 10:45:47 +1300 (NZDT) Received: from [192.168.1.11] (218-101-29-74.dsl.clear.net.nz [218.101.29.74]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 49B63146C748; Tue, 29 Nov 2005 10:45:47 +1300 (NZDT) Date: Tue, 29 Nov 2005 10:45:46 +1300 From: Mark Kirkwood <markir@paradise.net.nz> Subject: Re: Hardware/OS recommendations for large databases ( In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3417DD97C@Herge.rcsinc.local> To: Merlin Moncure <merlin.moncure@rcsonline.com> Cc: pgsql-performance@postgresql.org Message-id: <438B7A8A.4020505@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051106) References: <6EE64EF3AB31D5448D0007DD34EEB3417DD97C@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/539 X-Sequence-Number: 15796 Merlin Moncure wrote: >>It certainly makes quite a difference as I measure it: >> >>doing select(1) from a 181000 page table (completely uncached) on my > > PIII: > >>8.0 : 32 s >>8.1 : 25 s >> >>Note that the 'fastcount()' function takes 21 s in both cases - so all >>the improvement seems to be from the count overhead reduction. > > > Are you running windows? There is a big performance improvement in > count(*) on pg 8.0->8.1 on win32 that is not relevant to this debate... > No - FreeBSD 6.0 on a dual PIII 1 Ghz. The slow cpu means that the 8.1 improvements are very noticeable! A point of interest - applying Niels palloc - avoiding changes to NodeAgg.c and int8.c in 8.0 changes those results to: 8.0 + palloc avoiding patch : 27 s (I am guessing the remaining 2 s could be shaved off if I backported 8.1's virtual tuples - however that looked like a lot of work) Cheers Mark From pgsql-performance-owner@postgresql.org Mon Nov 28 18:07:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6A4D39DCC0C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 18:07:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60594-01 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 18:07:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) by postgresql.org (Postfix) with ESMTP id 483D19DCAB7 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 18:07:38 -0400 (AST) Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Mon, 28 Nov 2005 17:07:26 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 28 Nov 2005 17:06:59 -0500 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 28 Nov 2005 22:05:14 +0000 User-Agent: Microsoft-Entourage/11.2.1.051004 Date: Mon, 28 Nov 2005 14:05:15 -0800 Subject: Re: Hardware/OS recommendations for large databases ( From: "Luke Lonergan" <llonergan@greenplum.com> To: "Mark Kirkwood" <markir@paradise.net.nz>, "Merlin Moncure" <merlin.moncure@rcsonline.com> cc: pgsql-performance@postgresql.org Message-ID: <BFB0BF1B.1495C%llonergan@greenplum.com> Thread-Topic: [PERFORM] Hardware/OS recommendations for large databases ( Thread-Index: AcX0ZjyyJ8+6opcfSNKK6fecsFUZHgAAZLNv In-Reply-To: <438B7A8A.4020505@paradise.net.nz> MIME-Version: 1.0 X-OriginalArrivalTime: 28 Nov 2005 22:06:59.0885 (UTC) FILETIME=[0E040DD0:01C5F468] X-WSS-ID: 6F95A1DA4J81252576-94-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.253 required=5 tests=[RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.253 X-Spam-Level: * X-Archive-Number: 200511/540 X-Sequence-Number: 15797 Mark, On 11/28/05 1:45 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: >>> 8.0 : 32 s >>> 8.1 : 25 s A 22% reduction. select count(1) on 12,900MB = 1617125 pages fully cached: MPP based on 8.0 : 6.06s MPP based on 8.1 : 4.45s A 26% reduction. I'll take it! I am looking to back-port Tom's pre-8.2 changes and test again, maybe tonight. - Luke From pgsql-performance-owner@postgresql.org Mon Nov 28 19:45:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B0E739DCC0C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 19:45:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12328-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 19:44:44 -0400 (AST) X-Greylist: delayed 00:25:15.507181 by SQLgrey- Received: from cobalt.clickspace.com (mail.clickspace.com [65.110.166.234]) by postgresql.org (Postfix) with ESMTP id 755FD9DCC42 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 19:44:39 -0400 (AST) Received: from [192.168.5.172] ([68.145.108.192]) by cobalt.clickspace.com (8.10.2/8.10.2) with ESMTP id jASNJMK21320 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 16:19:22 -0700 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <BFB0BF1B.1495C%llonergan@greenplum.com> References: <BFB0BF1B.1495C%llonergan@greenplum.com> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-1-293953008; protocol="application/pkcs7-signature" Message-Id: <179B5137-F0BB-4037-A5AD-3459B914E580@clickspace.com> From: Brendan Duddridge <brendan@clickspace.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Mon, 28 Nov 2005 16:19:34 -0700 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/542 X-Sequence-Number: 15799 --Apple-Mail-1-293953008 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Forgive my ignorance, but what is MPP? Is that part of Bizgres? Is it possible to upgrade from Postgres 8.1 to Bizgres? Thanks, ____________________________________________________________________ Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com ClickSpace Interactive Inc. Suite L100, 239 - 10th Ave. SE Calgary, AB T2G 0V9 http://www.clickspace.com On Nov 28, 2005, at 3:05 PM, Luke Lonergan wrote: > Mark, > > On 11/28/05 1:45 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > >>>> 8.0 : 32 s >>>> 8.1 : 25 s > > A 22% reduction. > > select count(1) on 12,900MB = 1617125 pages fully cached: > > MPP based on 8.0 : 6.06s > MPP based on 8.1 : 4.45s > > A 26% reduction. > > I'll take it! > > I am looking to back-port Tom's pre-8.2 changes and test again, maybe > tonight. > > - Luke > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > --Apple-Mail-1-293953008 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGIDCCAtkw ggJCoAMCAQICAw84ujANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwNzI5MjAxMTQzWhcNMDYwNzI5MjAxMTQzWjBIMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSUwIwYJKoZIhvcNAQkBFhZicmVuZGFuQGNsaWNrc3Bh Y2UuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqWfMCdFgKzXroGNqJuU3eyDC K/Gxts3mtmIdgcHGmUjRKdlBSfkmcCBUDPJIt4QQc91sY3h8Itg0EAsF+1yFECU6afn/1SEAHSDK 6Q86PclF58/Dux2FYNGpeIAw/lisZ2UCyIYoUiWtEDKCBq5jDuYzcGkFS5Csz+/rEL+BHTXQVqnS nUdUaXu9xdZn4wgjB/n65UEYRqr0LGN53CGsFcA9uC+ViS7WyBtzJcP02LMNT+cAZ7TKHw4Q/ZeG 5ptPgQHLTD2wza3GMbPQ4fYK6aNPA+lVzslLSCjyQpg55gVyQQlV0k/5zU5Q5m48ZtqwOqN+fPYd eIB7H5y1SFLd/wIDAQABozMwMTAhBgNVHREEGjAYgRZicmVuZGFuQGNsaWNrc3BhY2UuY29tMAwG A1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAT+6hGvStHoRO0OCHlJev31BpUlvPSpbYVKJN i5kCMF164sSX7j0IRvcyU6DfUuW7samTluXJbANyuX1ZIpXulGen5EEc2NV7eU/rMz6ExklMShTh ++azcvmMjOzTuqXi3ZsIjwzBBhqCB0U++kYlMlHEYla2qKLFbXY6PiH0a8swggM/MIICqKADAgEC AgENMA0GCSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBl MRIwEAYDVQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQL Ex9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29u YWwgRnJlZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5j b20wHhcNMDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFs IEZyZWVtYWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftO ucqZWh5owHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9x VsuvPAsH5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAe ZBlyYLf7AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJo dHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8E BAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3 DQEBBQUAA4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9 reFhYsPZOhl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAa WzVNd+NWIXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMG A1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMx CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTExMjgyMzE5MzVaMCMGCSqGSIb3DQEJBDEW BBRN+f5nSDDP78Y/hZfnMjisngVbszB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUw IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDzi6MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYD VQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMj VGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujANBgkqhkiG9w0BAQEFAASC AQCMT5HzBOnFPa40lGunQwqVp7/w0uOtgZMcsQYIM3I9Q+3tEYv4KwZiz5KyIb9bOQS5fJzhtxkv Gu2ZPeKzeNpfPRPGzMPBtTsmBi0+hpCrlitghLN/xpPFB/NI4Q2Xkd6/fpi8R5uy9mgAk8yjv6HC rVth6YFj10E4fgzXzB9b3wFyi9W8jpTckuyAhsayPkAPLgygQ39kw+v5cl+IsjZLGKgSgSD8aWSb LorfHM9fpBpuuBHCdsoITlG4B6TapeP0Qo7Np7GkC4EpCrBlM7dEb9QKMYSUzPlfEFug5Eay82FB CyrNsXMBm6f8u/54b0OvLMggkaqisuiYLL3+3c99AAAAAAAA --Apple-Mail-1-293953008-- From pgsql-performance-owner@postgresql.org Mon Nov 28 19:37:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 415629DCC0C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 19:37:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73445-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 19:37:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id A56989DCAB2 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 19:37:10 -0400 (AST) Received: from [192.168.1.100] ([24.202.23.128]) by VL-MO-MR002.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0IQO009M1UY0MRC0@VL-MO-MR002.ip.videotron.ca> for pgsql-performance@postgresql.org; Mon, 28 Nov 2005 18:37:13 -0500 (EST) Date: Mon, 28 Nov 2005 18:40:59 -0500 From: David Gagnon <dgagnon@siunik.com> Subject: Please help with this explain analyse... To: pgsql-performance@postgresql.org Message-id: <438B958B.3010602@siunik.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.343 required=5 tests=[AWL=0.343] X-Spam-Score: 0.343 X-Spam-Level: X-Archive-Number: 200511/541 X-Sequence-Number: 15798 Hi all, I don't understand why this request take so long. Maybe I read the analyse correctly but It seem that the first line(Nested Loop Left Join ...) take all the time. But I don't understand where the performance problem is ??? All the time is passed in the first line ... Thanks for your help! /David explain analyse SELECT * FROM CR INNER JOIN CS ON CR.CRNUM = CS.CSCRNUM AND CR.CRYPNUM = CS.CSYPNUM INNER JOIN GL ON CS.CSGLNUM = GL.GLNUM AND GL.GLSOCTRL = 1 INNER JOIN RR ON CR.CRRRNUM = RR.RRNUM LEFT OUTER JOIN YR ON YR.YRYOTYPE = 'Client' AND YR.YRYONUM = 'Comptabilite.Recevable.Regroupement' AND YR.YRREF = RR.RRNUM WHERE CRYPNUM = 'M' AND CRDATE + INTERVAL '0 days' <= '2005-01-28' "Nested Loop Left Join (cost=0.00..42.12 rows=1 width=8143) (actual time=15.254..200198.524 rows=8335 loops=1)" " Join Filter: (("inner".yrref)::text = ("outer".rrnum)::text)" " -> Nested Loop (cost=0.00..36.12 rows=1 width=7217) (actual time=0.441..2719.821 rows=8335 loops=1)" " -> Nested Loop (cost=0.00..30.12 rows=1 width=1580) (actual time=0.242..1837.413 rows=8335 loops=1)" " -> Nested Loop (cost=0.00..18.07 rows=2 width=752) (actual time=0.145..548.607 rows=13587 loops=1)" " -> Seq Scan on gl (cost=0.00..5.21 rows=1 width=608) (actual time=0.036..0.617 rows=1 loops=1)" " Filter: (glsoctrl = 1)" " -> Index Scan using cs_pk on cs (cost=0.00..12.83 rows=2 width=144) (actual time=0.087..444.999 rows=13587 loops=1)" " Index Cond: (('M'::text = (cs.csypnum)::text) AND ((cs.csglnum)::text = ("outer".glnum)::text))" " -> Index Scan using cr_pk on cr (cost=0.00..6.02 rows=1 width=828) (actual time=0.073..0.077 rows=1 loops=13587)" " Index Cond: (((cr.crypnum)::text = 'M'::text) AND (cr.crnum = "outer".cscrnum))" " Filter: ((crdate + '00:00:00'::interval) <= '2005-01-28 00:00:00'::timestamp without time zone)" " -> Index Scan using rr_pk on rr (cost=0.00..5.99 rows=1 width=5637) (actual time=0.062..0.069 rows=1 loops=8335)" " Index Cond: (("outer".crrrnum)::text = (rr.rrnum)::text)" " -> Index Scan using yr_idx1 on yr (cost=0.00..5.99 rows=1 width=926) (actual time=0.127..17.379 rows=1154 loops=8335)" " Index Cond: (((yryotype)::text = 'Client'::text) AND ((yryonum)::text = 'Comptabilite.Recevable.Regroupement'::text))" "Total runtime: 200235.732 ms" From pgsql-performance-owner@postgresql.org Mon Nov 28 19:47:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 86F7A9DCC43 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 19:47:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72619-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 19:47:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from presinet.com (presinet.com [209.53.156.1]) by postgresql.org (Postfix) with ESMTP id BE2319DCC33 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 19:47:07 -0400 (AST) Received: from [10.10.1.151] ([10.10.1.151]) by presinet.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 28 Nov 2005 15:44:25 -0800 Message-ID: <438B96C6.4090902@PresiNET.com> Date: Mon, 28 Nov 2005 15:46:14 -0800 From: Bricklen Anderson <BAnderson@PresiNET.com> User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Gagnon <dgagnon@siunik.com> CC: pgsql-performance@postgresql.org Subject: Re: Please help with this explain analyse... References: <438B958B.3010602@siunik.com> In-Reply-To: <438B958B.3010602@siunik.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 28 Nov 2005 23:44:25.0750 (UTC) FILETIME=[AA6C4360:01C5F475] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/543 X-Sequence-Number: 15800 David Gagnon wrote: > " -> Index Scan using cr_pk on cr (cost=0.00..6.02 rows=1 > width=828) (actual time=0.073..0.077 rows=1 loops=13587)" > " Index Cond: (((cr.crypnum)::text = 'M'::text) AND > (cr.crnum = "outer".cscrnum))" > " Filter: ((crdate + '00:00:00'::interval) <= > '2005-01-28 00:00:00'::timestamp without time zone)" > " -> Index Scan using rr_pk on rr (cost=0.00..5.99 rows=1 > width=5637) (actual time=0.062..0.069 rows=1 loops=8335)" > " Index Cond: (("outer".crrrnum)::text = (rr.rrnum)::text)" > " -> Index Scan using yr_idx1 on yr (cost=0.00..5.99 rows=1 > width=926) (actual time=0.127..17.379 rows=1154 loops=8335)" Your loops are what is causing the time spent. eg. "actual time=0.127..17.379 rows=1154 loops=8335)" == 8335*(17.379-0.127)/1000=>143 secs (if my math is correct). -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________ From pgsql-performance-owner@postgresql.org Mon Nov 28 20:01:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6D48A9DCC42 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 20:01:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72712-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 20:00:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A4F439DCC57 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 20:00:27 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAT00U6S017299; Mon, 28 Nov 2005 19:00:30 -0500 (EST) To: Bricklen Anderson <BAnderson@PresiNET.com> cc: David Gagnon <dgagnon@siunik.com>, pgsql-performance@postgresql.org Subject: Re: Please help with this explain analyse... In-reply-to: <438B96C6.4090902@PresiNET.com> References: <438B958B.3010602@siunik.com> <438B96C6.4090902@PresiNET.com> Comments: In-reply-to Bricklen Anderson <BAnderson@PresiNET.com> message dated "Mon, 28 Nov 2005 15:46:14 -0800" Date: Mon, 28 Nov 2005 19:00:30 -0500 Message-ID: <17298.1133222430@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/544 X-Sequence-Number: 15801 Bricklen Anderson <BAnderson@PresiNET.com> writes: > Your loops are what is causing the time spent. > eg. "actual time=0.127..17.379 rows=1154 loops=8335)" == > 8335*(17.379-0.127)/1000=>143 secs (if my math is correct). As for where the problem is, I think it's the horrid misestimate of the number of matching rows in cs_pk: >> " -> Index Scan using cs_pk on cs (cost=0.00..12.83 >> rows=2 width=144) (actual time=0.087..444.999 rows=13587 loops=1)" >> " Index Cond: (('M'::text = (cs.csypnum)::text) >> AND ((cs.csglnum)::text = ("outer".glnum)::text))" Has that table been ANALYZEd recently? How about the gl table? regards, tom lane From pgsql-performance-owner@postgresql.org Mon Nov 28 22:13:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 78D159DCB0C for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 22:13:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92272-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 22:13:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id 68A7C9DCAB3 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 22:13:02 -0400 (AST) Received: from [192.168.1.100] ([24.202.23.128]) by VL-MO-MR004.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0IQP004MG25U4XB0@VL-MO-MR004.ip.videotron.ca> for pgsql-performance@postgresql.org; Mon, 28 Nov 2005 21:13:07 -0500 (EST) Date: Mon, 28 Nov 2005 21:16:52 -0500 From: David Gagnon <dgagnon@siunik.com> Subject: Re: Please help with this explain analyse... In-reply-to: <17298.1133222430@sss.pgh.pa.us> To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Bricklen Anderson <BAnderson@PresiNET.com>, pgsql-performance@postgresql.org Message-id: <438BBA14.5080103@siunik.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en References: <438B958B.3010602@siunik.com> <438B96C6.4090902@PresiNET.com> <17298.1133222430@sss.pgh.pa.us> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.229 required=5 tests=[AWL=0.229] X-Spam-Score: 0.229 X-Spam-Level: X-Archive-Number: 200511/545 X-Sequence-Number: 15802 I restored my db but haven't run the analyse... That was the problem. Thanks /David "Merge Left Join (cost=2273.54..2290.19 rows=228 width=816) (actual time=2098.257..2444.472 rows=8335 loops=1)" " Merge Cond: (("outer".rrnum)::text = "inner"."?column8?")" " -> Merge Join (cost=2131.25..2141.31 rows=228 width=744) (actual time=2037.953..2251.289 rows=8335 loops=1)" " Merge Cond: ("outer"."?column31?" = "inner"."?column77?")" " -> Sort (cost=1975.03..1975.60 rows=228 width=235) (actual time=1798.556..1811.828 rows=8335 loops=1)" " Sort Key: (cr.crrrnum)::text" " -> Hash Join (cost=1451.41..1966.10 rows=228 width=235) (actual time=267.751..515.396 rows=8335 loops=1)" " Hash Cond: ("outer".crnum = "inner".cscrnum)" " -> Seq Scan on cr (cost=0.00..489.77 rows=4529 width=101) (actual time=0.077..97.615 rows=8335 loops=1)" " Filter: (((crypnum)::text = 'M'::text) AND ((crdate + '00:00:00'::interval) <= '2005-01-28 00:00:00'::timestamp without time zone))" " -> Hash (cost=1449.70..1449.70 rows=684 width=134) (actual time=267.568..267.568 rows=13587 loops=1)" " -> Nested Loop (cost=20.59..1449.70 rows=684 width=134) (actual time=33.099..178.524 rows=13587 loops=1)" " -> Seq Scan on gl (cost=0.00..5.21 rows=2 width=91) (actual time=0.021..0.357 rows=1 loops=1)" " Filter: (glsoctrl = 1)" " -> Bitmap Heap Scan on cs (cost=20.59..684.42 rows=3026 width=43) (actual time=33.047..115.151 rows=13587 loops=1)" " Recheck Cond: ((cs.csglnum)::text = ("outer".glnum)::text)" " Filter: ('M'::text = (csypnum)::text)" " -> Bitmap Index Scan on cs_gl_fk (cost=0.00..20.59 rows=3026 width=0) (actual time=32.475..32.475 rows=13587 loops=1)" " Index Cond: ((cs.csglnum)::text = ("outer".glnum)::text)" " -> Sort (cost=156.22..159.65 rows=1372 width=509) (actual time=239.315..254.024 rows=8974 loops=1)" " Sort Key: (rr.rrnum)::text" " -> Seq Scan on rr (cost=0.00..84.72 rows=1372 width=509) (actual time=0.055..33.564 rows=1372 loops=1)" " -> Sort (cost=142.29..144.55 rows=903 width=72) (actual time=60.246..74.813 rows=8932 loops=1)" " Sort Key: (yr.yrref)::text" " -> Bitmap Heap Scan on yr (cost=16.42..97.96 rows=903 width=72) (actual time=8.513..13.587 rows=1154 loops=1)" " Recheck Cond: (((yryotype)::text = 'Client'::text) AND ((yryonum)::text = 'Comptabilite.Recevable.Regroupement'::text))" " -> Bitmap Index Scan on yr_idx1 (cost=0.00..16.42 rows=903 width=0) (actual time=8.471..8.471 rows=1154 loops=1)" " Index Cond: (((yryotype)::text = 'Client'::text) AND ((yryonum)::text = 'Comptabilite.Recevable.Regroupement'::text))" "Total runtime: 2466.197 ms" >Bricklen Anderson <BAnderson@PresiNET.com> writes: > > >>Your loops are what is causing the time spent. >>eg. "actual time=0.127..17.379 rows=1154 loops=8335)" == >>8335*(17.379-0.127)/1000=>143 secs (if my math is correct). >> >> > >As for where the problem is, I think it's the horrid misestimate of the >number of matching rows in cs_pk: > > > >>>" -> Index Scan using cs_pk on cs (cost=0.00..12.83 >>>rows=2 width=144) (actual time=0.087..444.999 rows=13587 loops=1)" >>>" Index Cond: (('M'::text = (cs.csypnum)::text) >>>AND ((cs.csglnum)::text = ("outer".glnum)::text))" >>> >>> > >Has that table been ANALYZEd recently? How about the gl table? > > regards, tom lane > > > From pgsql-performance-owner@postgresql.org Mon Nov 28 23:19:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A62939DCBE6 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 23:19:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01264-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 23:19:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cobalt.clickspace.com (mail.clickspace.com [65.110.166.234]) by postgresql.org (Postfix) with ESMTP id 6CE109DCB6F for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 23:19:41 -0400 (AST) Received: from [192.168.5.172] ([68.145.108.192]) by cobalt.clickspace.com (8.10.2/8.10.2) with ESMTP id jAT3JRK03281; Mon, 28 Nov 2005 20:19:27 -0700 In-Reply-To: <Pine.LNX.4.62.0511271903180.2807@qnivq.ynat.uz> References: <BFB0BF1B.1495C%llonergan@greenplum.com> <179B5137-F0BB-4037-A5AD-3459B914E580@clickspace.com> <Pine.LNX.4.62.0511271903180.2807@qnivq.ynat.uz> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-2-308359218; protocol="application/pkcs7-signature" Message-Id: <3017A204-1BAF-4E62-ADA6-695E34557645@clickspace.com> Cc: pgsql-performance@postgresql.org From: Brendan Duddridge <brendan@clickspace.com> Subject: Re: Hardware/OS recommendations for large databases ( Date: Mon, 28 Nov 2005 20:19:41 -0700 To: David Lang <dlang@invendra.net> X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/546 X-Sequence-Number: 15803 --Apple-Mail-2-308359218 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi David, Thanks for your reply. So how is that different than something like Slony2 or pgcluster with multi-master replication? Is it similar technology? We're currently looking for a good clustering solution that will work on our Apple Xserves and Xserve RAIDs. Thanks, ____________________________________________________________________ Brendan Duddridge | CTO | 403-277-5591 x24 | brendan@clickspace.com ClickSpace Interactive Inc. Suite L100, 239 - 10th Ave. SE Calgary, AB T2G 0V9 http://www.clickspace.com On Nov 27, 2005, at 8:09 PM, David Lang wrote: > On Mon, 28 Nov 2005, Brendan Duddridge wrote: > >> Forgive my ignorance, but what is MPP? Is that part of Bizgres? Is >> it possible to upgrade from Postgres 8.1 to Bizgres? > > MPP is the Greenplum propriatary extention to postgres that spreads > the data over multiple machines, (raid, but with entire machines > not just drives, complete with data replication within the cluster > to survive a machine failing) > > for some types of queries they can definantly scale lineraly with > the number of machines (other queries are far more difficult and > the overhead of coordinating the machines shows more. this is one > of the key things that the new version they recently announced the > beta for is supposed to be drasticly improving) > > early in the year when I first looked at them their prices were > exorbadent, but Luke says I'm wildly mistake on their current > prices so call them for details > > it uses the same interfaces as postgres so it should be a drop in > replacement to replace a single server with a cluster. > > it's facinating technology to read about. > > I seem to remember reading that one of the other postgres companies > is also producing a clustered version of postgres, but I don't > remember who and know nothing about them. > > David Lang > --Apple-Mail-2-308359218 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGIDCCAtkw ggJCoAMCAQICAw84ujANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0EwHhcNMDUwNzI5MjAxMTQzWhcNMDYwNzI5MjAxMTQzWjBIMR8wHQYDVQQD ExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSUwIwYJKoZIhvcNAQkBFhZicmVuZGFuQGNsaWNrc3Bh Y2UuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqWfMCdFgKzXroGNqJuU3eyDC K/Gxts3mtmIdgcHGmUjRKdlBSfkmcCBUDPJIt4QQc91sY3h8Itg0EAsF+1yFECU6afn/1SEAHSDK 6Q86PclF58/Dux2FYNGpeIAw/lisZ2UCyIYoUiWtEDKCBq5jDuYzcGkFS5Csz+/rEL+BHTXQVqnS nUdUaXu9xdZn4wgjB/n65UEYRqr0LGN53CGsFcA9uC+ViS7WyBtzJcP02LMNT+cAZ7TKHw4Q/ZeG 5ptPgQHLTD2wza3GMbPQ4fYK6aNPA+lVzslLSCjyQpg55gVyQQlV0k/5zU5Q5m48ZtqwOqN+fPYd eIB7H5y1SFLd/wIDAQABozMwMTAhBgNVHREEGjAYgRZicmVuZGFuQGNsaWNrc3BhY2UuY29tMAwG A1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEEBQADgYEAT+6hGvStHoRO0OCHlJev31BpUlvPSpbYVKJN i5kCMF164sSX7j0IRvcyU6DfUuW7samTluXJbANyuX1ZIpXulGen5EEc2NV7eU/rMz6ExklMShTh ++azcvmMjOzTuqXi3ZsIjwzBBhqCB0U++kYlMlHEYla2qKLFbXY6PiH0a8swggM/MIICqKADAgEC AgENMA0GCSqGSIb3DQEBBQUAMIHRMQswCQYDVQQGEwJaQTEVMBMGA1UECBMMV2VzdGVybiBDYXBl MRIwEAYDVQQHEwlDYXBlIFRvd24xGjAYBgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQL Ex9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMSQwIgYDVQQDExtUaGF3dGUgUGVyc29u YWwgRnJlZW1haWwgQ0ExKzApBgkqhkiG9w0BCQEWHHBlcnNvbmFsLWZyZWVtYWlsQHRoYXd0ZS5j b20wHhcNMDMwNzE3MDAwMDAwWhcNMTMwNzE2MjM1OTU5WjBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFs IEZyZWVtYWlsIElzc3VpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMSmPFVzVftO ucqZWh5owHUEcJ3f6f+jHuy9zfVb8hp2vX8MOmHyv1HOAdTlUAow1wJjWiyJFXCO3cnwK4Vaqj9x VsuvPAsH5/EfkTYkKhPPK9Xzgnc9A74r/rsYPge/QIACZNenprufZdHFKlSFD0gEf6e20TxhBEAe ZBlyYLf7AgMBAAGjgZQwgZEwEgYDVR0TAQH/BAgwBgEB/wIBADBDBgNVHR8EPDA6MDigNqA0hjJo dHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhhd3RlUGVyc29uYWxGcmVlbWFpbENBLmNybDALBgNVHQ8E BAMCAQYwKQYDVR0RBCIwIKQeMBwxGjAYBgNVBAMTEVByaXZhdGVMYWJlbDItMTM4MA0GCSqGSIb3 DQEBBQUAA4GBAEiM0VCD6gsuzA2jZqxnD3+vrL7CF6FDlpSdf0whuPg2H6otnzYvwPQcUCCTcDz9 reFhYsPZOhl+hLGZGwDFGguCdJ4lUJRix9sncVcljd2pnDmOjCBPZV+V2vf3h9bGCE6u9uo05RAa WzVNd+NWIXiC3CEZNd4ksdMdRv9dX2VPMYIC5zCCAuMCAQEwaTBiMQswCQYDVQQGEwJaQTElMCMG A1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujAJBgUrDgMCGgUAoIIBUzAYBgkqhkiG9w0BCQMx CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTExMjkwMzE5NDJaMCMGCSqGSIb3DQEJBDEW BBTjOzUI9sdXEr+YLnOlBAUiMJBiMzB4BgkrBgEEAYI3EAQxazBpMGIxCzAJBgNVBAYTAlpBMSUw IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDzi6MHoGCyqGSIb3DQEJEAILMWugaTBiMQswCQYD VQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMj VGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECAw84ujANBgkqhkiG9w0BAQEFAASC AQAnKeqtUIdIbGMC8rtLS+xU+4am9hOJxEcQM3YMskPnCaKHahOQod63zUQ/YD6UUK8/zxjYVPK6 xsC/nm7DMGNx45MtK764K/IGKnHKz1XhmK7bLSWpyq+981dr9m1vg1V2XADqvUcVw/A3Vzu2WhQL QITpSi4NgubHRxv3bQJ8Ym4WRA6phq8ur7Oei8Cy/bG1M2Z+hyrWc/zEa+k+dL00Ox6unSaIuToq 3hQwcxP7mMnh+svoTQ9uoqB8WsQvhf2WhuFL6HBnu8bhUQzNRcIsELz2tDODaBVJXJ228Pdrzx5e LmrJoY4F4AdjAvMxYGeJsXOiTWHzDZvrZUgS7nSnAAAAAAAA --Apple-Mail-2-308359218-- From pgsql-performance-owner@postgresql.org Mon Nov 28 23:30:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B097A9DCC39 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 23:30:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01674-06 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Mon, 28 Nov 2005 23:30:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from toad.mtbrook.bozemanpass.com (toad.mtbrook.bozemanpass.com [69.145.82.195]) by postgresql.org (Postfix) with ESMTP id E1C5B9DCC19 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 23:30:50 -0400 (AST) Received: from [69.145.82.253] (unknown [69.145.82.253]) by toad.mtbrook.bozemanpass.com (Postfix) with ESMTP id 2E69B1102E6 for <pgsql-performance@postgresql.org>; Mon, 28 Nov 2005 19:30:52 -0800 (PST) Message-ID: <438BCB6D.3090406@boreham.org> Date: Mon, 28 Nov 2005 20:30:53 -0700 From: David Boreham <david_list@boreham.org> User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hardware/OS recommendations for large databases ( References: <BFB0BF1B.1495C%llonergan@greenplum.com> <179B5137-F0BB-4037-A5AD-3459B914E580@clickspace.com> <Pine.LNX.4.62.0511271903180.2807@qnivq.ynat.uz> <3017A204-1BAF-4E62-ADA6-695E34557645@clickspace.com> In-Reply-To: <3017A204-1BAF-4E62-ADA6-695E34557645@clickspace.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/547 X-Sequence-Number: 15804 Brendan Duddridge wrote: > Thanks for your reply. So how is that different than something like > Slony2 or pgcluster with multi-master replication? Is it similar > technology? We're currently looking for a good clustering solution > that will work on our Apple Xserves and Xserve RAIDs. I think you need to be more specific about what you're trying to do. 'clustering' encompasses so many things that it means almost nothing by itself. slony provides facilities for replicating data. Its primary purpose is to improve reliability. MPP distributes both data and queries. Its primary purpose is to improve performance for a subset of all query types. From pgsql-performance-owner@postgresql.org Tue Nov 29 03:34:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 95DC89DD600 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 03:33:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00746-01-4 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 03:33:40 -0400 (AST) X-Greylist: delayed 00:31:09.386303 by SQLgrey- Received: from mx2.buaa.edu.cn (mx2.buaa.edu.cn [219.239.227.26]) by postgresql.org (Postfix) with ESMTP id 2471C9DD557 for <pgsql-performance@postgresql.org>; Tue, 29 Nov 2005 03:31:38 -0400 (AST) Received: from mx1.buaa.edu.cn (mx1.buaa.edu.cn [192.168.128.5]) by mx2.buaa.edu.cn (Postfix) with ESMTP id 8294B37F78 for <pgsql-performance@postgresql.org>; Tue, 29 Nov 2005 14:59:44 +0800 (CST) Received: from [203.86.95.74] by 10.0.0.130 with StormMail ESMTP id 99741.1939646864; Tue, 29 Nov 2005 15:52:07 +0800 (CST) Date: Tue, 29 Nov 2005 15:00:22 +0800 From: "energumen@buaa.edu.cn" <energumen@buaa.edu.cn> To: "pgsql-performance" <pgsql-performance@postgresql.org> Subject: index auto changes after copying data ? X-mailer: Foxmail 5.0 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Message-Id: <20051129065944.8294B37F78@mx2.buaa.edu.cn> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=4.813 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_WHOIS=0.879, RCVD_DOUBLE_IP_SPAM=3.455] X-Spam-Score: 4.813 X-Spam-Level: **** X-Archive-Number: 200511/550 X-Sequence-Number: 15807 I know in mysql, index will auto change after copying data Of course, index will change after inserting a line in postgresql, but what about copying data? From pgsql-performance-owner@postgresql.org Tue Nov 29 08:17:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B695B9DCC80 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 08:17:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21583-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 08:17:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 241C09DCBF7 for <pgsql-performance@postgresql.org>; Tue, 29 Nov 2005 08:17:03 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id AC6D5408E5E; Tue, 29 Nov 2005 12:16:13 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 0B2C315EA4; Tue, 29 Nov 2005 12:16:21 +0000 (GMT) Message-ID: <438C4694.3010502@archonet.com> Date: Tue, 29 Nov 2005 12:16:20 +0000 From: Richard Huxton <dev@archonet.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: "energumen@buaa.edu.cn" <energumen@buaa.edu.cn> Cc: pgsql-performance <pgsql-performance@postgresql.org> Subject: Re: index auto changes after copying data ? References: <20051129065944.8294B37F78@mx2.buaa.edu.cn> In-Reply-To: <20051129065944.8294B37F78@mx2.buaa.edu.cn> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/551 X-Sequence-Number: 15808 energumen@buaa.edu.cn wrote: > I know in mysql, index will auto change after copying data > Of course, index will change after inserting a line in postgresql, but what about copying data? The index will (of course) know about the new data. You might want to ANALYZE the table again after a large copy in case the statistics about how many different values are present changes. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Tue Nov 29 15:04:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 95CBD9DCBB7 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 15:04:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17436-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Tue, 29 Nov 2005 15:04:09 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id F266E9DCADF for <pgsql-performance@postgresql.org>; Tue, 29 Nov 2005 15:04:06 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 752643358C; Tue, 29 Nov 2005 20:04:07 +0100 (MET) From: Chris Browne <cbbrowne@acm.org> X-Newsgroups: pgsql.performance Subject: Re: index auto changes after copying data ? Date: Tue, 29 Nov 2005 13:48:49 -0500 Organization: cbbrowne Computing Inc Lines: 19 Message-ID: <60zmnn1e9a.fsf@dba2.int.libertyrms.com> References: <20051129065944.8294B37F78@mx2.buaa.edu.cn> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) Cancel-Lock: sha1:p2ywLvgGkAWWRVpnxWqLIcB/rpA= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.142 required=5 tests=[AWL=0.142] X-Spam-Score: 0.142 X-Spam-Level: X-Archive-Number: 200511/552 X-Sequence-Number: 15809 energumen@buaa.edu.cn ("energumen@buaa.edu.cn") writes: > I know in mysql, index will auto change after copying data Of > course, index will change after inserting a line in postgresql, but > what about copying data? Do you mean, by this, something like... "Are indexes affected by loading data using the COPY command just as they are if data is loaded using INSERT?" If so, then the answer is "Yes, certainly." Indexes are updated whichever statement you use to load in data. -- let name="cbbrowne" and tld="acm.org" in name ^ "@" ^ tld;; http://www.ntlug.org/~cbbrowne/finances.html Rules of the Evil Overlord #160. "Before being accepted into my Legions of Terror, potential recruits will have to pass peripheral vision and hearing tests, and be able to recognize the sound of a pebble thrown to distract them." <http://www.eviloverlord.com/> From pgsql-performance-owner@postgresql.org Wed Nov 30 08:37:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 451089DCAD3 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 08:37:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14458-02 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 08:37:44 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by postgresql.org (Postfix) with ESMTP id 5F9229DCBC4 for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 08:37:40 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 69so83628wri for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 04:37:42 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:importance:x-mimeole; b=L19YFDnsYN71RwBVaSTv/OFEHHI3eMuGAftk1yLKNnVvuWP2PWUmJTwNgIhm0gGPk4v6vnhQfcAkb/fddhG8mgiEWhyV0zOU7VZQq9MASWqFGDhrm6SOS5ZSNzI+pQLZP4zRxcEaTk38Q4CwJIAYwe2jBbtk/4t8AiTrgYbWXQ0= Received: by 10.54.62.18 with SMTP id k18mr463212wra; Wed, 30 Nov 2005 04:37:41 -0800 (PST) Received: from FRANKLIN ( [200.180.51.99]) by mx.gmail.com with ESMTP id 34sm254011wra.2005.11.30.04.37.40; Wed, 30 Nov 2005 04:37:41 -0800 (PST) From: "Franklin Haut" <franklin.haut@gmail.com> To: <pgsql-performance@postgresql.org> Subject: pg_dump slow Date: Wed, 30 Nov 2005 10:35:05 -0300 Message-ID: <000201c5f5b2$e0dc87a0$8500a8c0@FRANKLIN> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/553 X-Sequence-Number: 15810 Hi=20 i=B4m using PostgreSQL on windows 2000, the pg_dump take around 50 = minutes to do backup of 200Mb data ( with no compression, and 15Mb with compression), but in windows XP does not pass of 40 seconds... :( This happens with 8.1 and version 8.0, somebody passed for the same situation?=20 It will be that a configuration in the priorities of the exists processes ? in Windows XP the processing of schemes goes 70% and constant accesses to the HardDisk, while that in windows 2000 it does not pass of 3%. thanks Franklin From pgsql-performance-owner@postgresql.org Wed Nov 30 09:56:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9BDB89DCC70 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 09:56:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18799-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 09:56:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth01.mail.atl.earthlink.net (smtpauth01.mail.atl.earthlink.net [209.86.89.61]) by postgresql.org (Postfix) with ESMTP id AD1BD9DCC3E for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 09:56:45 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=CnMSTS2LnkEbMpI5cN+7igqKMCJXQGpzPzV7uWy5OLsDYfl1m09mjl/7PoS9J6u8; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:In-Reply-To:References:Mime-Version:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth01.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EhSRx-0000Nh-78; Wed, 30 Nov 2005 08:56:45 -0500 Message-Id: <6.2.5.6.0.20051130081636.01da1d48@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Wed, 30 Nov 2005 08:56:41 -0500 To: "Franklin Haut" <franklin.haut@gmail.com>, <pgsql-performance@postgresql.org> From: Ron <rjpeace@earthlink.net> Subject: Re: pg_dump slow In-Reply-To: <000201c5f5b2$e0dc87a0$8500a8c0@FRANKLIN> References: <000201c5f5b2$e0dc87a0$8500a8c0@FRANKLIN> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc48be752cdf4fcce139ec5dd9f6f6a343350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/554 X-Sequence-Number: 15811 At 08:35 AM 11/30/2005, Franklin Haut wrote: >Hi > >i=B4m using PostgreSQL on windows 2000, the pg_dump take around 50 minutes >to do backup of 200Mb data ( with no compression, and 15Mb with >compression), Compression is reducing the data to 15/200=3D 3/40=3D 7.5% of original size? >but in windows XP does not pass of 40 seconds... :( You mean that 40 secs in pg_dump under Win XP=20 crashes, and therefore you have a WinXP problem? Or do you mean that pg_dump takes 40 secs to=20 complete under WinXP and 50 minutes under W2K and=20 therefore you have a W2K problem? In fact, either 15MB/40secs=3D 375KBps or=20 200MB/40secs=3D 5MBps is _slow_, so there's a problem under either platform! >This happens with 8.1 and version 8.0, somebody=20 >passed for the same situation? > >It will be that a configuration in the priorities of the exists >processes ? in Windows XP the processing of schemes goes 70% and >constant accesses to the HardDisk, while that in windows 2000 it does >not pass of 3%. Assuming Win XP completes the dump, the first thing to do is *don't use W2K* M$ has stopped supporting it in anything but absolutely minimum fashion= anyway. _If_ you are going to use an M$ OS you should be using WinXP. (You want to pay licensing fees for your OS, but=20 you are using free DB SW? Huh? If you are=20 trying to save $$$, use Open Source SW like Linux=20 or *BSD. pg will perform better under it, and it's cheaper!) Assuming that for some reason you can't/won't=20 migrate to a non-M$ OS, the next problem is the=20 slow HD IO you are getting under WinXP. What is the HW involved here? Particularly the=20 HD subsystem and the IO bus(es) it is plugged into? For some perspective, Raw HD average IO rates for=20 even reasonably modern 7200rpm HD's is in the=20 ~50MBps per HD range. Top of the line 15Krpm=20 SCSI and FC HD's have raw average IO rates of=20 just under 80MBps per HD as of this post. Given that most DB's are not on 1 HD (if you DB=20 _is_ on only 1 HD, change that ASAP before you=20 lose data...), for anything other than a 2 HD=20 RAID 1 set I'd expect raw HD average IO rates to be at least 100MBps. If you are getting >=3D 100MBps of average HD IO,=20 you should be getting > 5MBps during pg_dump, and certainly > 375MBps! Ron From pgsql-performance-owner@postgresql.org Wed Nov 30 11:23:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9364C9DCCDD for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 11:23:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24351-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 11:23:34 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by postgresql.org (Postfix) with ESMTP id 0ECAD9DCCBE for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 11:23:26 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 71so4277wra for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 07:23:32 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:in-reply-to:x-mimeole:importance; b=WtvlmfG2BPDq6PUczw2aH5f38ucS8KwZgF5+sSPUGfLUY30CZhY/wuKlUqPrpz6+uVIC9Z7i+gScihDIDjRqUVH9AksWoSqKFAf/rWvyFK/rqm9qkXUHt+sFP+Q/XgXkPW52CBPBPoNxXdqAqRPqPsVQV+k9s4O9cMFsLG5h7Ds= Received: by 10.54.76.17 with SMTP id y17mr356431wra; Wed, 30 Nov 2005 07:23:31 -0800 (PST) Received: from FRANKLIN ( [200.180.51.99]) by mx.gmail.com with ESMTP id 39sm67476wrl.2005.11.30.07.23.28; Wed, 30 Nov 2005 07:23:31 -0800 (PST) From: "Franklin Haut" <franklin.haut@gmail.com> To: "'Ron'" <rjpeace@earthlink.net>, <pgsql-performance@postgresql.org> Subject: RES: pg_dump slow Date: Wed, 30 Nov 2005 13:20:51 -0300 Message-ID: <000401c5f5ca$0aed7420$8500a8c0@FRANKLIN> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <6.2.5.6.0.20051130081636.01da1d48@earthlink.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/555 X-Sequence-Number: 15812 Hi, Yes, my problem is that the pg_dump takes 40 secs to complete under WinXP and 50 minutes under W2K! The same database, the same hardware!, only diferrent Operational Systems. The hardware is:=20 Pentium4 HT 3.2 GHz 1024 Mb Memory HD 120Gb SATA Im has make again the test, and then real size of database is 174Mb (avaliable on pg_admin, properties) and the file size of pg_dump is 18Mb ( with command line pg_dump -i -F c -b -v -f "C:\temp\BackupTest.bkp" NameOfDatabase ). The time was equal in 40 seconds on XP and 50 minutes on W2K, using PG 8.1 Unhappyly for some reasons I cannot use other platforms, I need use PG on Windows, and must be W2K. Is strange to have a so great difference in the time of execution of dump, therefore the data are the same ones and the archive is being correctly generated in both OS. Franklin -----Mensagem original----- De: Ron [mailto:rjpeace@earthlink.net]=20 Enviada em: quarta-feira, 30 de novembro de 2005 10:57 Para: Franklin Haut; pgsql-performance@postgresql.org Assunto: Re: [PERFORM] pg_dump slow At 08:35 AM 11/30/2005, Franklin Haut wrote: >Hi > >i=B4m using PostgreSQL on windows 2000, the pg_dump take around 50=20 >minutes to do backup of 200Mb data ( with no compression, and 15Mb with >compression), Compression is reducing the data to 15/200=3D 3/40=3D 7.5% of original = size? >but in windows XP does not pass of 40 seconds... :( You mean that 40 secs in pg_dump under Win XP=20 crashes, and therefore you have a WinXP problem? Or do you mean that pg_dump takes 40 secs to=20 complete under WinXP and 50 minutes under W2K and=20 therefore you have a W2K problem? In fact, either 15MB/40secs=3D 375KBps or=20 200MB/40secs=3D 5MBps is _slow_, so there's a problem under either platform! >This happens with 8.1 and version 8.0, somebody >passed for the same situation? > >It will be that a configuration in the priorities of the exists=20 >processes ? in Windows XP the processing of schemes goes 70% and=20 >constant accesses to the HardDisk, while that in windows 2000 it does=20 >not pass of 3%. Assuming Win XP completes the dump, the first thing to do is *don't use W2K* M$ has stopped supporting it in anything but absolutely minimum fashion anyway. _If_ you are going to use an M$ OS you should be using WinXP. (You want to pay licensing fees for your OS, but=20 you are using free DB SW? Huh? If you are=20 trying to save $$$, use Open Source SW like Linux=20 or *BSD. pg will perform better under it, and it's cheaper!) Assuming that for some reason you can't/won't=20 migrate to a non-M$ OS, the next problem is the=20 slow HD IO you are getting under WinXP. What is the HW involved here? Particularly the=20 HD subsystem and the IO bus(es) it is plugged into? For some perspective, Raw HD average IO rates for=20 even reasonably modern 7200rpm HD's is in the=20 ~50MBps per HD range. Top of the line 15Krpm=20 SCSI and FC HD's have raw average IO rates of=20 just under 80MBps per HD as of this post. Given that most DB's are not on 1 HD (if you DB=20 _is_ on only 1 HD, change that ASAP before you=20 lose data...), for anything other than a 2 HD=20 RAID 1 set I'd expect raw HD average IO rates to be at least 100MBps. If you are getting >=3D 100MBps of average HD IO,=20 you should be getting > 5MBps during pg_dump, and certainly > 375MBps! Ron From pgsql-performance-owner@postgresql.org Wed Nov 30 13:22:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0DD4B9DD675 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 13:21:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00620-04-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 13:21:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 4E1689DD551 for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 12:56:56 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: pg_dump slow Date: Wed, 30 Nov 2005 11:56:50 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9BE@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] pg_dump slow Thread-Index: AcX1tfwWOKcWjlb8Th6i5ZAuqxXZdQACwGbg From: "Merlin Moncure" <merlin.moncure@rcsonline.com> To: "Ron" <rjpeace@earthlink.net> Cc: <pgsql-performance@postgresql.org>, "Franklin Haut" <franklin.haut@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/556 X-Sequence-Number: 15813 > At 08:35 AM 11/30/2005, Franklin Haut wrote: > >Hi > > > >i=B4m using PostgreSQL on windows 2000, the pg_dump take around 50 = minutes > >to do backup of 200Mb data ( with no compression, and 15Mb with > >compression), >=20 > Compression is reducing the data to 15/200=3D 3/40=3D 7.5% of original = size? >=20 > >but in windows XP does not pass of 40 seconds... :( >=20 > You mean that 40 secs in pg_dump under Win XP > crashes, and therefore you have a WinXP problem? >=20 > Or do you mean that pg_dump takes 40 secs to > complete under WinXP and 50 minutes under W2K and > therefore you have a W2K problem? I think he is saying the time to dump does not take more than 40 = seconds, but I'm not sure. =20 > In fact, either 15MB/40secs=3D 375KBps or > 200MB/40secs=3D 5MBps is _slow_, so there's a problem under either = platform! 5 mb/sec dump output from psql is not terrible or even bad, depending on = hardware. > >not pass of 3%. > Assuming Win XP completes the dump, the first thing to do is > *don't use W2K* XP is not a server platform. Next level up is 2003 server. Many = organizations still have 2k deployed. About half of my servers still = run it. Anyways, the 2k/xp issue does not explain why there is a = performance problem. > M$ has stopped supporting it in anything but absolutely minimum = fashion > anyway. > _If_ you are going to use an M$ OS you should be using WinXP. > (You want to pay licensing fees for your OS, but > you are using free DB SW? Huh? If you are > trying to save $$$, use Open Source SW like Linux > or *BSD. pg will perform better under it, and it's cheaper!) I would like to see some benchmarks supporting those claims. No comment = on licensing issue, but there are many other factors in considering = server platform than licensing costs. That said, there were several = win32 specific pg performance issues that were rolled up into the 8.1 = release. So for win32 you definitely want to be running 8.1. =20 > Assuming that for some reason you can't/won't > migrate to a non-M$ OS, the next problem is the > slow HD IO you are getting under WinXP. Problem is almost certainly not related to disk unless there is a = imminent disk failure. Could be TCP/IP issue (are you running pg_dump = from remote box?), or possibly a network driver issue or some other = weird software issue. Can you determine if disk is running normally = with respect to other applications? Is this a fresh win2k install? A = LSP, virus scanner, backup software, or some other garbage can really = ruin your day. Merlin From pgsql-performance-owner@postgresql.org Wed Nov 30 13:38:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 47E189DCAB1 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 13:38:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01957-05 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 13:38:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 7A3C69DCAD3 for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 13:38:12 -0400 (AST) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id BE84C43B8CB; Wed, 30 Nov 2005 17:27:23 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 068F7FF1A; Wed, 30 Nov 2005 17:27:35 +0000 (GMT) Message-ID: <438DE107.9000507@archonet.com> Date: Wed, 30 Nov 2005 17:27:35 +0000 From: Richard Huxton <dev@archonet.com> User-Agent: Thunderbird 1.5 (X11/20051025) MIME-Version: 1.0 To: Franklin Haut <franklin.haut@gmail.com> Cc: 'Ron' <rjpeace@earthlink.net>, pgsql-performance@postgresql.org Subject: Re: RES: pg_dump slow References: <000401c5f5ca$0aed7420$8500a8c0@FRANKLIN> In-Reply-To: <000401c5f5ca$0aed7420$8500a8c0@FRANKLIN> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/557 X-Sequence-Number: 15814 Franklin Haut wrote: > Hi, > > Yes, my problem is that the pg_dump takes 40 secs to complete under > WinXP and 50 minutes under W2K! The same database, the same hardware!, > only diferrent Operational Systems. > > The hardware is: > Pentium4 HT 3.2 GHz > 1024 Mb Memory > HD 120Gb SATA There have been reports of very slow network performance on Win2k systems with the default configuration. You'll have to check the archives for details I'm afraid. This might apply to you. If you're happy that doesn't affect you then I'd look at the disk system - perhaps XP has newer drivers than Win2k. What do the MS performance-charts show is happening? Specifically, CPU and disk I/O. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Nov 30 15:22:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9D1379DCD40 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 15:21:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09390-03 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 15:21:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 2E0E79DCD3C for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 15:21:10 -0400 (AST) Received: from dc1.storediq.com (66-194-80-196.gen.twtelecom.net [66.194.80.196]) by svr2.postgresql.org (Postfix) with ESMTP id 0611AF0B01 for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 19:19:50 +0000 (GMT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Select with grouping plan question X-MIMEOLE: Produced By Microsoft Exchange V6.0.6603.0 Date: Wed, 30 Nov 2005 13:21:07 -0600 Message-ID: <E387E2E9622FDD408359F98BF183879E222A6A@dc1.storediq.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Select with grouping plan question Thread-Index: AcX10FdK1onJ28n0QO2nK/b0p2adYQAEs69g From: "Brad Might" <bmight@storediq.com> To: <pgsql-performance@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/558 X-Sequence-Number: 15815 =20 This seems to me to be an expensive plan and I'm wondering if there's a way to improve it or a better way to do what I'm trying to do here (get a count of distinct values for each record_id and map that value to the entity type) entity_type_id_mapping is 56 rows volume_node_entity_data_values is approx 500,000,000 rows vq_record_id has approx 11,000,000 different values vq_entity_type is a value in entity_type_id_mapping.entity_type I thought that the idx_vq_entities_1 index would allow an ordered scan of the table. I created it based pon the sort key given in the explain statement.=20 Thanks in advance. Table "data_schema.volume_queue_entities" Column | Type | Modifiers -----------------+-------------------+---------------------------------- -----------------+-------------------+------------- vq_record_id | bigint | default currval('seq_vq_fsmd_auto'::regclass) vq_entity_type | character varying | vq_entity_value | character varying | Indexes: "idx_vq_entities_1" btree (vq_record_id, vq_entity_type, vq_entity_value) Table "volume_8.entity_type_id_mapping" Column | Type | Modifiers -------------+-------------------+-------------------------------------- -------------+-------------------+-------------------- entity_id | integer | default nextval('volume_8.entity_id_sequence'::regclass) entity_type | character varying |=20 explain insert into volume_8.volume_node_entity_data_values (vs_volume_id, vs_latest_node_synthetic_id, vs_base_entity_id, vs_value, vs_value_count, vs_base_entity_revision_id) select 8, vq_record_id, entity_id , vq_entity_value, count(vq_entity_value),1 from data_schema.volume_queue_entities qe, volume_8.entity_type_id_mapping emap where qe.vq_entity_type =3D emap.entity_type group by vq_record_id, vq_entity_type, vq_entity_value, entity_id ; ------------------------------------------------------------------------ ---------------------------------------- Subquery Scan "*SELECT*" (cost=3D184879640.90..210689876.26 rows=3D543373376 width=3D60) -> GroupAggregate (cost=3D184879640.90..199822408.74 = rows=3D543373376 width=3D37) -> Sort (cost=3D184879640.90..186238074.34 rows=3D543373376 width=3D37) Sort Key: qe.vq_record_id, qe.vq_entity_type, qe.vq_entity_value, emap.entity_id -> Hash Join (cost=3D1.70..18234833.10 rows=3D543373376 width=3D37) Hash Cond: (("outer".vq_entity_type)::text =3D ("inner".entity_type)::text) -> Seq Scan on volume_queue_entities qe (cost=3D0.00..10084230.76 rows=3D543373376 width=3D33) -> Hash (cost=3D1.56..1.56 rows=3D56 width=3D16) -> Seq Scan on entity_type_id_mapping emap (cost=3D0.00..1.56 rows=3D56 width=3D16) (9 rows) From pgsql-performance-owner@postgresql.org Wed Nov 30 16:41:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 901409DCD2A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 16:41:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13123-07 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 16:41:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E23839DCD40 for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 16:41:21 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jAUKfMte000816; Wed, 30 Nov 2005 15:41:22 -0500 (EST) To: "Brad Might" <bmight@storediq.com> cc: pgsql-performance@postgresql.org Subject: Re: Select with grouping plan question In-reply-to: <E387E2E9622FDD408359F98BF183879E222A6A@dc1.storediq.com> References: <E387E2E9622FDD408359F98BF183879E222A6A@dc1.storediq.com> Comments: In-reply-to "Brad Might" <bmight@storediq.com> message dated "Wed, 30 Nov 2005 13:21:07 -0600" Date: Wed, 30 Nov 2005 15:41:22 -0500 Message-ID: <815.1133383282@sss.pgh.pa.us> From: Tom Lane <tgl@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.004 required=5 tests=[AWL=0.004] X-Spam-Score: 0.004 X-Spam-Level: X-Archive-Number: 200511/560 X-Sequence-Number: 15817 "Brad Might" <bmight@storediq.com> writes: > This seems to me to be an expensive plan and I'm wondering if there's a > way to improve it or a better way to do what I'm trying to do here (get > a count of distinct values for each record_id and map that value to the > entity type) entity_type_id_mapping is 56 rows > volume_node_entity_data_values is approx 500,000,000 rows vq_record_id > has approx 11,000,000 different values vq_entity_type is a value in > entity_type_id_mapping.entity_type Hmm, what Postgres version is that? And have you ANALYZEd entity_type_id_mapping lately? I'd expect the planner to realize that there cannot be more than 56 output groups, which ought to lead it to prefer a hashed aggregate over the sort+group method. That's what I get in a test case with a similar query structure, anyway. If you're stuck on an old PG version, it might help to do the aggregation first and then join, ie select ... from (select count(vq_entity_value) as vcount, vq_entity_type from data_schema.volume_queue_entities group by vq_entity_type) qe, volume_8.entity_type_id_mapping emap where qe.vq_entity_type = emap.entity_type; regards, tom lane From pgsql-performance-owner@postgresql.org Wed Nov 30 17:05:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 130EB9DCD5A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 17:05:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14272-08-2 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 17:05:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpauth01.mail.atl.earthlink.net (smtpauth01.mail.atl.earthlink.net [209.86.89.61]) by postgresql.org (Postfix) with ESMTP id CE7229DCB0E for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 17:05:46 -0400 (AST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=X1dDyinABaAaFyjD1XIqd170C3eR7oxgkx8fLn6r2rX2uIOj44W2NMNsx71A3Vt8; h=Received:Message-Id:X-Mailer:Date:To:From:Subject:Cc:In-Reply-To:References:Mime-Version:Content-Type:X-ELNK-Trace:X-Originating-IP; Received: from [70.22.193.119] (helo=ron-6d52adff2a6.earthlink.net) by smtpauth01.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EhZ95-0000Z0-E2; Wed, 30 Nov 2005 16:05:43 -0500 Message-Id: <6.2.5.6.0.20051130152830.01d9e178@earthlink.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.5.6 Date: Wed, 30 Nov 2005 16:05:38 -0500 To: Richard Huxton <dev@archonet.com>, Franklin Haut <franklin.haut@gmail.com> From: Ron <rjpeace@earthlink.net> Subject: Re: RES: pg_dump slow Cc: pgsql-performance@postgresql.org In-Reply-To: <438DE107.9000507@archonet.com> References: <000401c5f5ca$0aed7420$8500a8c0@FRANKLIN> <438DE107.9000507@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-ELNK-Trace: acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bca8a481d806247b11d5ac4574241f7dda350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 70.22.193.119 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.359 required=5 tests=[AWL=-0.120, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.359 X-Spam-Level: X-Archive-Number: 200511/561 X-Sequence-Number: 15818 At 12:27 PM 11/30/2005, Richard Huxton wrote: >Franklin Haut wrote: >>Hi, >>Yes, my problem is that the pg_dump takes 40 secs to complete under >>WinXP and 50 minutes under W2K! The same database, the same hardware!, >>only diferrent Operational Systems. >>The hardware is: Pentium4 HT 3.2 GHz >> 1024 MB Memory Get the RAM up to at least 4096MB= 4GB for a DB server. 4 1GB DIMMs or 2 2GB DIMMS are ~ the same $$ as a HD (~$250-$300 US) and well worth the expense. >> HD 120GB SATA "b" is "bit". "B" is "Byte". I made the correction. You have =1= HD? and you are using it for everything: OS, pq, swap, etc? Very Bad Idea. At the very least, a DB server should have the OS on separate spindles from pg, and pg tables should be on something like a 4 HD RAID 10. At the very least. DB servers are about HDs. Lots and lots of HDs compared to anything outside the DB realm. Start thinking in terms of at least 6+ HD's attached to the system in question (I've worked on system with literally 100's). Usually only a few of these are directly attached to the DB server and most are attached by LAN or FC. But the point remains: DBs and DB servers eat HDs in prodigious quantities. >There have been reports of very slow network performance on Win2k >systems with the default configuration. You'll have to check the >archives for details I'm afraid. This might apply to you. Unless you are doing IO across a network, this issue will not apply to you. By default W2K systems often had a default TCP/IP packet size of 576B and a tiny RWIN. Optimal for analog modems talking over noisy POTS lines, but horrible for everything else Packet size needs to be boosted to 1500B, the maximum. RWIN should be boosted to _at least_ the largest number <= 2^16 that you can use without TCP scaling. Benchmark network IO rates. Then TCP scaling should be turned on and RWIN doubled and network IO benched again. Repeat until there is no performance benefit to doubling RWIN or you run out of RAM that you can afford to toss at the problem or you hit the max for RWIN (very doubtful). >If you're happy that doesn't affect you then I'd look at the disk >system - perhaps XP has newer drivers than Win2k. I'll reiterate: Do _not_ run a production DB server on W2K. M$ has obsoleted the platform and that it is not supported _nor_ any of reliable, secure, etc. etc. A W2K based DB server, particularly one with a connection to the Internet, is a ticking time bomb at this point. Get off W2K as a production platform ASAP. Take to your CEO/Dean/whatever you call your Fearless Leader if you have to. Economically and probably performance wise, it's best to use an Open Source OS like Linux or *BSD. However, if you must use M$, at least use OS's that M$ is actively supporting. Despite M$ marketing propaganda and a post in this thread to the contrary, you =CAN= often run a production DB server under WinXP and not pay M$ their usurious licensing fees for W2003 Server or any of their other products with "server" in the title. How much RAM and how many CPUs you want in your DB server is the main issue. For a 1P, <= 4GB RAM vanilla box, WinXp will work just fine. >What do the MS performance-charts show is happening? Specifically, >CPU and disk I/O. His original post said ~3% CPU under W2K and ~70% CPU under WinXP Ron From pgsql-performance-owner@postgresql.org Wed Nov 30 16:39:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6B51E9DCD2A for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 16:39:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13999-04 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 16:39:31 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by postgresql.org (Postfix) with ESMTP id 8BECC9DCB0E for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 16:39:27 -0400 (AST) Received: by wproxy.gmail.com with SMTP id 71so79247wra for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 12:39:28 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:importance:in-reply-to:x-mimeole; b=hZbVbnU5b9Ukop59iwqW1qF9UHnXR4THE+r48apHLv16nP4vVfcdEtFcbShKnVi2dk64xZxbVZY479VwXtNlHWfQWNdlptMXIFgMpaSv3zQ3lrr9widlkIzC+iUbKO29v/HXEulo6gdeKt8lr+fRxuZfCGjiJXcPqx2byjiBDa8= Received: by 10.54.110.5 with SMTP id i5mr778588wrc; Wed, 30 Nov 2005 12:39:20 -0800 (PST) Received: from FRANKLIN ( [200.180.51.99]) by mx.gmail.com with ESMTP id 24sm580732wrl.2005.11.30.12.39.18; Wed, 30 Nov 2005 12:39:19 -0800 (PST) From: "Franklin Haut" <franklin.haut@gmail.com> To: "'Merlin Moncure'" <merlin.moncure@rcsonline.com>, "'Ron'" <rjpeace@earthlink.net>, <pgsql-performance@postgresql.org> Subject: RES: pg_dump slow Date: Wed, 30 Nov 2005 18:36:42 -0300 Message-ID: <000001c5f5f6$29709090$8500a8c0@FRANKLIN> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 Importance: Normal In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD9BE@Herge.rcsinc.local> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/559 X-Sequence-Number: 15816 Complementing... The test was maked at the same machine ( localhost ) at Command-Prompt, no client=B4s connected, no concurrent processes only PostgreSQL = running. In windows XP, exists much access to the processor (+- 70%) and HD (I see HD Led allways on), while in the W2K almost without activity of processor (3%)and little access to the HardDisk (most time of the led HD is off). Look, the database has 81 Tables, one of these, has 2 fields ( one integer and another ByteA ), these table as 5.150 Records.=20 I=B4m Dumpped only this table and the file size is 7Mb (41% of total (17MB is the total)) was very slow.... Then I Maked Backup of the others tables was fast! So i=B4m conclused that pg_dump and pg_restore is very slow when manipulates ByteA type on W2K!, is this possible ? Franklin -----Mensagem original----- De: Merlin Moncure [mailto:merlin.moncure@rcsonline.com]=20 Enviada em: quarta-feira, 30 de novembro de 2005 13:57 Para: Ron Cc: pgsql-performance@postgresql.org; Franklin Haut Assunto: RE: [PERFORM] pg_dump slow > At 08:35 AM 11/30/2005, Franklin Haut wrote: > >Hi > > > >i=B4m using PostgreSQL on windows 2000, the pg_dump take around 50=20 > >minutes to do backup of 200Mb data ( with no compression, and 15Mb=20 > >with compression), >=20 > Compression is reducing the data to 15/200=3D 3/40=3D 7.5% of original = > size? >=20 > >but in windows XP does not pass of 40 seconds... :( >=20 > You mean that 40 secs in pg_dump under Win XP > crashes, and therefore you have a WinXP problem? >=20 > Or do you mean that pg_dump takes 40 secs to > complete under WinXP and 50 minutes under W2K and > therefore you have a W2K problem? I think he is saying the time to dump does not take more than 40 seconds, but I'm not sure. =20 > In fact, either 15MB/40secs=3D 375KBps or > 200MB/40secs=3D 5MBps is _slow_, so there's a problem under either=20 > platform! 5 mb/sec dump output from psql is not terrible or even bad, depending on hardware. > >not pass of 3%. > Assuming Win XP completes the dump, the first thing to do is *don't=20 > use W2K* XP is not a server platform. Next level up is 2003 server. Many organizations still have 2k deployed. About half of my servers still run it. Anyways, the 2k/xp issue does not explain why there is a performance problem. > M$ has stopped supporting it in anything but absolutely minimum=20 > fashion anyway. > _If_ you are going to use an M$ OS you should be using WinXP. (You > want to pay licensing fees for your OS, but you are using free DB SW? > Huh? If you are trying to save $$$, use Open Source SW like Linux > or *BSD. pg will perform better under it, and it's cheaper!) I would like to see some benchmarks supporting those claims. No comment on licensing issue, but there are many other factors in considering server platform than licensing costs. That said, there were several win32 specific pg performance issues that were rolled up into the 8.1 release. So for win32 you definitely want to be running 8.1. =20 > Assuming that for some reason you can't/won't > migrate to a non-M$ OS, the next problem is the > slow HD IO you are getting under WinXP. Problem is almost certainly not related to disk unless there is a imminent disk failure. Could be TCP/IP issue (are you running pg_dump from remote box?), or possibly a network driver issue or some other weird software issue. Can you determine if disk is running normally with respect to other applications? Is this a fresh win2k install? A LSP, virus scanner, backup software, or some other garbage can really ruin your day. Merlin From pgsql-performance-owner@postgresql.org Wed Nov 30 18:13:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 224179DCB0D for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 18:13:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17686-10 for <pgsql-performance-postgresql.org@localhost.postgresql.org>; Wed, 30 Nov 2005 18:13:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from Herge.rcsinc.local (mail.rcsonline.com [70.89.208.142]) by postgresql.org (Postfix) with ESMTP id 4336F9DCAB5 for <pgsql-performance@postgresql.org>; Wed, 30 Nov 2005 18:13:07 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: RES: pg_dump slow Date: Wed, 30 Nov 2005 17:13:08 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3417DD9CC@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: RES: [PERFORM] pg_dump slow Thread-Index: AcX18fRf1JsLmgu6Q3CN2R7scBGU/AABkDrA From: "Merlin Moncure" <merlin.moncure@rcsonline.com> To: "Ron" <rjpeace@earthlink.net> Cc: <pgsql-performance@postgresql.org>, "Franklin Haut" <franklin.haut@gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/562 X-Sequence-Number: 15819 > By default W2K systems often had a default TCP/IP packet size of 576B > and a tiny RWIN. Optimal for analog modems talking over noisy POTS > lines, but horrible for everything else wrong. default MTU for windows 2000 server is 1500, as was NT4. http://support.microsoft.com/?id=3D140375 However tweaking rwin is certainly something to look at. > >If you're happy that doesn't affect you then I'd look at the disk > >system - perhaps XP has newer drivers than Win2k. > I'll reiterate: Do _not_ run a production DB server on W2K. M$ has > obsoleted the platform and that it is not supported _nor_ any of > reliable, secure, etc. etc. wrong again. WIN2k gets free security hotfixes and paid support until 2010. http://www.microsoft.com/windows2000/support/lifecycle/ =20 > A W2K based DB server, particularly one with a connection to the > Internet, is a ticking time bomb at this point. > Get off W2K as a production platform ASAP. Take to your > CEO/Dean/whatever you call your Fearless Leader if you have to. wrong again!! There is every reason to believe win2k is *more* secure than win2003 sever because it is a more stable platform. This of course depends on what other services are running, firewall issues, etc etc. >> Economically and probably performance wise, it's best to use an Open > Source OS like Linux or *BSD. However, if you must use M$, at least > use OS's that M$ is actively supporting. I encourage use of open source software. However encouraging other people to spontaneously switch hardware/software platforms (especially when they just stated when win2k is a requirement) is just or at least not helpful. =20 > Despite M$ marketing propaganda and a post in this thread to the > contrary, you =3DCAN=3D often run a production DB server under WinXP = and > not pay M$ their usurious licensing fees for W2003 Server or any of > their other products with "server" in the title. How much RAM and you are on a roll here. You must not be aware of 10 connection limit for win2k pro and winxp pro. http://winhlp.com/WxConnectionLimit.htm There are hackerish ways of getting around this which are illegal. Cheating to get around this by pooling connections via tcp proxy for example is also against EULA (and, in my opinion, unethical). > how many CPUs you want in your DB server is the main issue. For a > 1P, <=3D 4GB RAM vanilla box, WinXp will work just fine. Now, who is guilty of propaganda here? Also, your comments regarding hard disks while correct in the general sense are not helpful. This is clearly not a disk bandwidth problem. > >What do the MS performance-charts show is happening? Specifically, > >CPU and disk I/O. > His original post said ~3% CPU under W2K and ~70% CPU under WinXP Slow performance in extraction of bytea column strongly suggests tcp/ip. issue. I bet if you blanked out bytea column pg_dump will be fast.=20 Franlin: are you making pg_dump from local or remote box and is this a clean install? Try fresh patched win2k install and see what happens. Merlin