From pgsql-performance-owner@postgresql.org Fri Apr 30 22:21:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9739CD1EA2A for ; Fri, 30 Apr 2004 22:21:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 20110-09 for ; Fri, 30 Apr 2004 22:20:59 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AFA21D1E809 for ; Fri, 30 Apr 2004 22:20:55 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i411JdhO008882; Fri, 30 Apr 2004 21:19:39 -0400 (EDT) To: Manfred Koizar Cc: Jochem van Dieten , pgsql-performance@postgresql.org Subject: Re: planner/optimizer question In-reply-to: References: <409290F0.10509@oli.tudelft.nl> Comments: In-reply-to Manfred Koizar message dated "Fri, 30 Apr 2004 23:36:58 +0200" Date: Fri, 30 Apr 2004 21:19:39 -0400 Message-ID: <8881.1083374379@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/531 X-Sequence-Number: 6831 Manfred Koizar writes: > Yes, the visible-to-all flag would be set as a by-product of an index > scan, if the heap tuple is found to be visible to all active > transactions. This update is non-critical Oh really? I think you need to think harder about the transition conditions. Dead-to-all is reasonably safe to treat as a hint bit because *it does not ever need to be undone*. Visible-to-all does not have that property. regards, tom lane From pgsql-performance-owner@postgresql.org Sat May 1 00:05:00 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C4FCED1D903 for ; Sat, 1 May 2004 00:04:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 45543-03 for ; Sat, 1 May 2004 00:04:38 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D88E7D1DB23 for ; Sat, 1 May 2004 00:04:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4134bQZ009782; Fri, 30 Apr 2004 23:04:37 -0400 (EDT) To: Joseph Shraibman Cc: pgsql-performance@postgresql.org Subject: Re: Insert only tables and vacuum performance In-reply-to: <4091EAD8.4020503@selectacast.net> References: <20619.1083299426@sss.pgh.pa.us> <4091EAD8.4020503@selectacast.net> Comments: In-reply-to Joseph Shraibman message dated "Fri, 30 Apr 2004 01:57:44 -0400" Date: Fri, 30 Apr 2004 23:04:36 -0400 Message-ID: <9781.1083380676@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/1 X-Sequence-Number: 6832 Joseph Shraibman writes: > INFO: "elog": found 0 removable, 12869411 nonremovable row versions in > 196195 pages > DETAIL: 0 dead row versions cannot be removed yet. > There were 5 unused item pointers. > 0 pages are entirely empty. > CPU 31.61s/4.53u sec elapsed 1096.83 sec. Hmm. These numbers suggest that your disk subsystem's bandwidth is only about 1.4 Mbytes/sec. Was there a lot else going on? regards, tom lane From pgsql-performance-owner@postgresql.org Sat May 1 01:04:22 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3FF56D1E742 for ; Sat, 1 May 2004 01:04:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55393-07 for ; Sat, 1 May 2004 01:03:56 -0300 (ADT) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id 6FD0ED1E9A7 for ; Sat, 1 May 2004 01:03:55 -0300 (ADT) Received: (qmail 1693 invoked by uid 104); 1 May 2004 04:03:54 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.65. spamassassin: 2.55. Clear:SA:0(-7.8/6.0):. Processed in 33.509929 secs); 01 May 2004 04:03:54 -0000 Received: from unknown (HELO thunder.mshome.net) (216.58.165.126) by srvr3.iniquinet.com with SMTP; 1 May 2004 04:03:20 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with ESMTP id 964A6BEB22; Fri, 30 Apr 2004 22:03:19 -0600 (MDT) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with SMTP id AF252A7127; Fri, 30 Apr 2004 22:03:14 -0600 (MDT) Date: Fri, 30 Apr 2004 22:03:06 -0600 From: Robert Creager To: josh@agliodbs.com Cc: pg@fastcrypt.com, =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , Bruce Momjian , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon Message-Id: <20040430220306.15d95162@thunder.mshome.net> In-Reply-To: <200404291121.51247.josh@agliodbs.com> References: <200404211029.43675.josh@agliodbs.com> <20040428185753.56614b2c@thunder.mshome.net> <200404291121.51247.josh@agliodbs.com> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.9claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Fri__30_Apr_2004_22_03_06_-0600_RXm1RM=b.Jr9ZgXN" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/2 X-Sequence-Number: 6833 --Signature=_Fri__30_Apr_2004_22_03_06_-0600_RXm1RM=b.Jr9ZgXN Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit When grilled further on (Thu, 29 Apr 2004 11:21:51 -0700), Josh Berkus confessed: > spins_per_delay was not beneficial. Instead, try increasing them, one step > at a time: > > (take baseline measurement at 100) > 250 > 500 > 1000 > 1500 > 2000 > 3000 > 5000 > > ... until you find an optimal level. Then report the results to us! > Some results. The patch mentioned is what Dave Cramer posted to the Performance list on 4/21. A Perl script monitored for 120 seconds and generated max and average values. Unfortunately, I am not present on site, so I cannot physically change the device under test to increase the db load to where it hit about 10 days ago. That will have to wait till the 'real' work week on Monday. Context switches - avg max Default 7.4.1 code : 10665 69470 Default patch - 10 : 17297 21929 patch at 100 : 26825 87073 patch at 1000 : 37580 110849 Now granted, the db isn't showing the CS swap problem in a bad way (at all), but should the numbers be trending the way they are with the patched code? Or will these numbers potentially change dramatically when I can load up the db? And, presuming I can re-produce what I was seeing previously (200K CS/s), you folks want me to carry on with more testing of the patch and report the results? Or just go away and be quiet... The information is provided from a HP Proliant DL380 G3 with 2x 2.4 GHZ Xenon's (with HT enabled) 2 GB ram, running 2.4.22-26mdkenterprise kernel, RAID controller w/128 Mb battery backed cache RAID 1 on 2x 15K RPM drives for WAL drive, RAID 0+1 on 4x 10K RPM drives for data. The only job this box has is running this db. Cheers, Rob -- 21:54:48 up 2 days, 4:39, 4 users, load average: 2.00, 2.03, 2.00 Linux 2.6.5-01 #7 SMP Fri Apr 16 22:45:31 MDT 2004 --Signature=_Fri__30_Apr_2004_22_03_06_-0600_RXm1RM=b.Jr9ZgXN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iEYEARECAAYFAkCTIYIACgkQLQ/DKuwDYznV/QCeL44IR73RUWzel6O2AhwB7x7j fmgAnixe2lVZA9kajkXAKeTdaqzm5NtF =jjsJ -----END PGP SIGNATURE----- --Signature=_Fri__30_Apr_2004_22_03_06_-0600_RXm1RM=b.Jr9ZgXN-- From pgsql-performance-owner@postgresql.org Sat May 1 08:18:25 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E7EB7D1D35F for ; Sat, 1 May 2004 08:18:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 61763-06 for ; Sat, 1 May 2004 08:18:05 -0300 (ADT) Received: from mailhost2.tudelft.nl (mailhost2.tudelft.nl [130.161.180.2]) by svr1.postgresql.org (Postfix) with ESMTP id 688BBD1DB23 for ; Sat, 1 May 2004 08:18:02 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by rav.antivirus (Postfix) with ESMTP id 184CC186DC; Sat, 1 May 2004 13:18:05 +0200 (MEST) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (Postfix) with ESMTP id EA9C1186CD; Sat, 1 May 2004 13:18:04 +0200 (MEST) Received: from oli.tudelft.nl (jochemd.tnw-s.tudelft.nl [145.94.90.156]) by listserv.tudelft.nl (8.12.10/8.12.8) with ESMTP id i41BI4F7007684; Sat, 1 May 2004 13:18:04 +0200 (MEST) Message-ID: <4093876C.2060409@oli.tudelft.nl> Date: Sat, 01 May 2004 13:18:04 +0200 From: Jochem van Dieten Organization: OnLine Internet User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Manfred Koizar , pgsql-performance@postgresql.org Subject: Re: planner/optimizer question References: <409290F0.10509@oli.tudelft.nl> <8881.1083374379@sss.pgh.pa.us> In-Reply-To: <8881.1083374379@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at tudelft.nl X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/3 X-Sequence-Number: 6834 Tom Lane wrote: > Manfred Koizar writes: >> >> Yes, the visible-to-all flag would be set as a by-product of an index >> scan, if the heap tuple is found to be visible to all active >> transactions. This update is non-critical > > Oh really? I think you need to think harder about the transition > conditions. > > Dead-to-all is reasonably safe to treat as a hint bit because *it does > not ever need to be undone*. Visible-to-all does not have that > property. Yes, really :-) When a tuple is inserted the visible-to-all flag is set to false. The effect of this is that every index scan that finds this tuple has to visit the heap to verify visibility. If it turns out the tuple is not only visible to the current transaction, but to all current transactions, the visible-to-all flag can be set to true. This is non-critical, because if it is set to false scans will not miss the tuple, they will just visit the heap to verify visibility. The moment the heap tuple is updated/deleted the visible-to-all flag needs to be set to false again in all indexes. This is critical, and the I/O and (dead)lock costs of unsetting the visible-to-all flag are unknown and might be big enough to ofset any advantage on the selects. But I believe that for applications with a "load, select, drop" usage pattern (warehouses, archives etc.) having this visible-to-all flag would be a clear winner. Jochem -- I don't get it immigrants don't work and steal our jobs - Loesje From pgsql-performance-owner@postgresql.org Sat May 1 09:48:49 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 97D6BD1CCDA for ; Sat, 1 May 2004 09:48:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79966-06 for ; Sat, 1 May 2004 09:48:30 -0300 (ADT) Received: from gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id B7944D1EAEE for ; Sat, 1 May 2004 09:48:25 -0300 (ADT) Received: from gary (unverified [192.168.1.2]) by gpdnet.co.uk (SurgeMail 1.8g3) with ESMTP id 143 for ; Sat, 01 May 2004 13:47:41 +0100 From: "Gary Doades" To: pgsql-performance@postgresql.org Date: Sat, 01 May 2004 13:48:35 +0100 MIME-Version: 1.0 Subject: Re: planner/optimizer question Message-ID: <4093AAB3.21370.742972@localhost> In-reply-to: <4093876C.2060409@oli.tudelft.nl> References: <8881.1083374379@sss.pgh.pa.us> X-mailer: Pegasus Mail for Windows (v4.12a) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Server: High Performance Mail Server - http://surgemail.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/4 X-Sequence-Number: 6835 On 1 May 2004 at 13:18, Jochem van Dieten wrote: > Yes, really :-) > > When a tuple is inserted the visible-to-all flag is set to false. > The effect of this is that every index scan that finds this tuple > has to visit the heap to verify visibility. If it turns out the > tuple is not only visible to the current transaction, but to all > current transactions, the visible-to-all flag can be set to true. > This is non-critical, because if it is set to false scans will > not miss the tuple, they will just visit the heap to verify > visibility. > > The moment the heap tuple is updated/deleted the visible-to-all > flag needs to be set to false again in all indexes. This is > critical, and the I/O and (dead)lock costs of unsetting the > visible-to-all flag are unknown and might be big enough to ofset > any advantage on the selects. > > But I believe that for applications with a "load, select, drop" > usage pattern (warehouses, archives etc.) having this > visible-to-all flag would be a clear winner. > > Jochem > If needs be this index maintenance could be set as a configuration option. It is likely that database usage patterns are reasonably well known for a particular installation. This option could be set on or off dependant on typical transactions. In my case with frequent large/complex selects and few very short insert/updates I think it could be a big performance boost. If it works :-) Regards, Gary. From pgsql-performance-owner@postgresql.org Sat May 1 13:23:08 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BB76DD1EB24 for ; Sat, 1 May 2004 13:23:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 27122-10 for ; Sat, 1 May 2004 13:22:46 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4B3B8D1EAC6 for ; Sat, 1 May 2004 13:22:45 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i41GLS6g014615; Sat, 1 May 2004 12:21:28 -0400 (EDT) To: Jochem van Dieten Cc: Manfred Koizar , pgsql-performance@postgresql.org Subject: Re: planner/optimizer question In-reply-to: <4093876C.2060409@oli.tudelft.nl> References: <409290F0.10509@oli.tudelft.nl> <8881.1083374379@sss.pgh.pa.us> <4093876C.2060409@oli.tudelft.nl> Comments: In-reply-to Jochem van Dieten message dated "Sat, 01 May 2004 13:18:04 +0200" Date: Sat, 01 May 2004 12:21:28 -0400 Message-ID: <14614.1083428488@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/5 X-Sequence-Number: 6836 Jochem van Dieten writes: > The moment the heap tuple is updated/deleted the visible-to-all > flag needs to be set to false again in all indexes. This is > critical, Exactly. This gets you out of the hint-bit semantics and into a ton of interesting problems, such as race conditions. (Process A determines that tuple X is visible-to-all, and goes to update the index tuple. Before it can reacquire lock on the index page, process B updates the heap tuple and visits the index to clear the flag bit. Once A obtains lock it will set the flag bit. Oops.) Basically what you are buying into with such a thing is multiple copies of critical state. It may be only one bit rather than several words, but updating it is no less painful than if it were a full copy of the tuple's commit status. regards, tom lane From pgsql-performance-owner@postgresql.org Sat May 1 15:51:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E7653D1EB4C for ; Sat, 1 May 2004 15:51:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 57849-10 for ; Sat, 1 May 2004 15:50:59 -0300 (ADT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 6C268D1B432 for ; Sat, 1 May 2004 15:50:57 -0300 (ADT) Received: (qmail 3372 invoked from network); 1 May 2004 18:50:49 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 1 May 2004 18:50:49 -0000 Subject: Re: Wierd context-switching issue on Xeon From: Dave Cramer Reply-To: pg@fastcrypt.com To: Robert Creager Cc: Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , Bruce Momjian , pgsql-performance@postgresql.org, Neil Conway In-Reply-To: <20040430220306.15d95162@thunder.mshome.net> References: <200404211029.43675.josh@agliodbs.com> <20040428185753.56614b2c@thunder.mshome.net> <200404291121.51247.josh@agliodbs.com> <20040430220306.15d95162@thunder.mshome.net> Content-Type: text/plain Organization: Cramer Consulting Message-Id: <1083437446.25697.109.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sat, 01 May 2004 14:50:47 -0400 Content-Transfer-Encoding: 7bit X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/6 X-Sequence-Number: 6837 No, don't go away and be quiet. Keep testing, it may be that under normal operation the context switching goes up but under the conditions that you were seeing the high CS it may not be as bad. As others have mentioned the real solution to this is to rewrite the buffer management so that the lock isn't quite as coarse grained. Dave On Sat, 2004-05-01 at 00:03, Robert Creager wrote: > When grilled further on (Thu, 29 Apr 2004 11:21:51 -0700), > Josh Berkus confessed: > > > spins_per_delay was not beneficial. Instead, try increasing them, one step > > at a time: > > > > (take baseline measurement at 100) > > 250 > > 500 > > 1000 > > 1500 > > 2000 > > 3000 > > 5000 > > > > ... until you find an optimal level. Then report the results to us! > > > > Some results. The patch mentioned is what Dave Cramer posted to the Performance > list on 4/21. > > A Perl script monitored for 120 seconds and generated max and average > values. Unfortunately, I am not present on site, so I cannot physically change > the device under test to increase the db load to where it hit about 10 days ago. > That will have to wait till the 'real' work week on Monday. > > Context switches - avg max > > Default 7.4.1 code : 10665 69470 > Default patch - 10 : 17297 21929 > patch at 100 : 26825 87073 > patch at 1000 : 37580 110849 > > Now granted, the db isn't showing the CS swap problem in a bad way (at all), but > should the numbers be trending the way they are with the patched code? Or will > these numbers potentially change dramatically when I can load up the db? > > And, presuming I can re-produce what I was seeing previously (200K CS/s), you > folks want me to carry on with more testing of the patch and report the results? > Or just go away and be quiet... > > The information is provided from a HP Proliant DL380 G3 with 2x 2.4 GHZ Xenon's > (with HT enabled) 2 GB ram, running 2.4.22-26mdkenterprise kernel, RAID > controller w/128 Mb battery backed cache RAID 1 on 2x 15K RPM drives for WAL > drive, RAID 0+1 on 4x 10K RPM drives for data. The only job this box has is > running this db. > > Cheers, > Rob -- Dave Cramer 519 939 0336 ICQ # 14675561 From pgsql-performance-owner@postgresql.org Sun May 2 05:01:20 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3DD82D1ED94 for ; Sun, 2 May 2004 05:01:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 26054-09 for ; Sun, 2 May 2004 05:01:00 -0300 (ADT) Received: from email06.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.75]) by svr1.postgresql.org (Postfix) with SMTP id C010ED1ED84 for ; Sun, 2 May 2004 05:00:57 -0300 (ADT) Received: (qmail 450502 invoked from network); 2 May 2004 08:00:57 -0000 Received: from m167p018.dipool.highway.telekom.at (HELO PASCAL) ([62.46.10.210]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 2 May 2004 08:00:57 -0000 From: Manfred Koizar To: Jochem van Dieten Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: planner/optimizer question Date: Sun, 02 May 2004 10:03:36 +0200 Message-ID: References: <409290F0.10509@oli.tudelft.nl> <8881.1083374379@sss.pgh.pa.us> <4093876C.2060409@oli.tudelft.nl> In-Reply-To: <4093876C.2060409@oli.tudelft.nl> X-Mailer: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/7 X-Sequence-Number: 6838 On Sat, 01 May 2004 13:18:04 +0200, Jochem van Dieten wrote: >Tom Lane wrote: >> Oh really? I think you need to think harder about the transition >> conditions. Indeed. >> >> Dead-to-all is reasonably safe to treat as a hint bit because *it does >> not ever need to be undone*. Visible-to-all does not have that >> property. > >Yes, really :-) No, not really :-( As Tom has explained in a nearby message his concern is that -- unlike dead-to-all -- visible-to-all starts as false, is set to true at some point in time, and is eventually set to false again. Problems arise if one backend wants to set visible-to-all to true while at the same time another backend wants to set it to false. This could be curable by using a second bit as a deleted flag (might be even the same bit that's now used as dead-to-all, but I'm not sure). An index tuple having both the visible flag (formerly called visible-to-all) and the deleted flag set would cause a heap tuple access to check visibility. But that leaves the question of what to do after the deleting transaction has rolled back. I see no clean way from the visible-and-deleted state to visible-to-all. This obviously needs another round of hard thinking ... From pgsql-performance-owner@postgresql.org Sun May 2 05:10:26 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DB308D1B432 for ; Sun, 2 May 2004 05:10:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38484-04 for ; Sun, 2 May 2004 05:10:03 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id 12BCFD1C4C4 for ; Sun, 2 May 2004 05:10:01 -0300 (ADT) Received: (qmail 20259 invoked from network); 2 May 2004 08:31:20 -0000 Received: from unknown (HELO jamesthornton.com) (james@69.150.60.163) by 0 with SMTP; 2 May 2004 08:31:20 -0000 Message-ID: <4094AD20.6090707@jamesthornton.com> Date: Sun, 02 May 2004 03:11:12 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Recommended File System Configuration Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/8 X-Sequence-Number: 6839 Back in 2001, there was a lengthy thread on the PG Hackers list about PG and journaling file systems (http://archives.postgresql.org/pgsql-hackers/2001-05/msg00017.php), but there was no decisive conclusion regarding what FS to use. At the time the fly in the XFS ointment was that deletes were slow, but this was improved with XFS 1.1. I think a journaling a FS is needed for PG data since large DBs could take hours to recover on a non-journaling FS, but what about WAL files? -- James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-performance-owner@postgresql.org Sun May 2 11:31:05 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8497AD1E9CA for ; Sun, 2 May 2004 11:31:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 16942-09 for ; Sun, 2 May 2004 11:30:47 -0300 (ADT) Received: from mailhost2.tudelft.nl (mailhost2.tudelft.nl [130.161.180.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4DF17D1EDE3 for ; Sun, 2 May 2004 11:30:43 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by rav.antivirus (Postfix) with ESMTP id 827C430C84; Sun, 2 May 2004 16:30:47 +0200 (MEST) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (Postfix) with ESMTP id 5819530C7E; Sun, 2 May 2004 16:30:47 +0200 (MEST) Received: from oli.tudelft.nl (www@secure.oli.tudelft.nl [130.161.180.141]) by listserv.tudelft.nl (8.12.10/8.12.8) with SMTP id i42EUkF7016249; Sun, 2 May 2004 16:30:47 +0200 (MEST) Received: from 130.161.199.221 (SquirrelMail authenticated user jochemd@oli.tudelft.nl) by secure.oli.tudelft.nl with HTTP; Sun, 2 May 2004 16:30:47 +0200 (CEST) Message-ID: <1529.130.161.199.221.1083508247.squirrel@secure.oli.tudelft.nl> Date: Sun, 2 May 2004 16:30:47 +0200 (CEST) Subject: Re: planner/optimizer question From: "Jochem van Dieten" To: In-Reply-To: References: <409290F0.10509@oli.tudelft.nl> <8881.1083374379@sss.pgh.pa.us> <4093876C.2060409@oli.tudelft.nl> X-Priority: 3 Importance: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.10) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at tudelft.nl X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/9 X-Sequence-Number: 6840 Manfred Koizar said: > > As Tom has explained in a nearby message his concern is that -- > unlike dead-to-all -- visible-to-all starts as false, is set to true > at some point in time, and is eventually set to false again. > Problems arise if one backend wants to set visible-to-all to true > while at the same time another backend wants to set it to false. Got it, I misinterpreted his concern as "visible-to-all should not be set to true when the tuple is inserted". > This could be curable by using a second bit as a deleted flag (might > be even the same bit that's now used as dead-to-all, but I'm not > sure). An index tuple having both the visible flag (formerly called > visible-to-all) and the deleted flag set would cause a heap tuple > access to check visibility. Or in a more generalized way: with 2 bits written at the same time you can express 4 states. But only 3 actions need to be signalled: dead-to-all, visible-to-all and check-heap. So we can have 2 states that both signal check-heap. The immediate solution to the race condition Tom presented would be to have the transaction that invalidates the heap tuple switch the index tuple from the one check-heap state to the other. The transaction that wants to update to visible-to-all can now see that the state has changed (but not the meaning) and aborts its change. > But that leaves the question of what to > do after the deleting transaction has rolled back. I see no clean > way from the visible-and-deleted state to visible-to-all. I'm afraid I don't know enough about the inner workings of rollbacks to determine how the scenario "A determines visible-to-all should be set, B invalidates tuple, B rolls back, C invalidates tuple, C commits, A reaquires lock on index" would work out. I guess I have some more reading to do. But if you don't roll back too often it wouldn't even be a huge problem to just leave them in visible-and-deleted state until eventually they go into the dead-to-all state. Jochem From pgsql-performance-owner@postgresql.org Sun May 2 12:21:55 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 54AA3D1B432 for ; Sun, 2 May 2004 12:21:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 30354-03 for ; Sun, 2 May 2004 12:21:33 -0300 (ADT) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id E0B1FD1ED68 for ; Sun, 2 May 2004 12:21:32 -0300 (ADT) Received: (qmail 28735 invoked by uid 104); 2 May 2004 15:21:31 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.65. spamassassin: 2.55. Clear:SA:0(-7.6/6.0):. Processed in 33.706185 secs); 02 May 2004 15:21:31 -0000 Received: from unknown (HELO thunder.mshome.net) (216.58.165.126) by srvr3.iniquinet.com with SMTP; 2 May 2004 15:20:57 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with ESMTP id EA9D3116911; Sun, 2 May 2004 09:20:56 -0600 (MDT) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with SMTP id 3CDB3116911; Sun, 2 May 2004 09:20:54 -0600 (MDT) Date: Sun, 2 May 2004 09:20:47 -0600 From: Robert Creager To: pg@fastcrypt.com Cc: Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , Bruce Momjian , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon Message-Id: <20040502092047.029525f6@thunder.mshome.net> In-Reply-To: <1083437446.25697.109.camel@localhost.localdomain> References: <200404211029.43675.josh@agliodbs.com> <20040428185753.56614b2c@thunder.mshome.net> <200404291121.51247.josh@agliodbs.com> <20040430220306.15d95162@thunder.mshome.net> <1083437446.25697.109.camel@localhost.localdomain> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Sun__2_May_2004_09_20_47_-0600_X.5Ymos/ukZSWEQz" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/10 X-Sequence-Number: 6841 --Signature=_Sun__2_May_2004_09_20_47_-0600_X.5Ymos/ukZSWEQz Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit Found some co-workers at work yesterday to load up my library... The sample period is 5 minutes long (vs 2 minutes previously): Context switches - avg max Default 7.4.1 code : 48784 107354 Default patch - 10 : 20400 28160 patch at 100 : 38574 85372 patch at 1000 : 41188 106569 The reading at 1000 was not produced under the same circumstances as the prior readings as I had to replace my device under test with a simulated one. The real one died. The previous run with smaller database and 120 second averages: Context switches - avg max Default 7.4.1 code : 10665 69470 Default patch - 10 : 17297 21929 patch at 100 : 26825 87073 patch at 1000 : 37580 110849 -- 20:13:50 up 3 days, 2:58, 4 users, load average: 2.12, 2.14, 2.10 Linux 2.6.5-01 #7 SMP Fri Apr 16 22:45:31 MDT 2004 --Signature=_Sun__2_May_2004_09_20_47_-0600_X.5Ymos/ukZSWEQz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iEYEARECAAYFAkCVEdYACgkQLQ/DKuwDYzk2rQCeNztby++bxLqjgCCSTb+iar2T i6gAn1T/hPOp4vOQ/GssEjHYTOZMYjQu =qu7E -----END PGP SIGNATURE----- --Signature=_Sun__2_May_2004_09_20_47_-0600_X.5Ymos/ukZSWEQz-- From pgsql-performance-owner@postgresql.org Sun May 2 12:39:55 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9E80CD1B432 for ; Sun, 2 May 2004 12:39:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 34519-06 for ; Sun, 2 May 2004 12:39:34 -0300 (ADT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id C1553D1E123 for ; Sun, 2 May 2004 12:39:33 -0300 (ADT) Received: (qmail 31037 invoked from network); 2 May 2004 15:39:24 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 2 May 2004 15:39:24 -0000 Subject: Re: Wierd context-switching issue on Xeon From: Dave Cramer Reply-To: pg@fastcrypt.com To: Robert Creager Cc: Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , Bruce Momjian , pgsql-performance@postgresql.org, Neil Conway In-Reply-To: <20040502092047.029525f6@thunder.mshome.net> References: <200404211029.43675.josh@agliodbs.com> <20040428185753.56614b2c@thunder.mshome.net> <200404291121.51247.josh@agliodbs.com> <20040430220306.15d95162@thunder.mshome.net> <1083437446.25697.109.camel@localhost.localdomain> <20040502092047.029525f6@thunder.mshome.net> Content-Type: text/plain Organization: Cramer Consulting Message-Id: <1083512362.25096.131.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 02 May 2004 11:39:22 -0400 Content-Transfer-Encoding: 7bit X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/11 X-Sequence-Number: 6842 Robert, The real question is does it help under real life circumstances ? Did you do the tests with Tom's sql code that is designed to create high context switchs ? Dave On Sun, 2004-05-02 at 11:20, Robert Creager wrote: > Found some co-workers at work yesterday to load up my library... > > The sample period is 5 minutes long (vs 2 minutes previously): > > Context switches - avg max > > Default 7.4.1 code : 48784 107354 > Default patch - 10 : 20400 28160 > patch at 100 : 38574 85372 > patch at 1000 : 41188 106569 > > The reading at 1000 was not produced under the same circumstances as the prior > readings as I had to replace my device under test with a simulated one. The > real one died. > > The previous run with smaller database and 120 second averages: > > Context switches - avg max > > Default 7.4.1 code : 10665 69470 > Default patch - 10 : 17297 21929 > patch at 100 : 26825 87073 > patch at 1000 : 37580 110849 -- Dave Cramer 519 939 0336 ICQ # 14675561 From pgsql-performance-owner@postgresql.org Sun May 2 18:47:49 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 33AF0D1EE01 for ; Sun, 2 May 2004 18:47:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17226-09 for ; Sun, 2 May 2004 18:47:28 -0300 (ADT) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id 3C6DFD1EDF9 for ; Sun, 2 May 2004 18:47:25 -0300 (ADT) Received: (qmail 24698 invoked by uid 104); 2 May 2004 21:47:26 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.65. spamassassin: 2.55. Clear:SA:0(-7.8/6.0):. Processed in 33.66656 secs); 02 May 2004 21:47:26 -0000 Received: from unknown (HELO thunder.mshome.net) (216.58.165.126) by srvr3.iniquinet.com with SMTP; 2 May 2004 21:46:52 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with ESMTP id 5769FB90A0; Sun, 2 May 2004 15:46:52 -0600 (MDT) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with SMTP id A52F8B90A0; Sun, 2 May 2004 15:46:50 -0600 (MDT) Date: Sun, 2 May 2004 15:46:49 -0600 From: Robert Creager To: pg@fastcrypt.com Cc: Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , Bruce Momjian , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon Message-Id: <20040502154649.3cb2f283@thunder.mshome.net> In-Reply-To: <1083512362.25096.131.camel@localhost.localdomain> References: <200404211029.43675.josh@agliodbs.com> <20040428185753.56614b2c@thunder.mshome.net> <200404291121.51247.josh@agliodbs.com> <20040430220306.15d95162@thunder.mshome.net> <1083437446.25697.109.camel@localhost.localdomain> <20040502092047.029525f6@thunder.mshome.net> <1083512362.25096.131.camel@localhost.localdomain> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Sun__2_May_2004_15_46_49_-0600_39iKNqpvwjELTqoo" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/12 X-Sequence-Number: 6843 --Signature=_Sun__2_May_2004_15_46_49_-0600_39iKNqpvwjELTqoo Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit When grilled further on (Sun, 02 May 2004 11:39:22 -0400), Dave Cramer confessed: > Robert, > > The real question is does it help under real life circumstances ? I'm not yet at the point where the CS's are causing appreciable delays. I should get there early this week and will be able to measure the relief your patch may provide. > > Did you do the tests with Tom's sql code that is designed to create high > context switchs ? No, I'm using my queries/data. Cheers, Rob -- 10:44:58 up 3 days, 17:30, 4 users, load average: 2.00, 2.04, 2.01 Linux 2.6.5-01 #7 SMP Fri Apr 16 22:45:31 MDT 2004 --Signature=_Sun__2_May_2004_15_46_49_-0600_39iKNqpvwjELTqoo Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iEYEARECAAYFAkCVbEoACgkQLQ/DKuwDYzlTzQCfaBE0lZJ2oOcmYUAEPpvTMo0N MtMAnRN/Io8B45X7/EL3lvCkzBrXbV9J =ZVMt -----END PGP SIGNATURE----- --Signature=_Sun__2_May_2004_15_46_49_-0600_39iKNqpvwjELTqoo-- From pgsql-bugs-owner@postgresql.org Tue May 4 09:54:44 2004 X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 32F21D1EF8E for ; Mon, 3 May 2004 13:31:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38650-03 for ; Mon, 3 May 2004 13:30:48 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id 72638D1EF8C for ; Mon, 3 May 2004 13:30:43 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 641033AA01; Mon, 3 May 2004 13:30:50 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 592213A947 for ; Mon, 3 May 2004 13:30:50 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Mon, 03 May 2004 13:10:38 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 734C73A64D for ; Mon, 3 May 2004 13:10:36 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Mon, 03 May 2004 13:10:36 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Mon, 03 May 2004 13:08:37 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1EEE4D1EF81 for ; Mon, 3 May 2004 13:08:37 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25024-06 for ; Mon, 3 May 2004 13:08:19 -0300 (ADT) X-Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [62.67.200.157]) by svr1.postgresql.org (Postfix) with ESMTP id 465D3D1EF7B for ; Mon, 3 May 2004 13:08:13 -0300 (ADT) X-Received: (qmail 19882 invoked from network); 3 May 2004 16:08:17 -0000 X-Received: from unknown (HELO tcn.local) ([pbs]652696@[217.93.30.36]) (envelope-sender ) by smtprelay02.ispgateway.de (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 3 May 2004 16:08:17 -0000 X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by tcn.local (Postfix) with ESMTP id 947B6AB9 for ; Mon, 3 May 2004 18:08:23 +0200 (CEST) Message-ID: <40966E77.4020004@nitwit.de> Date: Mon, 03 May 2004 18:08:23 +0200 From: Timo Nentwig User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: support@postgresql.org Subject: Bug in optimizer X-Enigmail-Version: 0.83.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Mon, 3 May 2004 13:30:46 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-bugs@postgresql.org ReSent-Subject: Bug in optimizer ReSent-Message-ID: <20040503133046.V22860@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.0 tagged_above=0.0 required=5.0 tests=BIZ_TLD, UPPERCASE_25_50 X-Spam-Level: * X-Archive-Number: 200405/26 X-Sequence-Number: 8298 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! Your bug report form on the web doesn't work. This is very slow: SELECT urls.id FROM urls WHERE ( urls.id <> ALL (SELECT html.urlid FROM html) ); ...while this is quite fast: SELECT urls.id FROM urls WHERE ( NOT (EXISTS (SELECT html.urlid FROM tml WHERE ( html.urlid = urls.id ))) ); Regards Timo - -- http://nentwig.biz/ (J2EE) http://nitwit.de/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAlm53cmRm71Um+e0RAkJuAKChd+6zoFesZfBY/cGRsSVagnJeswCeMD5s ++Es8hVsFlUpkIIsRfrBp4Y= =STbS -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Mon May 3 14:16:13 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 535BDD1EECD for ; Mon, 3 May 2004 14:16:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51650-08 for ; Mon, 3 May 2004 14:15:55 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 8C429D1EF18 for ; Mon, 3 May 2004 14:15:49 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i43HFmSx096413 for ; Mon, 3 May 2004 17:15:48 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i43H9uRr087217 for pgsql-performance@postgresql.org; Mon, 3 May 2004 17:09:56 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Recommended File System Configuration Date: Mon, 03 May 2004 12:38:33 -0400 Organization: cbbrowne Computing Inc Lines: 43 Message-ID: <60zn8pcvp2.fsf@dev6.int.libertyrms.info> References: <4094AD20.6090707@jamesthornton.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110002 (No Gnus v0.2) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:3KfTEXaC2Mi1CC+e1U6GoFbsbJg= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/13 X-Sequence-Number: 6844 james@jamesthornton.com (James Thornton) writes: > Back in 2001, there was a lengthy thread on the PG Hackers list about > PG and journaling file systems > (http://archives.postgresql.org/pgsql-hackers/2001-05/msg00017.php), > but there was no decisive conclusion regarding what FS to use. At the > time the fly in the XFS ointment was that deletes were slow, but this > was improved with XFS 1.1. > > I think a journaling a FS is needed for PG data since large DBs could > take hours to recover on a non-journaling FS, but what about WAL files? If the WAL files are on a small filesystem, it presumably won't take hours for that filesystem to recover at fsck time. The results have not been totally conclusive... - Several have found JFS to be a bit faster than anything else on Linux, but some data loss problems have been experienced; - ext2 has the significant demerit that with big filesystems, fsck will "take forever" to run; - ext3 appears to be the slowest option out there, and there are some stories of filesystem corruption; - ReiserFS was designed to be real fast with tiny files, which is not the ideal "use case" for PostgreSQL; the designers there are definitely the most aggressive at pushing out "bleeding edge" code, which isn't likely the ideal; - XFS is neither fastest nor slowest, but there has been a lack of reports of "spontaneous data loss" under heavy load, which is a good thing. It's not part of "official 2.4" kernels, requiring backports, but once 2.6 gets more widely deployed, this shouldn't be a demerit anymore... I think that provides a reasonable overview of what has been seen... -- output = reverse("gro.gultn" "@" "enworbbc") http://cbbrowne.com/info/oses.html Donny: Are these the Nazis, Walter? Walter: No, Donny, these men are nihilists. There's nothing to be afraid of. -- The Big Lebowski From pgsql-performance-owner@postgresql.org Tue May 4 01:24:44 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4C5EBD1EF86 for ; Mon, 3 May 2004 17:58:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42915-06 for ; Mon, 3 May 2004 17:58:30 -0300 (ADT) Received: from mwinf0303.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.28]) by svr1.postgresql.org (Postfix) with ESMTP id 5CCF5D1EFD9 for ; Mon, 3 May 2004 17:58:24 -0300 (ADT) Received: from [192.168.0.2] (AMontsouris-108-1-16-56.w80-15.abo.wanadoo.fr [80.15.145.56]) by mwinf0303.wanadoo.fr (SMTP Server) with ESMTP id A92625000872 for ; Mon, 3 May 2004 22:58:31 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v613) Content-Transfer-Encoding: quoted-printable Message-Id: Content-Type: text/plain; charset=ISO-8859-1; format=flowed To: pgsql-performance@postgresql.org From: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= Subject: INSERT RULE Date: Mon, 3 May 2004 22:58:28 +0200 X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.9 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS, SUBJ_ALL_CAPS, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200405/18 X-Sequence-Number: 6849 Hi, I test a configuration where one table is divided in 256 sub-table. And I use a RULE to offer a single view to the data. For INSERT I have create 256 rules like: CREATE RULE ndicti_000 AS ON INSERT TO ndict WHERE (NEW.word_id & 255) =3D 000 DO INSTEAD INSERT INTO ndict_000 VALUES( NEW.url_id, 000, NEW.intag); CREATE RULE ndicti_001 AS ON INSERT TO ndict WHERE (NEW.word_id & 255) =3D 001 DO INSTEAD INSERT INTO ndict_001 VALUES( NEW.url_id, 001, NEW.intag); And that works, a bit slow. I try to do: CREATE RULE ndicti AS ON INSERT TO ndict DO INSTEAD INSERT INTO 'ndict_' || (NEW.word_id & 255) VALUES( NEW.url_id, NEW.word_id, NEW.intag); I got an error on 'ndict_' . I did not found the right syntax. Any help is welcomed. Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Mon May 3 23:46:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2B3F8D1E7B8 for ; Mon, 3 May 2004 23:46:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42129-03 for ; Mon, 3 May 2004 23:45:57 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id CBB74D1E12E for ; Mon, 3 May 2004 23:45:49 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i442jnSx016972 for ; Tue, 4 May 2004 02:45:49 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i442NqL8004948 for pgsql-performance@postgresql.org; Tue, 4 May 2004 02:23:52 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: cache table Date: Mon, 03 May 2004 22:24:02 -0400 Organization: Hub.Org Networking Services Lines: 17 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040421 X-Accept-Language: en-us, en To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/14 X-Sequence-Number: 6845 I have a big table with some int fields. I frequently need to do queries like: SELECT if2, count(*) FROM table WHERE if1 = 20 GROUP BY if2; The problem is that this is slow and frequently requires a seqscan. I'd like to cache the results in a second table and update the counts with triggers, but this would a) require another UPDATE for each INSERT/UPDATE which would slow down adding and updating of data and b) produce a large amount of dead rows for vacuum to clear out. It would also be nice if this small table could be locked into the pg cache somehow. It doesn't need to store the data on disk because the counts can be generated from scratch? So what is the best solution to this problem? I'm sure it must come up pretty often. From pgsql-performance-owner@postgresql.org Mon May 3 23:46:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3A7D3D1E882 for ; Mon, 3 May 2004 23:46:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 39975-03 for ; Mon, 3 May 2004 23:45:58 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 44292D1E147 for ; Mon, 3 May 2004 23:45:50 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i442jnT1016972 for ; Tue, 4 May 2004 02:45:49 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i442Ucxa008336 for pgsql-performance@postgresql.org; Tue, 4 May 2004 02:30:38 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: Re: linux distro for better pg performance Date: Mon, 03 May 2004 22:30:48 -0400 Organization: Hub.Org Networking Services Lines: 10 Message-ID: <40970058.3040608@selectacast.net> References: <407E25A6.ADFE4815@t1.unisoftbg.com> <407E909F.9000101@ehpg.net> <1082053706.10823.38.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "J. Andrew Rogers" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040421 X-Accept-Language: en-us, en In-Reply-To: <1082053706.10823.38.camel@localhost.localdomain> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/15 X-Sequence-Number: 6846 J. Andrew Rogers wrote: > Do these features make a difference? Far more than you would imagine. > On one postgres server I just upgraded, we went from a 3Ware 8x7200-RPM > RAID-10 configuration to an LSI 320-2 SCSI 3x10k RAID-5, with 256M Is raid 5 much faster than raid 10? On a 4 disk array with 3 data disks and 1 parity disk, you have to write 4/3rds the original data, while on raid 10 you have to write 2 times the original data, so logically raid 5 should be faster. From pgsql-performance-owner@postgresql.org Tue May 4 00:47:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8F794D1F01B for ; Tue, 4 May 2004 00:47:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46378-09 for ; Tue, 4 May 2004 00:46:56 -0300 (ADT) Received: from wren.rentec.com (unknown [65.213.84.9]) by svr1.postgresql.org (Postfix) with ESMTP id B1771D1F003 for ; Tue, 4 May 2004 00:46:54 -0300 (ADT) Received: from rentec.com (stangesun.rentec.com [172.16.160.106]) by wren.rentec.com (8.12.1/8.12.1) with ESMTP id i443kieu004709; Mon, 3 May 2004 23:46:44 -0400 (EDT) Message-ID: <4097081B.7020006@rentec.com> Date: Mon, 03 May 2004 23:03:55 -0400 From: Alan Stange User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a) Gecko/20040428 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joseph Shraibman Cc: "J. Andrew Rogers" , pgsql-performance@postgresql.org Subject: Re: linux distro for better pg performance References: <407E25A6.ADFE4815@t1.unisoftbg.com> <407E909F.9000101@ehpg.net> <1082053706.10823.38.camel@localhost.localdomain> <40970058.3040608@selectacast.net> In-Reply-To: <40970058.3040608@selectacast.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/17 X-Sequence-Number: 6848 Joseph Shraibman wrote: > J. Andrew Rogers wrote: > >> Do these features make a difference? Far more than you would >> imagine. On one postgres server I just upgraded, we went from a 3Ware >> 8x7200-RPM >> RAID-10 configuration to an LSI 320-2 SCSI 3x10k RAID-5, with 256M > > Is raid 5 much faster than raid 10? On a 4 disk array with 3 data > disks and 1 parity disk, you have to write 4/3rds the original data, > while on raid 10 you have to write 2 times the original data, so > logically raid 5 should be faster. I think this comparison is a bit simplistic. For example, most raid5 setups have full stripes that are more than 8K (the typical IO size in postgresql), so one might have to read in portions of the stripe in order to compute the parity. The needed bits might be in some disk or controller cache; if it's not then you lose. If one is able to perform full stripe writes then the raid5 config should be faster for writes. Note also that the mirror has 2 copies of the data, so that the read IOs would be divided across 2 (or more) spindles using round robin or a more advanced algorithm to reduce seek times. Of course, I might be completely wrong... -- Alan From pgsql-performance-owner@postgresql.org Tue May 4 00:41:04 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 92BD9D1E40A for ; Tue, 4 May 2004 00:41:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55330-03 for ; Tue, 4 May 2004 00:40:42 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id CF710D1DF6A for ; Tue, 4 May 2004 00:40:41 -0300 (ADT) Received: (qmail 8693 invoked from network); 4 May 2004 04:02:09 -0000 Received: from unknown (HELO jamesthornton.com) (james@69.150.60.163) by 0 with SMTP; 4 May 2004 04:02:09 -0000 Message-ID: <409710F8.10500@jamesthornton.com> Date: Mon, 03 May 2004 22:41:44 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joseph Shraibman Cc: "J. Andrew Rogers" , pgsql-performance@postgresql.org Subject: Re: linux distro for better pg performance References: <407E25A6.ADFE4815@t1.unisoftbg.com> <407E909F.9000101@ehpg.net> <1082053706.10823.38.camel@localhost.localdomain> <40970058.3040608@selectacast.net> In-Reply-To: <40970058.3040608@selectacast.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/16 X-Sequence-Number: 6847 Joseph Shraibman wrote: > Is raid 5 much faster than raid 10? On a 4 disk array with 3 data disks > and 1 parity disk, you have to write 4/3rds the original data, while on > raid 10 you have to write 2 times the original data, so logically raid 5 > should be faster. RAID 5 will give you more capacity, but is usually not recommended for write intensive applications since RAID 5 writes require four I/O operations: parity and data disks must be read, new data is compared to data already on the drive and changes are noted, new parity is calculated, both the parity and data disks are written to. Furthermore, if a disk fails, performance is severely affected since all remaining drives must be read for each I/O in order to recalculate the missing disk drives data. RAID 0+1 has the same performance and capacity as RAID 1+0 (10), but less reliability since "a single drive failure will cause the whole array to become, in essence, a RAID Level 0 array" so I don't know why anyone would choose it over RAID 10 where multiple disks can fail. RAID 1 has the same capacity as RAID 10 (n/2), but RAID 10 has better performance so if you're going to have more than one drive pair, why not go for RAID 10 and get the extra performance from striping? I have been researching how to configure Postgres for a RAID 10 SAME configuration as described in the Oracle paper "Optimal Storage Configuration Made Easy" (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has anyone delved into this before? The filesystem choice is also a key element in database performance tuning. In another Oracle paper entitled Tuning an "Oracle8i Database Running Linux" (http://otn.oracle.com/oramag/webcolumns/2002/techarticles/scalzo_linux02.html), Dr. Bert Scalzo says, "The trouble with these tests-for example, Bonnie, Bonnie++, Dbench, Iobench, Iozone, Mongo, and Postmark-is that they are basic file system throughput tests, so their results generally do not pertain in any meaningful fashion to the way relational database systems access data files." Instead he suggests users benchmarking filesystems for database applications should use these two well-known and widely accepted database benchmarks: AS3AP (http://www.benchmarkresources.com/handbook/5.html): a scalable, portable ANSI SQL relational database benchmark that provides a comprehensive set of tests of database-processing power; has built-in scalability and portability for testing a broad range of systems; minimizes human effort in implementing and running benchmark tests; and provides a uniform, metric, straightforward interpretation of the results. TPC-C (http://www.tpc.org/): an online transaction processing (OLTP) benchmark that involves a mix of five concurrent transactions of various types and either executes completely online or queries for deferred execution. The database comprises nine types of tables, having a wide range of record and population sizes. This benchmark measures the number of transactions per second. I encourage you to read the paper -- Dr. Scalzo's results will surprise you; however, while he benchmarked ext2, ext3, ReiserFS, JFS, and RAW, he did not include XFS. SGI and IBM did a more detailed study on Linux filesystem performance, which included XFS, ext2, ext3 (various modes), ReiserFS, and JRS, and the results are presented in a paper entitled "Filesystem Performance and Scalability in Linux 2.4.17" (http://oss.sgi.com/projects/xfs/papers/filesystem-perf-tm.pdf). This paper goes over the details on how to properly conduct a filesystem benchmark and addresses scaling and load more so than Dr. Scalzo's tests. For further study, I have compiled a list of Linux filesystem resources at: http://jamesthornton.com/hotlist/linux-filesystems/. -- James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-performance-owner@postgresql.org Tue May 4 03:03:41 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5E573D1B837 for ; Tue, 4 May 2004 03:03:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 03097-01 for ; Tue, 4 May 2004 03:03:18 -0300 (ADT) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by svr1.postgresql.org (Postfix) with ESMTP id AE1C4D1DF6F for ; Tue, 4 May 2004 03:03:16 -0300 (ADT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by smtp.istop.com (Postfix) with ESMTP id 45FF917C436; Tue, 4 May 2004 02:03:17 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1BKt1R-0004id-00; Tue, 04 May 2004 02:03:17 -0400 To: Joseph Shraibman Cc: "J. Andrew Rogers" , pgsql-performance@postgresql.org Subject: Re: linux distro for better pg performance References: <407E25A6.ADFE4815@t1.unisoftbg.com> <407E909F.9000101@ehpg.net> <1082053706.10823.38.camel@localhost.localdomain> <40970058.3040608@selectacast.net> In-Reply-To: <40970058.3040608@selectacast.net> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 04 May 2004 02:03:16 -0400 Message-ID: <87k6zszq3f.fsf@stark.xeocode.com> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/20 X-Sequence-Number: 6851 Joseph Shraibman writes: > J. Andrew Rogers wrote: > > > Do these features make a difference? Far more than you would imagine. On one > > postgres server I just upgraded, we went from a 3Ware 8x7200-RPM > > RAID-10 configuration to an LSI 320-2 SCSI 3x10k RAID-5, with 256M > > Is raid 5 much faster than raid 10? On a 4 disk array with 3 data disks and 1 > parity disk, you have to write 4/3rds the original data, while on raid 10 you > have to write 2 times the original data, so logically raid 5 should be faster. In RAID5 every write needs to update the parity disk as well. In order to do that for a small random access write you often need read in the rest of the data block being modified to calculate the parity bits. This means writes often have higher latency on RAID5 because they first have to do an extra read. This is where RAID5 got its bad reputation. Good modern RAID5 controllers can minimize this problem but I think it's still an issue for a lot of lower end hardware. I wonder if postgres's architecture might minimize it already just because of the pattern of writes it generates. -- greg From pgsql-performance-owner@postgresql.org Tue May 4 04:37:49 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DECD8D1B97B for ; Tue, 4 May 2004 04:37:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25372-10 for ; Tue, 4 May 2004 04:37:29 -0300 (ADT) Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [202.0.58.21]) by svr1.postgresql.org (Postfix) with ESMTP id 73FCDD1B8A2 for ; Tue, 4 May 2004 04:37:27 -0300 (ADT) Received: from smtp-2.paradise.net.nz (smtp-2b.paradise.net.nz [202.0.32.211]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0HX600KMGIIF30@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Tue, 04 May 2004 19:37:27 +1200 (NZST) Received: from paradise.net.nz (218-101-12-151.paradise.net.nz [218.101.12.151]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id E3DE79E2AE; Tue, 04 May 2004 19:37:26 +1200 (NZST) Date: Tue, 04 May 2004 19:39:22 +1200 From: Mark Kirkwood Subject: Re: Fwd: FreeBSD, PostgreSQL, semwait and sbwait! In-reply-to: <52623D23-9AA4-11D8-9268-000A95DE2550@gdr-isis.enst.fr> To: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= Cc: pgsql-performance@postgresql.org Message-id: <409748AA.2030801@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 8BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040404 References: <200403231248.34425.darcy@wavefire.com> <40615443.4030003@paradise.net.nz> <52623D23-9AA4-11D8-9268-000A95DE2550@gdr-isis.enst.fr> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.2 tagged_above=0.0 required=5.0 tests=RCVD_IN_BL_SPAMCOP_NET X-Spam-Level: ** X-Archive-Number: 200405/21 X-Sequence-Number: 6852 I am wondering if your wait is caused by contention between pg_autovacuum and the DELETE that is running. Your large Pg blocksize (32K) *may* be contributing to any possible contention as well. Maybe try disabling pg_autovacuum to see if there is any change in behaviour. Also going through my head is '32 Kb bock's size (to match ffs and raid block's size)' - does that mean you have raid strip size = 32K? maybe try 128K (I know it sounds like a bad thing, but generally raid stripes of 128K->256K are better than 32K->64K) regards Mark Pailloncy Jean-G�rard wrote: > Hello, > >> > I found the same problem. > > I use OpenBSD 3.3, > On Pentium 2,4 GHz with 1 Gb RAM, RAID 10. > With PostgreSQL 7.4.1 with 32 Kb bock's size (to match ffs and raid > block's size) > With pg_autovacuum daemon from Pg 7.5. > > I run a web indexer. > sd0 raid-1 with system pg-log and indexer-log > sd1 raid-10 with pg-data and indexer-data > The sd1 disk achives between 10 and 40 Mb/s on normal operation. > > When I get semwait in top, system waits ;-) > Not much disk activity. > Not much log in pg or indexer. > Just wait.... > From pgsql-performance-owner@postgresql.org Wed May 5 13:57:31 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CC107D1B4A3 for ; Tue, 4 May 2004 07:13:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 81955-05 for ; Tue, 4 May 2004 07:13:31 -0300 (ADT) Received: from mwinf0602.wanadoo.fr (smtp6.wanadoo.fr [193.252.22.25]) by svr1.postgresql.org (Postfix) with ESMTP id 60A10D1B4E7 for ; Tue, 4 May 2004 07:13:26 -0300 (ADT) Received: from [192.168.0.2] (AMontsouris-108-1-16-56.w80-15.abo.wanadoo.fr [80.15.145.56]) by mwinf0602.wanadoo.fr (SMTP Server) with ESMTP id B8E4F5400717 for ; Tue, 4 May 2004 12:13:28 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= Subject: Re: INSERT RULE Date: Tue, 4 May 2004 12:13:26 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.4 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200405/36 X-Sequence-Number: 6867 > I try to do: > CREATE RULE ndicti AS ON INSERT TO ndict > DO INSTEAD INSERT INTO 'ndict_' || (NEW.word_id & 255) > VALUES( NEW.url_id, NEW.word_id, NEW.intag); > I got an error on 'ndict_' . > I did not found the right syntax. In fact I discover that SELECT * FROM / INSERT INTO table doesn't accept function that returns the name of the table as table,=20 but only function that returns rows.... I'm dead. Does this feature, is possible or plan ? Is there a trick to do it ? Cordialement, Jean-G=E9rard Pailloncy From pgsql-performance-owner@postgresql.org Tue May 4 09:06:27 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0C903D1E5C4 for ; Tue, 4 May 2004 09:06:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17535-07 for ; Tue, 4 May 2004 09:06:07 -0300 (ADT) Received: from hotmail.com (bay18-dav5.bay18.hotmail.com [65.54.187.185]) by svr1.postgresql.org (Postfix) with ESMTP id C226ED1B4A3 for ; Tue, 4 May 2004 09:06:03 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 4 May 2004 05:06:07 -0700 Received: from 67.81.102.201 by bay18-dav5.bay18.hotmail.com with DAV; Tue, 04 May 2004 12:06:06 +0000 X-Originating-IP: [67.81.102.201] X-Originating-Email: [awerman2@hotmail.com] X-Sender: awerman2@hotmail.com From: "Aaron Werman" To: "Alan Stange" Cc: References: <407E25A6.ADFE4815@t1.unisoftbg.com> <407E909F.9000101@ehpg.net> <1082053706.10823.38.camel@localhost.localdomain> <40970058.3040608@selectacast.net> <4097081B.7020006@rentec.com> Subject: Re: linux distro for better pg performance Date: Tue, 4 May 2004 08:06:22 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Message-ID: X-OriginalArrivalTime: 04 May 2004 12:06:07.0134 (UTC) FILETIME=[2E3413E0:01C431D0] X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/22 X-Sequence-Number: 6853 The comparison is actually dead on. If you have lots of write through / read behind cache, RAID 5 can run very quickly, until the write rate overwhelms the cache - at which point the 4 I/O per write / 2 per read stops it. This means that RAID 5 works, except when stressed, which is a bad paradigm. If you do streaming sequential writes on RAID5 on a 4 drive RAID5, 4 writes become: - read drive 1 for data - read drive 3 for parity - write changes to drive 1 - write changes to drive 3 - read drive 2 for data - read drive 4 for parity - write changes to drive 2 - write changes to drive 4 - read drive 3 for data - read drive 1 for parity - write changes to drive 3 - write changes to drive 1 - read drive 4 for data - read drive 2 for parity - write changes to drive 4 - write changes to drive 2 or drive 1: 2 reads, 2 writes drive 2: 2 reads, 2 writes drive 3: 2 reads, 2 writes drive 4: 2 reads, 2 writes in other words, evenly distributed 16 I/Os. These have to be ordered to be recoverable (otherwise the parity scheme is broken and you can't recover), and thus are quasi synchronous. The same on RAID 10 is - write changes to drive 1 - write copy of changes to drive 2 - write changes to drive 1 - write copy of changes to drive 2 - write changes to drive 1 - write copy of changes to drive 2 - write changes to drive 1 - write copy of changes to drive 2 or drive 1: 4 I/Os drive 2: 4 I/Os in other words 4 I/Os in parallel. There is no wait on streaming I/O on RAID 10, and this fact is the other main reason RAID 10 gives an order of magnitude better performance. If you are writing full blocks in a streaming mode, RAID 3 will be the fastest - it is RAID 0 with a parity drive. In every situation I've seen it, RAID 5 was either generally slow or got applications into trouble during stress: bulk loads, etc. Most DBAs end up on RAID 10 for it's predictability and performance. /Aaron ----- Original Message ----- From: "Alan Stange" To: "Joseph Shraibman" Cc: "J. Andrew Rogers" ; Sent: Monday, May 03, 2004 11:03 PM Subject: Re: [PERFORM] linux distro for better pg performance > Joseph Shraibman wrote: > > > J. Andrew Rogers wrote: > > > >> Do these features make a difference? Far more than you would > >> imagine. On one postgres server I just upgraded, we went from a 3Ware > >> 8x7200-RPM > >> RAID-10 configuration to an LSI 320-2 SCSI 3x10k RAID-5, with 256M > > > > Is raid 5 much faster than raid 10? On a 4 disk array with 3 data > > disks and 1 parity disk, you have to write 4/3rds the original data, > > while on raid 10 you have to write 2 times the original data, so > > logically raid 5 should be faster. > > I think this comparison is a bit simplistic. For example, most raid5 > setups have full stripes that are more than 8K (the typical IO size in > postgresql), so one might have to read in portions of the stripe in > order to compute the parity. The needed bits might be in some disk or > controller cache; if it's not then you lose. If one is able to > perform full stripe writes then the raid5 config should be faster for > writes. > > Note also that the mirror has 2 copies of the data, so that the read IOs > would be divided across 2 (or more) spindles using round robin or a more > advanced algorithm to reduce seek times. > > Of course, I might be completely wrong... > > -- Alan > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Tue May 4 10:55:50 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20A4DD1F0A7 for ; Tue, 4 May 2004 10:55:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 70950-02 for ; Tue, 4 May 2004 10:55:32 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 60CABD1E131 for ; Tue, 4 May 2004 10:55:28 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i44DtJBO010303; Tue, 4 May 2004 07:55:19 -0600 (MDT) Date: Tue, 4 May 2004 07:52:12 -0600 (MDT) From: "scott.marlowe" To: Joseph Shraibman Cc: Subject: Re: cache table In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/23 X-Sequence-Number: 6854 On Mon, 3 May 2004, Joseph Shraibman wrote: > I have a big table with some int fields. I frequently need to do > queries like: > > SELECT if2, count(*) FROM table WHERE if1 = 20 GROUP BY if2; > > The problem is that this is slow and frequently requires a seqscan. I'd > like to cache the results in a second table and update the counts with > triggers, but this would a) require another UPDATE for each > INSERT/UPDATE which would slow down adding and updating of data and b) > produce a large amount of dead rows for vacuum to clear out. > > It would also be nice if this small table could be locked into the pg > cache somehow. It doesn't need to store the data on disk because the > counts can be generated from scratch? I think you might be interested in materialized views. You could create this as a materialized view which should be very fast to just select * from. While materialized views aren't a standard part of PostgreSQL just yet, there is a working implementation available from Jonathan Gardner at: http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html It's all implemented with plpgsql and is quite interesting to read through. IT has a nice tutorial methodology to it. From pgsql-performance-owner@postgresql.org Tue May 4 12:46:42 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1B239D1DF29 for ; Tue, 4 May 2004 12:46:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14839-10 for ; Tue, 4 May 2004 12:46:07 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 206D1D1B520 for ; Tue, 4 May 2004 12:46:07 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i44Fk6Sx050540 for ; Tue, 4 May 2004 15:46:06 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i44FRsdR042648 for pgsql-performance@postgresql.org; Tue, 4 May 2004 15:27:54 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: Re: cache table Date: Tue, 04 May 2004 11:27:53 -0400 Organization: Hub.Org Networking Services Lines: 9 Message-ID: <4097B679.60301@selectacast.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "scott.marlowe" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040421 X-Accept-Language: en-us, en In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/24 X-Sequence-Number: 6855 scott.marlowe wrote: > I think you might be interested in materialized views. You could create > this as a materialized view which should be very fast to just select * > from. That seems to be the count table I envisioned. It just hides the details for me. It still has the problems of an extra UPDATE every time the data table is updated and generating a lot of dead tuples. From pgsql-performance-owner@postgresql.org Tue May 4 13:32:13 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7AA5DD1E0DE for ; Tue, 4 May 2004 13:32:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36914-10 for ; Tue, 4 May 2004 13:31:51 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 327CAD1F07D for ; Tue, 4 May 2004 13:31:50 -0300 (ADT) Received: (qmail 10987 invoked by uid 500); 4 May 2004 16:36:19 -0000 Date: Tue, 4 May 2004 11:36:19 -0500 From: Bruno Wolff III To: Timo Nentwig Cc: pgsql-performance@postgresql.org, support@postgresql.org Subject: Re: Bug in optimizer Message-ID: <20040504163619.GB10698@wolff.to> Mail-Followup-To: pgsql-performance@postgresql.org, bruno@wolff.to References: <40966E77.4020004@nitwit.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40966E77.4020004@nitwit.de> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/25 X-Sequence-Number: 6856 On Mon, May 03, 2004 at 18:08:23 +0200, Timo Nentwig wrote: > > This is very slow: This kind of question should be asked on the performance list. > > SELECT urls.id FROM urls WHERE > ( > urls.id <> ALL (SELECT html.urlid FROM html) > ); > > ...while this is quite fast: You didn't provide your postgres version or an explain analyze so it is hard to answer your question definitivly. Most likely you are using a pre 7.4 version which is know to be slow for IN (which is what the above probably gets translated to). > > SELECT urls.id FROM urls WHERE > ( > NOT (EXISTS (SELECT html.urlid FROM tml WHERE > ( > html.urlid = urls.id > ))) > ); From pgsql-performance-owner@postgresql.org Tue May 4 15:15:03 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 68FD5D1F057 for ; Tue, 4 May 2004 15:15:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 90497-02 for ; Tue, 4 May 2004 15:14:39 -0300 (ADT) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by svr1.postgresql.org (Postfix) with ESMTP id 693A5D1F0E2 for ; Tue, 4 May 2004 15:14:36 -0300 (ADT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by smtp.istop.com (Postfix) with ESMTP id D0E5917C028; Tue, 4 May 2004 14:14:15 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1BL4Qp-0007AT-00; Tue, 04 May 2004 14:14:15 -0400 To: Joseph Shraibman Cc: "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: cache table References: <4097B679.60301@selectacast.net> In-Reply-To: <4097B679.60301@selectacast.net> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 04 May 2004 14:14:15 -0400 Message-ID: <87wu3sxdoo.fsf@stark.xeocode.com> Lines: 39 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/26 X-Sequence-Number: 6857 Joseph Shraibman writes: > scott.marlowe wrote: > > > I think you might be interested in materialized views. You could create this > > as a materialized view which should be very fast to just select * from. > > That seems to be the count table I envisioned. It just hides the details for > me. It still has the problems of an extra UPDATE every time the data table is > updated and generating a lot of dead tuples. The dead tuples is only going to be a problem if you have lots of updates. If that's the case then you're also going to have problems with contention. This trigger will essentially serialize all inserts, deletes, updates at least within a group. If you use transactions with multiple such updates then you will also risk creating deadlocks. But I think these problems are fundamental to the problem you've described. Keeping denormalized aggregate data like this inherently creates contention on the data and generates lots of old data. It's only really useful when you have few updates and many many reads. If you know more about the behaviour of the updates then there might be other options. Like, do you need precise data or only approximate data? If approximate perhaps you could just do a periodic refresh of the denormalized view and use that. Are all the updates to the data you'll be querying coming from within the same application context? In which case you can keep a cache locally in the application and update it locally. I often do this when I have rarely updated or insert-only data, I just do a lazy cache using a perl hash or equivalent. If you're really happy with losing the cache, and you don't need complex transactions or care about serializing updates then you could use something like memcached (http://www.danga.com/memcached/). That might be your best fit for how you describe your requirements. -- greg From pgsql-performance-owner@postgresql.org Tue May 4 15:44:42 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C4C21D1E5C9 for ; Tue, 4 May 2004 15:44:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 96075-06 for ; Tue, 4 May 2004 15:44:18 -0300 (ADT) Received: from web13121.mail.yahoo.com (web13121.mail.yahoo.com [216.136.174.83]) by svr1.postgresql.org (Postfix) with SMTP id 7EEC3D1E5C1 for ; Tue, 4 May 2004 15:44:16 -0300 (ADT) Message-ID: <20040504184416.11114.qmail@web13121.mail.yahoo.com> Received: from [63.78.248.48] by web13121.mail.yahoo.com via HTTP; Tue, 04 May 2004 11:44:16 PDT Date: Tue, 4 May 2004 11:44:16 -0700 (PDT) From: Litao Wu Subject: pg_stat To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/27 X-Sequence-Number: 6858 Hi, I have query: select pg_stat_get_numscans(76529669), pg_stat_get_blocks_fetched(76529669), pg_stat_get_blocks_hit(76529669); The result is: pg_stat_get_numscans | pg_stat_get_blocks_fetched | pg_stat_get_blocks_hit ----------------------+----------------------------+------------------------ 0 | 23617 | 23595 (1 row) My questions are: 1. How can index disk blocks be requested (either from disk or cache) without index scan? 2. If I want to check if an index is used after pg_stat_reset(), how can I get it? By number of scans or block requests, or some other ways? Thanks, __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover From pgsql-performance-owner@postgresql.org Tue May 4 16:33:25 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EEF85D1E5E8 for ; Tue, 4 May 2004 16:33:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17492-03 for ; Tue, 4 May 2004 16:33:04 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id 3A4AFD1E5F3 for ; Tue, 4 May 2004 16:33:01 -0300 (ADT) Received: (qmail 17963 invoked from network); 4 May 2004 19:54:33 -0000 Received: from unknown (HELO jamesthornton.com) (james@69.150.60.163) by 0 with SMTP; 4 May 2004 19:54:33 -0000 Message-ID: <4097F02A.9010301@jamesthornton.com> Date: Tue, 04 May 2004 14:34:02 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Adapting Oracle S.A.M.E. Methodology for Postgres Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.3 tagged_above=0.0 required=5.0 tests=GAPPY_SUBJECT X-Spam-Level: * X-Archive-Number: 200405/28 X-Sequence-Number: 6859 I mentioned this at the tail end of a long post in another thread, but I have been researching how to configure Postgres for a RAID 10 SAME configuration as described in the Oracle paper "Optimal Storage Configuration Made Easy" (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has anyone delved into this before? -- James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-performance-owner@postgresql.org Tue May 4 16:38:35 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 91C5AD1F0EB for ; Tue, 4 May 2004 16:38:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 18611-04 for ; Tue, 4 May 2004 16:38:12 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id 783B2D1F0C4 for ; Tue, 4 May 2004 16:37:55 -0300 (ADT) Received: (qmail 18084 invoked from network); 4 May 2004 19:59:18 -0000 Received: from unknown (HELO jamesthornton.com) (james@69.150.60.163) by 0 with SMTP; 4 May 2004 19:59:18 -0000 Message-ID: <4097F147.6050000@jamesthornton.com> Date: Tue, 04 May 2004 14:38:47 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris Browne Cc: pgsql-performance@postgresql.org Subject: Re: Recommended File System Configuration References: <4094AD20.6090707@jamesthornton.com> <60zn8pcvp2.fsf@dev6.int.libertyrms.info> In-Reply-To: <60zn8pcvp2.fsf@dev6.int.libertyrms.info> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/29 X-Sequence-Number: 6860 Chris Browne wrote: > The results have not been totally conclusive... > > - Several have found JFS to be a bit faster than anything else on > Linux, but some data loss problems have been experienced; > > - ext2 has the significant demerit that with big filesystems, fsck > will "take forever" to run; > > - ext3 appears to be the slowest option out there, and there are some > stories of filesystem corruption; In an Oracle paper entitled Tuning an "Oracle8i Database Running Linux" (http://otn.oracle.com/oramag/webcolumns/2002/techarticles/scalzo_linux02.html), Dr. Bert Scalzo says, "The trouble with these tests-for example, Bonnie, Bonnie++, Dbench, Iobench, Iozone, Mongo, and Postmark-is that they are basic file system throughput tests, so their results generally do not pertain in any meaningful fashion to the way relational database systems access data files." Instead he suggests users benchmarking filesystems for database applications should use these two well-known and widely accepted database benchmarks: AS3AP (http://www.benchmarkresources.com/handbook/5.html): a scalable, portable ANSI SQL relational database benchmark that provides a comprehensive set of tests of database-processing power; has built-in scalability and portability for testing a broad range of systems; minimizes human effort in implementing and running benchmark tests; and provides a uniform, metric, straightforward interpretation of the results. TPC-C (http://www.tpc.org/): an online transaction processing (OLTP) benchmark that involves a mix of five concurrent transactions of various types and either executes completely online or queries for deferred execution. The database comprises nine types of tables, having a wide range of record and population sizes. This benchmark measures the number of transactions per second. I encourage you to read the paper -- Dr. Scalzo's results will surprise you; however, while he benchmarked ext2, ext3, ReiserFS, JFS, and RAW, he did not include XFS. SGI and IBM did a more detailed study on Linux filesystem performance, which included XFS, ext2, ext3 (various modes), ReiserFS, and JRS, and the results are presented in a paper entitled "Filesystem Performance and Scalability in Linux 2.4.17" (http://oss.sgi.com/projects/xfs/papers/filesystem-perf-tm.pdf). This paper goes over the details on how to properly conduct a filesystem benchmark and addresses scaling and load more so than Dr. Scalzo's tests. For further study, I have compiled a list of Linux filesystem resources at: http://jamesthornton.com/hotlist/linux-filesystems/. -- James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-performance-owner@postgresql.org Tue May 4 19:15:45 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8A83FD1F0F6 for ; Tue, 4 May 2004 19:15:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 74214-03 for ; Tue, 4 May 2004 19:15:26 -0300 (ADT) Received: from smtp.istop.com (dci.doncaster.on.ca [66.11.168.194]) by svr1.postgresql.org (Postfix) with ESMTP id 84A09D1F116 for ; Tue, 4 May 2004 19:15:23 -0300 (ADT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by smtp.istop.com (Postfix) with ESMTP id DBCB117C10E; Tue, 4 May 2004 18:15:25 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1BL8CD-0008Nl-00; Tue, 04 May 2004 18:15:25 -0400 To: Tom Lane Cc: Greg Stark , Dennis Bjorklund , Bruno Wolff III , "Jim C. Nasby" , pgsql-performance@postgresql.org Subject: Re: Horribly slow hash join References: <874qrg7cy8.fsf@stark.xeocode.com> <16041.1082354970@sss.pgh.pa.us> In-Reply-To: <16041.1082354970@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 04 May 2004 18:15:25 -0400 Message-ID: <87llk7yh36.fsf@stark.xeocode.com> Lines: 64 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/30 X-Sequence-Number: 6861 Tom Lane writes: > Modding by a *non* power of 2 (esp. a prime) mixes the bits quite well, > and is likely faster than any multiple-instruction way to do the same. > > The quoted article seems to be by someone who has spent a lot of time > counting assembly cycles and none at all reading the last thirty years > worth of CS literature. Knuth's treatment of hashing has some actual > math to it... [incidentally, I just found that the quoted article was independently found by Bruce Momjian who found it convincing enough to convert the hash_any table over to it two years ago] I just reviewed Knuth as well as C.L.R. and several papers from CACM and SIGMOD. It seems we have three options: mod(): Pro: empirical research shows it the best algorithm for avoiding collisions Con: requires the hash table be a prime size and far from a power of two. This is inconvenient to arrange for dynamic tables as used in postgres. multiplication method (floor(tablesize * remainder(x * golden ratio))) Pro: works with any table size Con: I'm not clear if it can be done without floating point arithmetic. It seems like it ought to be possible though. Universal hashing: Pro: won't create gotcha situations where the distribution of data suddenly and unexpectedly creates unexpected performance problems. Con: more complex. It would be trivial to switch the implementation from mod() to the multiplicative method which is more suited to postgres's needs. However universal hashing has some appeal. I hate the idea that a hash join could perform perfectly well one day and suddenly become pessimal when new data is loaded. In a sense universal hashing is less predictable. For a DSS system that could be bad. A query that runs fine every day might fail one day in an unpredictable way even though the data is unchanged. But in another sense it would be more predictable in that if you run the query a thousand times the average performance would be very close to the expected regardless of what the data is. Whereas more traditional algorithms have some patterns of data that will consistently perform badly. It's probably not worth it but postgres could maybe even be tricky and pretest the parameters against the common values in the statistics table, generating new ones if they fail to generate a nice distribution. That doesn't really guarantee anything though, except that those common values would at least be well distributed to start with. -- greg From pgsql-performance-owner@postgresql.org Tue May 4 20:35:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 66FB3D1CA43 for ; Tue, 4 May 2004 20:35:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98685-01 for ; Tue, 4 May 2004 20:34:51 -0300 (ADT) Received: from 3months.com (unknown [203.96.25.18]) by svr1.postgresql.org (Postfix) with ESMTP id BF0C9D1EB44 for ; Tue, 4 May 2004 20:34:47 -0300 (ADT) Received: from Spooler by 3months.com (Mercury/32 v4.01a) ID MO00020B; 5 May 2004 11:31:29 +1200 Received: from spooler by 3months.com (Mercury/32 v4.01a); 5 May 2004 11:31:24 +1200 Received: from Cyrillelaptop (203.96.25.15) by 3months.com (Mercury/32 v4.01a) with ESMTP ID MG00004F; 5 May 2004 11:31:21 +1200 From: "Cyrille Bonnet" To: Subject: very high CPU usage in "top", but not in "mpstat" Date: Wed, 5 May 2004 11:34:41 +1200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0018_01C43294.F4B6B620" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQyMF9N3R0vP6P2T4aKHdZRNbaNdg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Message-ID: <47E18B2A3472@3months.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/31 X-Sequence-Number: 6862 This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C43294.F4B6B620 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hello all, We are using Postgres 7.3 with JBoss 3.2.3 on a Linux Fedora 1.0 box. When I am looking at CPU activity with "top", I often see something like: PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND 14154 postgres 25 0 3592 3592 2924 R 99.1 0.3 93:53 0 postmaster At the same time, "mpstat" gives me something like: 11:27:21 AM CPU %user %nice %system %idle intr/s 11:27:21 AM all 2.99 0.00 18.94 78.08 105.94 The system is not visibly slow and response time is satisfactory. Sometimes, the CPU usage drops to 1 or 2%, but not for long usually. Also I have checked the number of open connections to Postgres and there are only 5 (maximum is set to the default: 32). Should I be worried that Postgres is eating up 99% of my CPU??? Or is this *expected* behaviour? Please note that I am a developer, not a system administrator, so maybe I misunderstand the usage of "top" here. Any help will be appreciated. Cyrille. ------=_NextPart_000_0018_01C43294.F4B6B620 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

Hello all,

 

We are using Postgres 7.3 with JBoss 3.2.3 on a Linux Fe= dora 1.0 box.

 

When I am looking at CPU activity with “top”= , I often see something like:

 

  PID USER     PRI  NI&nbs= p; SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND=

14154 postgres  25   0  3592 3592&nb= sp; 2924        R    99.1&nbs= p;     0.3        93:53   0 postmaster

 

At the same time, “mpstat” gives me something like:

 

11:27:21 AM  CPU   %user   %nice %system   %idle    intr/s=

11:27:21 AM  all      &nbs= p;2.99      0.00   18.94       &nbs= p; 78.08    105.94

 

The system is not visibly slow and response time is satisfactory. Sometimes, the CPU usage drops to 1 or 2%, but not for long usually. Also I have checked the number of open connections to Postgres and there are only 5 (maximum is set to the default: 32).

 

Should I be worried that Postgres is eating up 99% of my CPU??? Or is this *expected* behaviour?

 

Please note that I am a developer, not a system administrator, so maybe I misunderstand the usage of “top” here= .

 

Any help will be appreciated.

 

Cyrille.

------=_NextPart_000_0018_01C43294.F4B6B620-- From pgsql-performance-owner@postgresql.org Wed May 5 10:03:43 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C05E2D1E7C7 for ; Wed, 5 May 2004 10:03:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 26637-01 for ; Wed, 5 May 2004 10:03:18 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CC142D1E7C4 for ; Wed, 5 May 2004 10:03:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i45D3Ftm024917; Wed, 5 May 2004 09:03:16 -0400 (EDT) To: "Cyrille Bonnet" Cc: pgsql-performance@postgresql.org Subject: Re: very high CPU usage in "top", but not in "mpstat" In-reply-to: <47E18B2A3472@3months.com> References: <47E18B2A3472@3months.com> Comments: In-reply-to "Cyrille Bonnet" message dated "Wed, 05 May 2004 11:34:41 +1200" Date: Wed, 05 May 2004 09:03:15 -0400 Message-ID: <24916.1083762195@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/32 X-Sequence-Number: 6863 "Cyrille Bonnet" writes: > Should I be worried that Postgres is eating up 99% of my CPU??? Or is this > *expected* behaviour? It's not expected, unless you are running some very long-running query. The conflict between what top says and what mpstat says is strange; I wonder if you might have a buggy version of one of them? You should probably check some other tools (try "vmstat 1" for instance) to see if you can get a consensus on whether the CPU is maxed out or not ... regards, tom lane From pgsql-performance-owner@postgresql.org Wed May 5 14:18:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AFECBD1F3CF for ; Wed, 5 May 2004 14:16:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46786-08 for ; Wed, 5 May 2004 14:16:32 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 9E250D1F1DD for ; Wed, 5 May 2004 14:03:39 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i45H3Uc22406; Wed, 5 May 2004 13:03:30 -0400 (EDT) From: Bruce Momjian Message-Id: <200405051703.i45H3Uc22406@candle.pha.pa.us> Subject: Re: History of oids in postgres? In-Reply-To: <0B7369F9-9918-11D8-A107-000A9566A412@socialserve.com> To: James Robinson Date: Wed, 5 May 2004 13:03:30 -0400 (EDT) Cc: bruno@wolff.to, pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/38 X-Sequence-Number: 6869 James Robinson wrote: > Bruno et al, > > Any self-repsecting lurker would know that oids as row identifiers are > depreciated in postgres. Can anyone provide a brief history regarding > the reasoning behind using them as row identifiers in the first place? > I see a discussion of their use as various primary keys in he system > catalog in the oid-datatype doc page, but not regarding their history > as 'user-space' row ids. They were added at Berkeley and I think are related to the Object-relational ability of PostgreSQL. I think the newer SQL standards have a similar capability specified. -- 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-bugs-owner@postgresql.org Wed May 5 16:16:47 2004 X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 73E79D1CA39 for ; Wed, 5 May 2004 14:46:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 64226-03 for ; Wed, 5 May 2004 14:46:22 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id DC474D1D06C for ; Wed, 5 May 2004 14:46:21 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i45HkKSx028561 for ; Wed, 5 May 2004 17:46:20 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i45HVDiN000543 for pgsql-bugs@postgresql.org; Wed, 5 May 2004 17:31:13 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.bugs Subject: Re: Bug in optimizer Date: Wed, 05 May 2004 19:31:01 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 28 Message-ID: <409924D5.1090001@bigfoot.com> References: <40966E77.4020004@nitwit.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Timo Nentwig User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en In-Reply-To: <40966E77.4020004@nitwit.de> To: pgsql-bugs@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200405/32 X-Sequence-Number: 8304 Timo Nentwig wrote: > This is very slow: > > SELECT urls.id FROM urls WHERE > ( > urls.id <> ALL (SELECT html.urlid FROM html) > ); > > ...while this is quite fast: > > SELECT urls.id FROM urls WHERE > ( > NOT (EXISTS (SELECT html.urlid FROM tml WHERE > ( > html.urlid = urls.id > ))) > ); Are you using the version 7.4.x ? Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Wed May 5 16:30:31 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E7760D1F212 for ; Wed, 5 May 2004 14:37:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 57624-09 for ; Wed, 5 May 2004 14:36:43 -0300 (ADT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0F40AD1F1C1 for ; Wed, 5 May 2004 14:31:59 -0300 (ADT) Received: from [134.22.70.11] (dyn-70-11.tor.dsl.tht.net [134.22.70.11]) by tht.net (Postfix) with ESMTP id 4AB1B76B38; Wed, 5 May 2004 13:32:02 -0400 (EDT) Subject: Re: LIKE and INDEX From: Rod Taylor To: Jie Liang Cc: Postgresql Performance In-Reply-To: References: Content-Type: text/plain Message-Id: <1083778304.60668.3.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Wed, 05 May 2004 13:31:45 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/41 X-Sequence-Number: 6872 > but if I use: > select url from urlinfo where url like 'http://%.lycos.de'; > it won't use index at all, NOT good! > is there any way I can force secon query use index??? create index nowww on urlinfo(replace(replace(url, 'http://', ''), 'www.', ''))); SELECT url FROM urlinfo WHERE replace(replace(url, 'http://', ''), 'www.', '') = 'lycos.de' AND url LIKE 'http://%.lycos.de' ; The replace() will narrow the search down to all records containing lycos.de. Feel free to write a more complex alternative for replace() that will deal with more than just optional www. Once the results have been narrowed down, you may use the original like expression to confirm it is your record. From pgsql-performance-owner@postgresql.org Wed May 5 15:31:25 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9F620D1F189; Wed, 5 May 2004 15:13:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 76287-04; Wed, 5 May 2004 15:12:41 -0300 (ADT) 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 ACF3AD1E838; Wed, 5 May 2004 15:12:39 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1BLQsp-000Ihn-0Z; Wed, 05 May 2004 19:12:39 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id CED651705E; Wed, 5 May 2004 19:12:37 +0100 (BST) Message-ID: <40992E96.5090301@archonet.com> Date: Wed, 05 May 2004 19:12:38 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jie Liang Cc: pgsql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: LIKE and INDEX References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/40 X-Sequence-Number: 6871 Jie Liang wrote: > All, > This is old topic, when I use: > select url from urlinfo where url like 'http://www.lycos.de%'; > it uses the index, good! > > but if I use: > select url from urlinfo where url like 'http://%.lycos.de'; > it won't use index at all, NOT good! > is there any way I can force secon query use index??? I've seen people define a reverse(text) function via plperl or similar then build a functional index on reverse(url). Of course, that would rely on your knowing which end of your search pattern has the % wildcard. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed May 5 15:27:37 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6917AD1F151 for ; Wed, 5 May 2004 15:13:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 73511-06 for ; Wed, 5 May 2004 15:13:15 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 540F6D1E856 for ; Wed, 5 May 2004 15:13:13 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Wed, 5 May 2004 11:13:06 -0700 In-Reply-To: <24916.1083762195@sss.pgh.pa.us> References: <47E18B2A3472@3months.com> <24916.1083762195@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Tom Lane , pgsql-performance@postgresql.org From: Paul Tuckfield Subject: Re: very high CPU usage in "top", but not in "mpstat" Date: Wed, 5 May 2004 11:13:11 -0700 To: Cyrille Bonnet X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/39 X-Sequence-Number: 6870 I'm guessing you have a 4 cpu box: 1 99 percent busy process on a 4 way box == about 25% busy overall. On May 5, 2004, at 6:03 AM, Tom Lane wrote: > "Cyrille Bonnet" writes: >> Should I be worried that Postgres is eating up 99% of my CPU??? Or is >> this >> *expected* behaviour? > > It's not expected, unless you are running some very long-running query. > > The conflict between what top says and what mpstat says is strange; I > wonder if you might have a buggy version of one of them? You should > probably check some other tools (try "vmstat 1" for instance) to see if > you can get a consensus on whether the CPU is maxed out or not ... > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Wed May 5 18:11:49 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3A40ED1E900 for ; Wed, 5 May 2004 18:11:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 50709-08 for ; Wed, 5 May 2004 18:11:30 -0300 (ADT) Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by svr1.postgresql.org (Postfix) with ESMTP id 63A1DD1DC64 for ; Wed, 5 May 2004 18:11:27 -0300 (ADT) Received: from [65.87.16.98] (HELO [10.0.0.210]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 4156961; Wed, 05 May 2004 14:11:29 -0700 Subject: Re: [OFF-TOPIC] - Known maximum size of the PostgreSQL From: "J. Andrew Rogers" To: Carlos Eduardo Smanioto Cc: pgsql-performance@postgresql.org In-Reply-To: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> Content-Type: text/plain Organization: Message-Id: <1083791489.11496.23.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 05 May 2004 14:11:29 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/43 X-Sequence-Number: 6874 On Sat, 2004-06-05 at 11:55, Carlos Eduardo Smanioto wrote: > What's the case of bigger database PostgreSQL (so greate and amount of > registers) that they know??? You might want to fix the month on your system time. With respect to how big PostgreSQL databases can get in practice, these are our two biggest implementations: - 0.5 Tb GIS database (this maybe upwards of 600-700Gb now, I didn't check) - 10 Gb OLTP system with 70 million rows and a typical working set of 2-3 Gb. Postgres is definitely capable of handling large pretty databases with ease. There are some narrow types of workloads that it doesn't do so well on, but for many normal DBMS loads it scales quite well. j. andrew rogers From pgsql-performance-owner@postgresql.org Wed May 5 18:23:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E14E0D1E791 for ; Wed, 5 May 2004 18:23:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59171-03 for ; Wed, 5 May 2004 18:22:57 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 1878BD1F1EC for ; Wed, 5 May 2004 18:22:55 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i45LMgN6018540; Wed, 5 May 2004 15:22:43 -0600 (MDT) Date: Wed, 5 May 2004 15:23:03 -0600 (MDT) From: "scott.marlowe" To: Carlos Eduardo Smanioto Cc: Subject: Re: [OFF-TOPIC] - Known maximum size of the PostgreSQL In-Reply-To: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/44 X-Sequence-Number: 6875 On Sat, 5 Jun 2004, Carlos Eduardo Smanioto wrote: > Hello all, > > What's the case of bigger database PostgreSQL (so greate and amount of > registers) that they know??? http://www.postgresql.org/docs/faqs/FAQ.html#4.5 From pgsql-performance-owner@postgresql.org Wed May 5 22:39:41 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 45181D1F240 for ; Wed, 5 May 2004 22:39:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 40286-02 for ; Wed, 5 May 2004 22:39:23 -0300 (ADT) Received: from houston.familyhealth.com.au (fhnet.arach.net.au [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 641C3D1F243 for ; Wed, 5 May 2004 22:39:18 -0300 (ADT) Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (8.12.9p1/8.12.9) with ESMTP id i461dFWL018034; Thu, 6 May 2004 09:39:16 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Message-ID: <4099996E.90903@familyhealth.com.au> Date: Thu, 06 May 2004 09:48:30 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "J. Andrew Rogers" Cc: Carlos Eduardo Smanioto , pgsql-performance@postgresql.org Subject: Re: [OFF-TOPIC] - Known maximum size of the PostgreSQL References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> <1083791489.11496.23.camel@localhost.localdomain> In-Reply-To: <1083791489.11496.23.camel@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/45 X-Sequence-Number: 6876 >>What's the case of bigger database PostgreSQL (so greate and amount of >>registers) that they know??? Didn't someone say that RedSheriff had a 10TB postgres database or something? Chris From pgsql-performance-owner@postgresql.org Thu May 6 05:13:35 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1821BD1F268 for ; Thu, 6 May 2004 05:13:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 50353-05 for ; Thu, 6 May 2004 05:13:13 -0300 (ADT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id BF0FAD1EA88 for ; Thu, 6 May 2004 05:13:11 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 1BLe0F-000G4z-0X; Thu, 06 May 2004 09:13:12 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id EAB04173DC; Thu, 6 May 2004 09:13:09 +0100 (BST) Message-ID: <4099F396.2020103@archonet.com> Date: Thu, 06 May 2004 09:13:10 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: "J. Andrew Rogers" , Carlos Eduardo Smanioto , pgsql-performance@postgresql.org Subject: Re: [OFF-TOPIC] - Known maximum size of the PostgreSQL References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> <1083791489.11496.23.camel@localhost.localdomain> <4099996E.90903@familyhealth.com.au> In-Reply-To: <4099996E.90903@familyhealth.com.au> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/46 X-Sequence-Number: 6877 Christopher Kings-Lynne wrote: >>> What's the case of bigger database PostgreSQL (so greate and amount of >>> registers) that they know??? > > > Didn't someone say that RedSheriff had a 10TB postgres database or > something? From http://www.redsheriff.com/us/news/news_4_201.html "According to the company, RedSheriff processes 10 billion records a month and the total amount of data managed is more than 32TB. Griffin said PostgreSQL has been in production for 12 months with not a single database fault in that time �The stability of the database can not be questioned. Needless to say, we are extremely happy." I think it's safe to assume this is not on a spare Dell 600SC though. -- Richard Huxton Archonet Ltd From pgsql-advocacy-owner@postgresql.org Thu May 6 05:43:55 2004 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2C845D1F278; Thu, 6 May 2004 05:43:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 62277-07; Thu, 6 May 2004 05:43:34 -0300 (ADT) Received: from frodo.hserus.net (frodo.hserus.net [204.74.68.40]) by svr1.postgresql.org (Postfix) with ESMTP id 71EEFD1EA9C; Thu, 6 May 2004 05:43:32 -0300 (ADT) Received: from concord.pspl.co.in ([202.54.11.72]:61548 helo=frodo.hserus.net) by frodo.hserus.net with asmtp (Cipher TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.32 #0) id 1BLeTd-00081F-1x by authid with plain; Thu, 06 May 2004 14:13:33 +0530 Message-ID: <4099FAAD.4040202@frodo.hserus.net> Date: Thu, 06 May 2004 14:13:25 +0530 From: Shridhar Daithankar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Advocacy Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] [OFF-TOPIC] - Known maximum size of the PostgreSQL References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> <1083791489.11496.23.camel@localhost.localdomain> <4099996E.90903@familyhealth.com.au> <4099F396.2020103@archonet.com> In-Reply-To: <4099F396.2020103@archonet.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/54 X-Sequence-Number: 4330 Richard Huxton wrote: > Christopher Kings-Lynne wrote: > >>>> What's the case of bigger database PostgreSQL (so greate and amount of >>>> registers) that they know??? >> Didn't someone say that RedSheriff had a 10TB postgres database or >> something? > From http://www.redsheriff.com/us/news/news_4_201.html > > "According to the company, RedSheriff processes 10 billion records a > month and the total amount of data managed is more than 32TB. Griffin > said PostgreSQL has been in production for 12 months with not a single > database fault in that time �The stability of the database can not be > questioned. Needless to say, we are extremely happy." > > I think it's safe to assume this is not on a spare Dell 600SC though. > I think we should have a case study for that. And publish it on our regular news/press contacts(Can't imagine the flame war on /...Umm Yummy..:-)). It would make a lot of noise and gain visibility for us. Of course Red Sherrif need to co-operate and spell the details and/or moderate what we write, but all in all, 32TB database is uber-cool..:-) Shridhar From pgsql-advocacy-owner@postgresql.org Thu May 6 20:24:28 2004 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A3B7ED1F26B; Thu, 6 May 2004 05:59:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 70315-04; Thu, 6 May 2004 05:59:20 -0300 (ADT) Received: from elbereth.noviforum.si (unknown [193.189.169.66]) by svr1.postgresql.org (Postfix) with ESMTP id DC403D1DBA6; Thu, 6 May 2004 05:59:16 -0300 (ADT) Received: from elbereth.noviforum.si (localhost [127.0.0.1]) by elbereth.noviforum.si (8.12.10/8.12.10) with ESMTP id i468xEHh004163; Thu, 6 May 2004 10:59:14 +0200 Received: (from gregab@localhost) by elbereth.noviforum.si (8.12.10/8.12.10/Submit) id i468xDe0004162; Thu, 6 May 2004 10:59:13 +0200 Date: Thu, 6 May 2004 10:59:13 +0200 From: Grega Bremec To: Eduardo Almeida Cc: Jan Wieck , Josh Berkus , pgsql-advocacy@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [PERFORM] MySQL vs PG TPC-H benchmarks Message-ID: <20040506085913.GA4102@elbereth.noviforum.si> References: <20040422134249.GA14342@elbereth.noviforum.si> <20040422135910.24475.qmail@web60607.mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <20040422135910.24475.qmail@web60607.mail.yahoo.com> User-Agent: Mutt/1.4.2i Organization: Noviforum, Ltd., Software & Media X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/57 X-Sequence-Number: 4333 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ...and on Thu, Apr 22, 2004 at 06:59:10AM -0700, Eduardo Almeida used the k= eyboard: > > To reference, Sun has java 64bits just to IA64 and > Solaris Sparc 64 not to Opteron. >=20 As I mentioned, that is true for the 1.4.x release of the JVMs. We have been testing some JCA builds of 1.5.0 on x86_64 so far, but it is too unstable f= or any kind of serious work. Cheers, --=20 Grega Bremec Senior Administrator Noviforum Ltd., Software & Media http://www.noviforum.si/ --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAmf5hDo/EMYD4+osRAgSLAKCZ2iVm2ygdHbPteedldCOxOeBypgCfR5gm Hq5CG2qZWLiBIWNlx4k/EMs= =Etxi -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7-- From pgsql-performance-owner@postgresql.org Thu May 6 10:46:49 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 579C6D1EAFA for ; Thu, 6 May 2004 10:46:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 76415-02 for ; Thu, 6 May 2004 10:46:30 -0300 (ADT) Received: from mta0.beanfield.net (unknown [66.207.192.6]) by svr1.postgresql.org (Postfix) with ESMTP id D88FBD1B507 for ; Thu, 6 May 2004 10:46:25 -0300 (ADT) Received: from don.webimpact.com (66-207-218-34.beanfield.net [66.207.218.34] (may be forged)) by mta0.beanfield.net (8.12.11/8.12.6) with ESMTP id i46DkSKF052436 for ; Thu, 6 May 2004 09:46:28 -0400 (EDT) (envelope-from donv@webimpact.com) Message-Id: <6.1.0.6.0.20040506094353.01b363c8@localhost> X-Sender: donv@web-impact.com@localhost X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Date: Thu, 06 May 2004 09:47:08 -0400 To: pgsql-performance@postgresql.org From: Don Vaillancourt Subject: Re: [OFF-TOPIC] - Known maximum size of the In-Reply-To: <4099F396.2020103@archonet.com> References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> <1083791489.11496.23.camel@localhost.localdomain> <4099996E.90903@familyhealth.com.au> <4099F396.2020103@archonet.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_237368781==.ALT" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_20_30, HTML_FONTCOLOR_BLUE, HTML_FONT_BIG, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/49 X-Sequence-Number: 6880 --=====================_237368781==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed Here's a question a little off-topic. What would a 32TB database hardware configuration look like. I'm assuming 200GB hard-drives which would total 160 of them. Double that if you mirror them. Am I correct? At 04:13 AM 06/05/2004, you wrote: >Christopher Kings-Lynne wrote: >>>>What's the case of bigger database PostgreSQL (so greate and amount of >>>>registers) that they know??? >> >>Didn't someone say that RedSheriff had a 10TB postgres database or something? > > From http://www.redsheriff.com/us/news/news_4_201.html > >"According to the company, RedSheriff processes 10 billion records a month >and the total amount of data managed is more than 32TB. Griffin said >PostgreSQL has been in production for 12 months with not a single database >fault in that time "The stability of the database can not be questioned. >Needless to say, we are extremely happy." > >I think it's safe to assume this is not on a spare Dell 600SC though. > >-- > Richard Huxton > Archonet Ltd > >---------------------------(end of broadcast)--------------------------- >TIP 7: don't forget to increase your free space map settings Don Vaillancourt Director of Software Development WEB IMPACT INC. 416-815-2000 ext. 245 email: donv@webimpact.com web: http://www.webimpact.com This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyright. If you are not the intended recipient please notify the sender by reply email and immediately delete this email. Use, disclosure or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited. No representation is made that this email or any attachments are free of viruses. Virus scanning is recommended and is the responsibility of the recipient. --=====================_237368781==.ALT Content-Type: text/html; charset="us-ascii"
Here's a question a little off-topic.

What would a 32TB database hardware configuration look like.  I'm assuming 200GB hard-drives which would total 160 of them.  Double that if you mirror them.

Am I correct?

At 04:13 AM 06/05/2004, you wrote:
Christopher Kings-Lynne wrote:
What's the case of bigger database PostgreSQL (so greate and amount of
registers) that they know???

Didn't someone say that RedSheriff had a 10TB postgres database or something?

From http://www.redsheriff.com/us/news/news_4_201.html

"According to the company, RedSheriff processes 10 billion records a month and the total amount of data managed is more than 32TB. Griffin said PostgreSQL has been in production for 12 months with not a single database fault in that time �The stability of the database can not be questioned. Needless to say, we are extremely happy."

I think it's safe to assume this is not on a spare Dell 600SC though.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Don Vaillancourt
Director of Software Development

WEB IMPACT INC.
416-815-2000 ext. 245
email: donv@webimpact.com
web:
http://www.webimpact.com



This email message is intended only for the addressee(s) 
and contains information that may be confidential and/or 
copyright.  If you are not the intended recipient please 
notify the sender by reply email and immediately delete 
this email. Use, disclosure or reproduction of this email 
by anyone other than the intended recipient(s) is strictly 
prohibited. No representation is made that this email or 
any attachments are free of viruses. Virus scanning is 
recommended and is the responsibility of the recipient.












--=====================_237368781==.ALT--


From pgsql-performance-owner@postgresql.org  Thu May  6 12:45:10 2004
X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org
Received: from localhost (unknown [200.46.204.2])
	by svr1.postgresql.org (Postfix) with ESMTP id 89DA8D1F2E1
	for ;
	Thu,  6 May 2004 12:45:09 -0300 (ADT)
Received: from svr1.postgresql.org ([200.46.204.71])
	by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024)
	with ESMTP id 22973-07
	for ;
	Thu,  6 May 2004 12:44:45 -0300 (ADT)
Received: from web13125.mail.yahoo.com (web13125.mail.yahoo.com
	[216.136.174.143])
	by svr1.postgresql.org (Postfix) with SMTP id B5A4AD1F2C9
	for ;
	Thu,  6 May 2004 12:44:44 -0300 (ADT)
Message-ID: <20040506154443.82425.qmail@web13125.mail.yahoo.com>
Received: from [63.78.248.48] by web13125.mail.yahoo.com via HTTP;
	Thu, 06 May 2004 08:44:43 PDT
Date: Thu, 6 May 2004 08:44:43 -0700 (PDT)
From: Litao Wu 
Subject: Re: pg_stat
To: Litao Wu , pgsql-performance@postgresql.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=
X-Spam-Level: 
X-Archive-Number: 200405/50
X-Sequence-Number: 6881

All,

Since I have not seen any follow up post,
I am wondering if my question is not clear or
what.

Anyway, my postgres version is 7.3.2, and I
want to know:
1. How to determine if some of indexes are used by
any queries, like Oracle's:
alter index my_index monitoring usage
2. The relationship between 
"number of index scans done" and 
"Number of disk block fetch requests for index"
as shown in the query.

Thank you!
 
--- Litao Wu  wrote:
> Hi,
> 
> I have query:
> select pg_stat_get_numscans(76529669),
> pg_stat_get_blocks_fetched(76529669), 
> pg_stat_get_blocks_hit(76529669);
> 
> The result is:
>  pg_stat_get_numscans | pg_stat_get_blocks_fetched |
> pg_stat_get_blocks_hit
>
----------------------+----------------------------+------------------------
>                     0 |                      23617 |
>  
>                23595
> (1 row)
> 
> My questions are:
> 1. How can index disk blocks be requested (either 
> from disk or cache) without index scan?
> 2. If I want to check if an index is used after 
> pg_stat_reset(), how can I get it? By number of
> scans
> or block requests, or some other ways?
> 
> Thanks,
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Win a $20,000 Career Makeover at Yahoo! HotJobs  
> http://hotjobs.sweepstakes.yahoo.com/careermakeover 
> 



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

From pgsql-performance-owner@postgresql.org  Thu May  6 15:11:02 2004
X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org
Received: from localhost (unknown [200.46.204.2])
	by svr1.postgresql.org (Postfix) with ESMTP id 1649CD1EB31
	for ;
	Thu,  6 May 2004 15:11:02 -0300 (ADT)
Received: from svr1.postgresql.org ([200.46.204.71])
	by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024)
	with ESMTP id 85942-08
	for ;
	Thu,  6 May 2004 15:10:41 -0300 (ADT)
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 7BD37D1F30E
	for ;
	Thu,  6 May 2004 15:10:40 -0300 (ADT)
Received: from mwynhau.demon.co.uk ([193.237.186.96]
 helo=mainbox.archonet.com)
	by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1)
	id 1BLnKS-000F7N-0Z; Thu, 06 May 2004 19:10:40 +0100
Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17])
	by mainbox.archonet.com (Postfix) with ESMTP
	id 21065167FA; Thu,  6 May 2004 19:10:39 +0100 (BST)
Message-ID: <409A7FA0.50704@archonet.com>
Date: Thu, 06 May 2004 19:10:40 +0100
From: Richard Huxton 
User-Agent: Mozilla Thunderbird 0.6 (X11/20040502)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= 
Cc: pgsql-performance@postgresql.org
Subject: Re: INSERT RULE
References: 
	
In-Reply-To: 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=
X-Spam-Level: 
X-Archive-Number: 200405/51
X-Sequence-Number: 6882

Pailloncy Jean-G�rard wrote:
>> I try to do:
>> CREATE RULE ndicti AS ON INSERT TO ndict
>>     DO INSTEAD INSERT INTO 'ndict_' || (NEW.word_id & 255)
>>     VALUES( NEW.url_id, NEW.word_id, NEW.intag);
>> I got an error on 'ndict_' .
>> I did not found the right syntax.
> 
> In fact I discover that
> SELECT * FROM / INSERT INTO table
> doesn't accept function that returns the name of the table as table, but 
> only function that returns rows....
> 
> I'm dead.
> 
> Does this feature, is possible or plan ?
> Is there a trick to do it ?

You could call a plpgsql function and inside that use EXECUTE (or use 
pltcl or some other interpreted language).

Not sure what you're doing will help you much though. Are you aware that 
you can have partial indexes?

CREATE INDEX i123 ON ndict WHERE (word_id & 255)=123;

That might be what you're after, but it's difficult to be sure without 
knowing what problem you're trying to solve.
-- 
   Richard Huxton
   Archonet Ltd

From pgsql-advocacy-owner@postgresql.org  Thu May  6 19:30:10 2004
X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org
Received: from localhost (unknown [200.46.204.2])
	by svr1.postgresql.org (Postfix) with ESMTP
	id 567F8D1EAE3; Thu,  6 May 2004 19:30:08 -0300 (ADT)
Received: from svr1.postgresql.org ([200.46.204.71])
	by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024)
	with ESMTP id 84388-04; Thu,  6 May 2004 19:29:39 -0300 (ADT)
Received: from linuxworld.com.au (unknown [203.34.46.50])
	by svr1.postgresql.org (Postfix) with ESMTP
	id C9D11D1EBCA; Thu,  6 May 2004 19:29:24 -0300 (ADT)
Received: from localhost (swm@localhost)
	by linuxworld.com.au (8.11.6/8.11.4) with ESMTP id i46MTBx15440;
	Fri, 7 May 2004 08:29:11 +1000
Date: Fri, 7 May 2004 08:29:11 +1000 (EST)
From: Gavin Sherry 
To: Shridhar Daithankar 
Cc: PostgreSQL Advocacy ,
	pgsql-performance@postgresql.org
Subject: Re: [PERFORM] [OFF-TOPIC] - Known maximum size of
In-Reply-To: <4099FAAD.4040202@frodo.hserus.net>
Message-ID: 
References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote>
	<1083791489.11496.23.camel@localhost.localdomain>
	<4099996E.90903@familyhealth.com.au>
	<4099F396.2020103@archonet.com> <4099FAAD.4040202@frodo.hserus.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=windows-1252
Content-Transfer-Encoding: QUOTED-PRINTABLE
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=
X-Spam-Level: 
X-Archive-Number: 200405/55
X-Sequence-Number: 4331

On Thu, 6 May 2004, Shridhar Daithankar wrote:

> Richard Huxton wrote:
>
> > Christopher Kings-Lynne wrote:
> >
> >>>> What's the case of bigger database PostgreSQL (so greate and amount =
of
> >>>> registers) that they know???
> >> Didn't someone say that RedSheriff had a 10TB postgres database or
> >> something?
> >  From http://www.redsheriff.com/us/news/news_4_201.html
> >
> > "According to the company, RedSheriff processes 10 billion records a
> > month and the total amount of data managed is more than 32TB. Griffin
> > said PostgreSQL has been in production for 12 months with not a single
> > database fault in that time =93The stability of the database can not be
> > questioned. Needless to say, we are extremely happy."
> >
> > I think it's safe to assume this is not on a spare Dell 600SC though.
> >
>
> I think we should have a case study for that. And publish it on our regul=
ar
> news/press contacts(Can't imagine the flame war on /...Umm Yummy..:-)). I=
t would
> make a lot of noise and gain visibility for us.
>
> Of course Red Sherrif need to co-operate and spell the details and/or mod=
erate
> what we write, but all in all, 32TB database is uber-cool..:-)

I've tried contacting them. They will not return my phone calls or emails.

Gavin

From pgsql-performance-owner@postgresql.org  Fri May  7 07:58:04 2004
X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org
Received: from localhost (unknown [200.46.204.2])
	by svr1.postgresql.org (Postfix) with ESMTP id F21A8D1EDA3
	for ;
	Fri,  7 May 2004 07:58:02 -0300 (ADT)
Received: from svr1.postgresql.org ([200.46.204.71])
	by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024)
	with ESMTP id 09375-10
	for ;
	Fri,  7 May 2004 07:57:45 -0300 (ADT)
Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120])
	by svr1.postgresql.org (Postfix) with ESMTP id 06FAFD1F355
	for ;
	Fri,  7 May 2004 07:56:59 -0300 (ADT)
Received: from notnot (gateway.census.gov.ph [203.172.28.97])
	by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id i47Asbh9012448
	for ; Fri, 7 May 2004 18:54:40 +0800
Message-Id: <200405071054.i47Asbh9012448@mail.census.gov.ph>
From: "Michael Ryan S. Puncia" 
To: 
Subject: Help how to tune-up my Database
Date: Fri, 7 May 2004 19:07:23 +0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0000_01C43466.878B7A30"
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
Thread-Index: AcQ0I3k6or6eZhOKT3GCg8wYDiLHkg==
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-MailScanner: Found to be clean by NSO mail server.
X-Virus-Scanned: by amavisd-new at postgresql.org
X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_70_80,
	HTML_MESSAGE
X-Spam-Level: 
X-Archive-Number: 200405/53
X-Sequence-Number: 6884

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C43466.878B7A30
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi,

            I am a newbie here and just starting to use postgresql. My
problems is how to tune up my server because it its too slow.

We just ported from DBF to postgresql.

 

This is my PC specs: P4, 512Ram, Linux 9

 

Because I am working in a statistical organization we have a very large data
volume

These are my data:

 

Table 1 with 60 million data but only with 10 fields

Table 2 with 30 million data with 15 fields

Table 3 with 30 million data with 10 fields

 

I will only use this server for querying ... I already read and apply those
articles found in the archives section but still the performance is not
good.

I am planning to add another 512 RAM .Another question is how to calculate
shared_buffer size ..

 

Thanks a lot and hoping for your kind answers ..

 

Michael Puncia

Philippines

 

 

 

 

                                   

 


------=_NextPart_000_0000_01C43466.878B7A30
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable















Hi,

         &n= bsp;  I am a newbie here and just starting to use postgresql. My problems is how to tune up my server because it its too slow.

We just ported from DBF to postgresql.=

 

This is my PC specs: P4, 512Ram, Linux 9

 

Because I am working in a statistical organization we ha= ve a very large data volume

These are my data:

 

Table 1 with 60 million data but only with 10 fields

Table 2 with 30 million data with 15 fields

Table 3 with 30 million data with 10 fields

 

I will only use this server for querying ….. I alr= eady read and apply those articles found in the archives section but still the performance is not good.

I am planning to add another 512 RAM …Another ques= tion is how to calculate shared_buffer size ..

 

Thanks a lot and hoping for your kind answers ..

 

Michael Puncia

= Philippines

 

 

 

 

         &n= bsp;            = ;            

 

------=_NextPart_000_0000_01C43466.878B7A30-- From pgsql-performance-owner@postgresql.org Fri May 7 13:01:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 304F1D1F462 for ; Fri, 7 May 2004 13:01:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 34478-02 for ; Fri, 7 May 2004 13:00:55 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 9E110D1F45D for ; Fri, 7 May 2004 13:00:54 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i47FxiN6029371; Fri, 7 May 2004 09:59:45 -0600 (MDT) Date: Fri, 7 May 2004 10:00:03 -0600 (MDT) From: "scott.marlowe" To: "Michael Ryan S. Puncia" Cc: Subject: Re: Help how to tune-up my Database In-Reply-To: <200405071054.i47Asbh9012448@mail.census.gov.ph> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/54 X-Sequence-Number: 6885 On Fri, 7 May 2004, Michael Ryan S. Puncia wrote: > Hi, > > I am a newbie here and just starting to use postgresql. My > problems is how to tune up my server because it its too slow. First, read this: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > This is my PC specs: P4, 512Ram, Linux 9 get more ram. Hard Drives: interface, how many, RAID??? For a mostly read database IDEs are pretty good. Having multiple drives in a RAID-5 or RAID1+0 works well on a mostly read database too. Keep the stripe size small is setting up a RAID array for a database. > Because I am working in a statistical organization we have a very large data > volume > > These are my data: > > > > Table 1 with 60 million data but only with 10 fields > > Table 2 with 30 million data with 15 fields > > Table 3 with 30 million data with 10 fields That's not really that big, but it's big enough you have to make sure your server is tuned properly. > I will only use this server for querying ... I already read and apply those > articles found in the archives section but still the performance is not > good. > > I am planning to add another 512 RAM .Another question is how to calculate > shared_buffer size .. I'm assuming you've recently vacuumed full and analyzed your database... Shared buffers should probably be between 1000 and 10000 on about 98% of all installations. Setting it higher than 25% of memory is usually a bad idea. Since they're in 8k blocks (unless you compiled with a customer block size, you'd know if you did, it's not something you can accidentally do by leaning on the wrong switch...) you probably want about 10000 blocks or so to start, which will give you about 80 megs of shared buffer. PostgreSQL doesn't really cache as well as the kernel, so it's better to leave more memory available for kernel cache than you allocate to buffer cache. On a machine with only 512Meg, I'm guessing you'll get about 128 to 200 megs of kernel cache if you're only running postgresql and you have it set to 10000 buffers. The important things to check / set are things lik effective_cache_size. It too is measured in 8k blocks, and reflects the approximate amount of kernel cache being dedicated to postgresql. assuming a single service postgresql only box, that will be the number that a server that's been up for a while shows under top like so: 9:50am up 12:16, 4 users, load average: 0.00, 0.00, 0.00 104 processes: 102 sleeping, 2 running, 0 zombie, 0 stopped CPU states: 0.7% user, 0.3% system, 0.0% nice, 1.7% idle Mem: 512924K av, 499248K used, 13676K free, 0K shrd, 54856K buff Swap: 2048248K av, 5860K used, 2042388K free 229572K cached the 229572k cached entry shows about 230 megs. divided by 8192 we get about 28000. sort_mem might do with a small bump, especially if you're only handling a few connections at a time. Be careful, it's per sort, and measured in megs, so it's easy for folks to set it too high and make their machine start flushing too much kernel cache, which will slow down the other backends that have to go to disk for data. A good starting point for testing is anywhere from 8192 to 32768. 32768 is 32 megs, which can starve a machine as small as yours if there are a couple of queries each running a couple of sorts on large sets at the same time. Lastly, using explain analyze you can see if postgresql is making a bad plan choice. compared estimated rows to actual rows. Look for things like nested loops being run on what the planner thinks will be 80 rows but is, in fact, 8000 rows. You can change random page cost to change the tendency of the server to favor seq scans to index scans. Lower = greater tendency towards index scans. the default is 4, but most production servers with enough memory to cache most of their data will run well on a setting of 1.2 to 1.4. My dual 2800 with 2 gig ram runs quite well at 1.3 to 1.4. You can also change the settings to random_page_cost, as well as turning off options to the planner with the following env vars: enable_hashagg enable_hashjoin enable_indexscan enable_mergejoin enable_nestloop enable_seqscan enable_sort enable_tidscan They are all on by default, and shouldn't really be turned off by default for the most part. but for an individual session to figure out if the query planner is making the right plan you can set them to off to see if using another plan works better. so, if you've got a nested loop running over 80000 rows that the planner thought was gonna be 80 rows, you can force it to stop using the nested loop for your session with: set enable_nestloop=off; and use explain analyze to see if it runs faster. You can set effective_cache_size and sort_mem on the fly for a single connection, or set them in postgresql.conf and restart or reload to make a change in the default. shared_buffers is set on postgresql startup, and can't be changed without restarting the database. Reloading won't do it. From pgsql-performance-owner@postgresql.org Mon May 10 16:49:53 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CC5C0D1BAD8 for ; Fri, 7 May 2004 14:17:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 47590-10 for ; Fri, 7 May 2004 14:16:47 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id E8FD1D1F4AB for ; Fri, 7 May 2004 14:16:46 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i47HGkSx020806 for ; Fri, 7 May 2004 17:16:46 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i47Gl9i1082798 for pgsql-performance@postgresql.org; Fri, 7 May 2004 16:47:09 GMT From: Bricklen User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Help how to tune-up my Database References: <200405071054.i47Asbh9012448@mail.census.gov.ph> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 10 Message-ID: Date: Fri, 07 May 2004 16:47:09 GMT To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200405/63 X-Sequence-Number: 6894 scott.marlowe wrote: > sort_mem might do with a small bump, especially if you're only handling a > few connections at a time. Be careful, it's per sort, and measured in > megs, so it's easy for folks to set it too high and make their machine > start flushing too much kernel cache, which will slow down the other > backends that have to go to disk for data. http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html (under "Memory"), it says that sort_mem is set in KB. Is this document wrong (or outdated)? From pgsql-performance-owner@postgresql.org Fri May 7 20:47:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6C57BD1E9C7 for ; Fri, 7 May 2004 20:47:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 70664-07 for ; Fri, 7 May 2004 20:46:53 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 22AF5D1EE73 for ; Fri, 7 May 2004 20:46:50 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i47NkkSx041426 for ; Fri, 7 May 2004 23:46:46 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i47NZrt8023405 for pgsql-performance@postgresql.org; Fri, 7 May 2004 23:35:53 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.performance Subject: Re: [OFF-TOPIC] - Known maximum size of the Date: Sat, 08 May 2004 01:35:44 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 25 Message-ID: <409C1D50.4010602@bigfoot.com> References: <034d01c44b2e$ae9b2b00$cf00a8c0@smannote> <1083791489.11496.23.camel@localhost.localdomain> <4099996E.90903@familyhealth.com.au> <4099F396.2020103@archonet.com> <6.1.0.6.0.20040506094353.01b363c8@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Don Vaillancourt User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en In-Reply-To: <6.1.0.6.0.20040506094353.01b363c8@localhost> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/55 X-Sequence-Number: 6886 Don Vaillancourt wrote: > > Here's a question a little off-topic. > > What would a 32TB database hardware configuration look like. I'm > assuming 200GB hard-drives which would total 160 of them. Double that > if you mirror them. > > Am I correct? Why do you have to mirror them ? Usually a SAN make data redundancy using a RAID 4 or 5, this depend if you need read performances or write performances, in the case of Red Sherif I guess that guys are using RAID 50 ( 0 + 5 ) sets so what you "waste" is a disk for each set. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Mon May 10 11:00:13 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 26E23D1F0D7 for ; Mon, 10 May 2004 11:00:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38544-08 for ; Mon, 10 May 2004 10:59:53 -0300 (ADT) Received: from ibague.terra.com.br (ibague.terra.com.br [200.154.55.225]) by svr1.postgresql.org (Postfix) with ESMTP id 23260D1E6A7 for ; Mon, 10 May 2004 10:59:49 -0300 (ADT) Received: from pasto.terra.com.br (pasto.terra.com.br [200.154.55.137]) by ibague.terra.com.br (Postfix) with ESMTP id CF49AEC161 for ; Mon, 10 May 2004 10:59:52 -0300 (BRT) Received: from suport01 (mlsrj200152101p142.mls.com.br [200.152.101.142]) (authenticated user teouique) by pasto.terra.com.br (Postfix) with ESMTP id 06A5F3C00A for ; Mon, 10 May 2004 10:59:51 -0300 (BRT) Message-ID: <00b901c43697$333ec5d0$5f00a8c0@suport01> From: "Anderson Boechat Lopes" To: Subject: Why queries takes too much time to execute? Date: Mon, 10 May 2004 11:00:43 -0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00B6_01C4367E.0A0A8FA0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=HTML_40_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/56 X-Sequence-Number: 6887 This is a multi-part message in MIME format. ------=_NextPart_000_00B6_01C4367E.0A0A8FA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi. I=B4m new here and i=B4m not sure if this is the right email to solve m= y problem. Well, i have a very large database, with vary tables and very registers= . Every day, too many operations are perfomed in that DB, with queries that= insert, delete and update. Once a week some statistics are collected using= vacuum analyze. =20=20=20=20 The problem is after a period of time (one month, i think), the queries= takes too much time to perform. A simple update can take 10 seconds or mor= e to perform. If i make a backup, drop and recreate the DB, everything goes back norm= al. Could anyone give me any guidance? ------=_NextPart_000_00B6_01C4367E.0A0A8FA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
    Hi.
 
    I=B4m n= ew here and=20 i=B4m not sure if this is the right email to solve my problem.
 
    Well, i= have a=20 very large database, with vary tables and very registers. Every day, t= oo=20 many operations are perfomed in that DB, with queries that insert, delete a= nd=20 update. Once a week some statistics are collected using vacuum=20 analyze.
    =
    The pro= blem is=20 after a period of time (one month, i think), the queries takes too muc= h=20 time to perform. A simple update can take 10 seconds or more to=20 perform.
 
    If i ma= ke a=20 backup, drop and recreate the DB, everything goes back=20 normal.
 
    Could= =20 anyone give me any guidance?
------=_NextPart_000_00B6_01C4367E.0A0A8FA0-- From pgsql-performance-owner@postgresql.org Mon May 10 11:22:09 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 15762D1E5E7 for ; Mon, 10 May 2004 11:22:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 33197-08 for ; Mon, 10 May 2004 11:21:51 -0300 (ADT) Received: from frodo.hserus.net (frodo.hserus.net [204.74.68.40]) by svr1.postgresql.org (Postfix) with ESMTP id 57AF8D1F17F for ; Mon, 10 May 2004 11:21:47 -0300 (ADT) Received: from concord.pspl.co.in ([202.54.11.72]:65027 helo=frodo.hserus.net) by frodo.hserus.net with asmtp (Cipher TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.33 #1) id 1BNBfC-000AB6-94 by authid with plain; Mon, 10 May 2004 19:51:50 +0530 Message-ID: <409F8FFB.1010708@frodo.hserus.net> Date: Mon, 10 May 2004 19:51:47 +0530 From: Shridhar Daithankar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Anderson Boechat Lopes Cc: pgsql-performance@postgresql.org Subject: Re: Why queries takes too much time to execute? References: <00b901c43697$333ec5d0$5f00a8c0@suport01> In-Reply-To: <00b901c43697$333ec5d0$5f00a8c0@suport01> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/57 X-Sequence-Number: 6888 Anderson Boechat Lopes wrote: > Hi. > > I�m new here and i�m not sure if this is the right email to solve my > problem. > > Well, i have a very large database, with vary tables and very > registers. Every day, too many operations are perfomed in that DB, with > queries that insert, delete and update. Once a week some statistics are > collected using vacuum analyze. i guess you need to run it much more frequently than that. Thought you haven't given actual size of data etc., once or twice per day should be much better. > > The problem is after a period of time (one month, i think), the > queries takes too much time to perform. A simple update can take 10 > seconds or more to perform. You need to vacuum full once in a while and setup FSM parameters correctly. > > If i make a backup, drop and recreate the DB, everything goes back > normal. > > Could anyone give me any guidance? Check following for basic performance tuning http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html HTH Shridhar From pgsql-performance-owner@postgresql.org Mon May 10 11:24:41 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E3BC5D1E6A7 for ; Mon, 10 May 2004 11:24:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41256-04 for ; Mon, 10 May 2004 11:24:23 -0300 (ADT) Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) by svr1.postgresql.org (Postfix) with ESMTP id 21891D1E60E for ; Mon, 10 May 2004 11:24:19 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 153F5101408; Mon, 10 May 2004 22:24:21 +0800 (WST) Received: from [192.168.1.9] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan02.westnet.com.au (Postfix) with ESMTP id 9C2F010112F; Mon, 10 May 2004 22:24:20 +0800 (WST) Message-ID: <409F9098.20700@familyhealth.com.au> Date: Mon, 10 May 2004 22:24:24 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Anderson Boechat Lopes Cc: pgsql-performance@postgresql.org Subject: Re: Why queries takes too much time to execute? References: <00b901c43697$333ec5d0$5f00a8c0@suport01> In-Reply-To: <00b901c43697$333ec5d0$5f00a8c0@suport01> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/58 X-Sequence-Number: 6889 > Well, i have a very large database, with vary tables and very > registers. Every day, too many operations are perfomed in that DB, with > queries that insert, delete and update. Once a week some statistics are > collected using vacuum analyze. Have vacuum analyze running once an HOUR if it's very busy. If you are using 7.4, run the pg_autovacuum daemon that's in contrib/pg_autovacuum. > The problem is after a period of time (one month, i think), the > queries takes too much time to perform. A simple update can take 10 > seconds or more to perform. If running vacuum analyze once an hour doesn't help, try running a vacuum full once a week or something to fix the problem. Also, try upgrading to 7.4 which has indexes that won't suffer from bloat. Chris From pgsql-performance-owner@postgresql.org Mon May 10 14:36:15 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3721DD1B179 for ; Mon, 10 May 2004 14:36:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 26290-06 for ; Mon, 10 May 2004 14:35:42 -0300 (ADT) Received: from leticia.terra.com.br (leticia.terra.com.br [200.154.55.226]) by svr1.postgresql.org (Postfix) with ESMTP id 459EAD1B181 for ; Mon, 10 May 2004 14:35:38 -0300 (ADT) Received: from talara.terra.com.br (talara.terra.com.br [200.154.55.136]) by leticia.terra.com.br (Postfix) with ESMTP id EBFC73C863 for ; Mon, 10 May 2004 14:35:33 -0300 (BRT) Received: from suport01 (mlsrj200152101p142.mls.com.br [200.152.101.142]) (authenticated user teouique) by talara.terra.com.br (Postfix) with ESMTP id 85A553C093 for ; Mon, 10 May 2004 14:35:32 -0300 (BRT) Message-ID: <00d401c436b5$5b03e960$5f00a8c0@suport01> From: "Anderson Boechat Lopes" To: References: <00b901c43697$333ec5d0$5f00a8c0@suport01> <409F8FFB.1010708@frodo.hserus.net> Subject: Re: Why queries takes too much time to execute? Date: Mon, 10 May 2004 14:36:39 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/59 X-Sequence-Number: 6890 Hum... now i think i�m beginning to understand. The vacuum analyse is recommended to perform at least every day, after adding or deleting a large number of records, and not vacuum full analyse. I�ve performed the vacuum full analyse every day and after some time i�ve noticed the database was corrupted. I couldn�t select anything any more. Do you think if i perform vacuum analyse once a day and perform vacuum full analyse once a week, i will get to fix this problem? Thanks for help me, folks. PS: Sorry for my grammar mistakes. My writting is not so good. :) ----- Original Message ----- From: "Shridhar Daithankar" To: "Anderson Boechat Lopes" Cc: Sent: Monday, May 10, 2004 11:21 AM Subject: Re: [PERFORM] Why queries takes too much time to execute? > Anderson Boechat Lopes wrote: > > Hi. > > > > I�m new here and i�m not sure if this is the right email to solve my > > problem. > > > > Well, i have a very large database, with vary tables and very > > registers. Every day, too many operations are perfomed in that DB, with > > queries that insert, delete and update. Once a week some statistics are > > collected using vacuum analyze. > > i guess you need to run it much more frequently than that. Thought you haven't > given actual size of data etc., once or twice per day should be much better. > > > > The problem is after a period of time (one month, i think), the > > queries takes too much time to perform. A simple update can take 10 > > seconds or more to perform. > > You need to vacuum full once in a while and setup FSM parameters correctly. > > > > If i make a backup, drop and recreate the DB, everything goes back > > normal. > > > > Could anyone give me any guidance? > > Check following for basic performance tuning > > http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html > > HTH > > Shridhar > > From pgsql-performance-owner@postgresql.org Mon May 10 16:17:56 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5618DD1B1CE for ; Mon, 10 May 2004 16:17:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 18268-03 for ; Mon, 10 May 2004 16:17:28 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 561DCD1B196 for ; Mon, 10 May 2004 16:17:26 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4AJHPSx045023 for ; Mon, 10 May 2004 19:17:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4AJA9eB039439 for pgsql-performance@postgresql.org; Mon, 10 May 2004 19:10:10 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Why queries takes too much time to execute? Date: Mon, 10 May 2004 14:11:21 -0400 Organization: cbbrowne Computing Inc Lines: 43 Message-ID: <60llk05f06.fsf@dev6.int.libertyrms.info> References: <00b901c43697$333ec5d0$5f00a8c0@suport01> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110002 (No Gnus v0.2) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:yhcih0Taht1Fj6m7FEZOe9EMeP0= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/62 X-Sequence-Number: 6893 teouique@terra.com.br ("Anderson Boechat Lopes") writes: > ��� I�m new here and i�m not sure if this is the right email to > solve my problem. This should be OK... > ��� Well, i have a very large database, with vary tables and very > registers. Every day,�too many operations are perfomed in that DB, > with queries that insert, delete and update. Once a week some > statistics are collected using vacuum analyze. > > ��� The problem is after�a period of time (one month, i think), the > queries takes too much time to perform.�A simple update can take 10 > seconds or more to perform. It seems fairly likely that two effects are coming in... -> The tables that are being updated have lots of dead tuples. -> The vacuums aren't doing much good because the number of dead tuples is so large that you blow out the FSM (Free Space Map), and thus they can't free up space. -> Another possibility is that if some tables shrink to small size, and build up to large size (we see this with the _rserv_log_1_ and _rserv_log_2_ tables used by the eRServ replication system), the statistics may need to be updated a LOT more often. You might want to consider running VACUUM a whole lot more often than once a week. If there is any regular time that the system isn't terribly busy, you might want to vacuum some or all tables at that time. pg_autovacuum might be helpful; it will automatically do vacuums on tables when they have been updated heavily. There may be more to your problem, but VACUUMing more would allow us to get rid of "too many dead tuples around" as a cause. -- "cbbrowne","@","acm.org" http://cbbrowne.com/info/x.html Would-be National Mottos: USA: "There oughta' be a law!" From pgsql-performance-owner@postgresql.org Mon May 10 15:54:37 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0FD86D1B1CA for ; Mon, 10 May 2004 15:54:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 74886-09 for ; Mon, 10 May 2004 15:54:15 -0300 (ADT) Received: from black.geophile.com (h004005242b8e.ne.client2.attbi.com [24.91.49.146]) by svr1.postgresql.org (Postfix) with ESMTP id E6651D1B17C for ; Mon, 10 May 2004 15:54:10 -0300 (ADT) Received: from black.geophile.com (localhost.localdomain [127.0.0.1]) by black.geophile.com (8.12.8/8.12.8) with ESMTP id i4AIqAxY017486 for ; Mon, 10 May 2004 14:52:10 -0400 Received: (from apache@localhost) by black.geophile.com (8.12.8/8.12.8/Submit) id i4AIq9tP017484 for pgsql-performance@postgresql.org; Mon, 10 May 2004 14:52:09 -0400 X-Authentication-Warning: black.geophile.com: apache set sender to jao@geophile.com using -f Received: from 64.119.142.34 ([64.119.142.34]) by geophile.com (IMP) with HTTP for ; Mon, 10 May 2004 14:52:09 -0400 Message-ID: <1084215129.409fcf597e163@geophile.com> Date: Mon, 10 May 2004 14:52:09 -0400 From: jao@geophile.com To: pgsql-performance@postgresql.org Subject: Configuring PostgreSQL to minimize impact of checkpoints MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Originating-IP: 64.119.142.34 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200405/60 X-Sequence-Number: 6891 My company is developing a PostgreSQL application. We're using 7.3.4 but will soon upgrade to 7.4.x. Our OS is RedHat 9. Our production machines have 512 MB RAM and IDE disks. So far we've been using default configuration settings, but I have started to examine performance and to modify these settings. Our typical transaction involves 5-10 SELECT, INSERT or UPDATEs, (usually 1/2 SELECT and the remainder a mixture of INSERT and UPDATE). There are a few aggregation queries which need to scan an entire table. We observed highly uneven performance for the small transactions. A transaction usually runs in under 100 msec, but we would see spikes as high as 40,000 msec. These spikes occurred regularly, every 4-5 minutes, and I speculated that checkpointing might be the issue. I created a test case, based on a single table: create table test( id int not null, count int not null, filler varchar(200), primary key(id)) I loaded a database with 1,000,000 rows, with the filler column always filled with 200 characters. I then ran a test in which a random row was selected, and the count column incremented. Each transaction contained ten such updates. In this test, I set shared_buffers = 2000 checkpoint_segments = 40 checkpoint_timeout = 600 wal_debug = 1 I set checkpoint_segments high because I wanted to see whether the spikes correlated with checkpoints. Most transactions completed in under 60 msec. Approximately every 10th transaction, the time went up to 500-600 msec, (which is puzzling, but not my major concern). I did see a spike every 10 minutes, in which transaction time goes up to 5000-8000 msec. The spikes were correlated with checkpoint activity, occurring slightly before a log entry that looks like this: 2004-05-09 16:34:19 LOG: INSERT @ 2/C2A0F628: prev 2/C2A0F5EC; xprev 0/0; xid 0: XLOG - checkpoint: redo 2/C2984D4C; undo 0/0; sui 36; xid 1369741; oid 6321782; online Questions: 1. Can someone provide an overview of checkpoint processing, to help me understand the performance issues? 2. Is the spike due to the checkpoint process keeping the disk busy? Or is there some locking involved that blocks my application until the checkpoint completes? 3. The spikes are quite problematic for us. What can I do to minimize the impact of checkpointing on my application? I understand how checkpoint_segments and checkpoint_timeout determine when a checkpoint occurs; what can I do to lessen the impact of a checkpoint? 4. I understand that a "background writer" is being contemplated for 7.5. Will that replace or augment the checkpoint process? Any comments on how that work will apply to my problem would be appreciated. I wouldn't mind seeing the average performance, (without the spikes) go up -- let's say -- 10%, in exchange for more uniform performance. These spikes are a real problem. Jack Orenstein ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From pgsql-performance-owner@postgresql.org Mon May 10 16:10:02 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 11D25D1B176 for ; Mon, 10 May 2004 16:09:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02680-04 for ; Mon, 10 May 2004 16:09:35 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 0B940D1B1A1 for ; Mon, 10 May 2004 16:09:32 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4AJ9Wv09415; Mon, 10 May 2004 15:09:32 -0400 (EDT) From: Bruce Momjian Message-Id: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-Reply-To: <1084215129.409fcf597e163@geophile.com> To: jao@geophile.com Date: Mon, 10 May 2004 15:09:32 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/61 X-Sequence-Number: 6892 jao@geophile.com wrote: > 4. I understand that a "background writer" is being contemplated for > 7.5. Will that replace or augment the checkpoint process? Any > comments on how that work will apply to my problem would be > appreciated. I wouldn't mind seeing the average performance, > (without the spikes) go up -- let's say -- 10%, in exchange for > more uniform performance. These spikes are a real problem. The background writer is designed to address your specific problem. We will stil checkpoint, but the spike should be greatly minimized. -- 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 Mon May 10 17:00:21 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6F824D1B1E5 for ; Mon, 10 May 2004 17:00:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 96326-02 for ; Mon, 10 May 2004 16:59:46 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 4579AD1B1EE for ; Mon, 10 May 2004 16:59:44 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4AJxHuX027617; Mon, 10 May 2004 13:59:17 -0600 (MDT) Date: Mon, 10 May 2004 13:59:12 -0600 (MDT) From: "scott.marlowe" To: Anderson Boechat Lopes Cc: Subject: Re: Why queries takes too much time to execute? In-Reply-To: <00d401c436b5$5b03e960$5f00a8c0@suport01> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/64 X-Sequence-Number: 6895 On Mon, 10 May 2004, Anderson Boechat Lopes wrote: > Hum... now i think i�m beginning to understand. > > The vacuum analyse is recommended to perform at least every day, after > adding or deleting a large number of records, and not vacuum full analyse. > I�ve performed the vacuum full analyse every day and after some time i�ve > noticed the database was corrupted. I couldn�t select anything any more. Hold it right there, full stop. If you've got corruption you've either found a rare corner case in postgresql (unlikely, corruption is not usually a big problem for postgresql) OR you have bad hardware. Test your RAM, CPUs, and hard drives before going any further. Data corruption, 99% of the time, is not the fault of postgresql but the fault of the hardware. From pgsql-performance-owner@postgresql.org Mon May 10 17:23:59 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6B3A0D1B1E7 for ; Mon, 10 May 2004 17:23:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02853-04 for ; Mon, 10 May 2004 17:23:39 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 4F79AD1B1D6 for ; Mon, 10 May 2004 17:23:36 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4AKNPuX000255; Mon, 10 May 2004 14:23:25 -0600 (MDT) Date: Mon, 10 May 2004 14:23:20 -0600 (MDT) From: "scott.marlowe" To: Bricklen Cc: Subject: Re: Help how to tune-up my Database In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/65 X-Sequence-Number: 6896 Sorry about that, I meant kbytes, not megs. My point being it's NOT measured in 8k blocks, like a lot of other settings. sorry for the mixup. On Fri, 7 May 2004, Bricklen wrote: > scott.marlowe wrote: > > sort_mem might do with a small bump, especially if you're only handling a > > few connections at a time. Be careful, it's per sort, and measured in > > megs, so it's easy for folks to set it too high and make their machine > > start flushing too much kernel cache, which will slow down the other > > backends that have to go to disk for data. > > http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html > (under "Memory"), it says that sort_mem is set in KB. Is this document > wrong (or outdated)? > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > From pgsql-performance-owner@postgresql.org Tue May 11 15:48:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1CDB0D1B1D9 for ; Mon, 10 May 2004 17:47:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 08427-01 for ; Mon, 10 May 2004 17:47:27 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7D5FBD1B1F7 for ; Mon, 10 May 2004 17:47:25 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4AKlPSx004826 for ; Mon, 10 May 2004 20:47:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4AKbK5p085055 for pgsql-performance@postgresql.org; Mon, 10 May 2004 20:37:20 GMT From: Bricklen User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Help how to tune-up my Database References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 7 Message-ID: <6KRnc.32289$LA4.5345@edtnps84> Date: Mon, 10 May 2004 20:37:22 GMT To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200405/74 X-Sequence-Number: 6905 scott.marlowe wrote: > Sorry about that, I meant kbytes, not megs. My point being it's NOT > measured in 8k blocks, like a lot of other settings. sorry for the mixup. > No worries, I just wanted to sort that out for my own benefit, and anyone else who may not have caught that. From pgsql-performance-owner@postgresql.org Mon May 10 23:04:55 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3CC89D1B197 for ; Mon, 10 May 2004 23:04:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 65855-01 for ; Mon, 10 May 2004 23:04:32 -0300 (ADT) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by svr1.postgresql.org (Postfix) with ESMTP id 61091D1B241 for ; Mon, 10 May 2004 23:04:28 -0300 (ADT) Received: from geophile.com ([24.91.49.146]) by comcast.net (sccrmhc13) with SMTP id <2004051102043201600t0sj7e> (Authid: audrey.orenstein); Tue, 11 May 2004 02:04:32 +0000 Message-ID: <40A03435.7020300@geophile.com> Date: Mon, 10 May 2004 22:02:29 -0400 From: Jack Orenstein User-Agent: Mozilla/4.0 (compatible;MSIE 5.5; Windows 98) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruce Momjian Cc: pgsql-performance@postgresql.org Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints References: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> In-Reply-To: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/66 X-Sequence-Number: 6897 Bruce Momjian wrote: > jao@geophile.com wrote: > >>4. I understand that a "background writer" is being contemplated for >>7.5. Will that replace or augment the checkpoint process? Any >>comments on how that work will apply to my problem would be >>appreciated. I wouldn't mind seeing the average performance, >>(without the spikes) go up -- let's say -- 10%, in exchange for >>more uniform performance. These spikes are a real problem. > > > The background writer is designed to address your specific problem. We > will stil checkpoint, but the spike should be greatly minimized. > Thanks. Do you know when 7.5 is expected to be released? Until then, is a workaround known? Also, are the delays I'm seeing out of the ordinary? I'm looking at one case in which two successive transactions, each updating a handful of records, take 26 and 18 *seconds* (not msec) to complete. These transactions normally complete in under 30 msec. Jack Orenstein From pgsql-performance-owner@postgresql.org Mon May 10 23:34:00 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8D903D1B289 for ; Mon, 10 May 2004 23:33:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 70380-01 for ; Mon, 10 May 2004 23:33:41 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 3525CD1B282 for ; Mon, 10 May 2004 23:33:35 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4B2XRN00185; Mon, 10 May 2004 22:33:27 -0400 (EDT) From: Bruce Momjian Message-Id: <200405110233.i4B2XRN00185@candle.pha.pa.us> Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-Reply-To: <40A03435.7020300@geophile.com> To: Jack Orenstein Date: Mon, 10 May 2004 22:33:27 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/67 X-Sequence-Number: 6898 Jack Orenstein wrote: > Bruce Momjian wrote: > > jao@geophile.com wrote: > > > >>4. I understand that a "background writer" is being contemplated for > >>7.5. Will that replace or augment the checkpoint process? Any > >>comments on how that work will apply to my problem would be > >>appreciated. I wouldn't mind seeing the average performance, > >>(without the spikes) go up -- let's say -- 10%, in exchange for > >>more uniform performance. These spikes are a real problem. > > > > > > The background writer is designed to address your specific problem. We > > will stil checkpoint, but the spike should be greatly minimized. > > > > Thanks. Do you know when 7.5 is expected to be released? 3-6 months. > Until then, is a workaround known? Also, are the delays I'm seeing out of the ordinary? > I'm looking at one case in which two successive transactions, each updating a handful of > records, take 26 and 18 *seconds* (not msec) to complete. These transactions normally complete > in under 30 msec. Wow. Others might know the answer to 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 Tue May 11 00:24:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C1B8D1B2A4 for ; Tue, 11 May 2004 00:24:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79032-03 for ; Tue, 11 May 2004 00:23:56 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3F697D1B1A3 for ; Tue, 11 May 2004 00:23:56 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4B3NnOo024639; Mon, 10 May 2004 23:23:49 -0400 (EDT) To: Jack Orenstein Cc: Jan Wieck , pgsql-performance@postgresql.org Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-reply-to: <40A03435.7020300@geophile.com> References: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> <40A03435.7020300@geophile.com> Comments: In-reply-to Jack Orenstein message dated "Mon, 10 May 2004 22:02:29 -0400" Date: Mon, 10 May 2004 23:23:49 -0400 Message-ID: <24638.1084245829@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/68 X-Sequence-Number: 6899 Jack Orenstein writes: > I'm looking at one case in which two successive transactions, each > updating a handful of records, take 26 and 18 *seconds* (not msec) to > complete. These transactions normally complete in under 30 msec. I've seen installations in which it seemed that the "normal" query load was close to saturating the available disk bandwidth, and the extra load imposed by a background VACUUM just pushed the entire system's response time over a cliff. In an installation that has I/O capacity to spare, a VACUUM doesn't really hurt foreground query response at all. I suspect that the same observations hold true for checkpoints, though I haven't specifically seen an installation suffering from that effect. Already-committed changes for 7.5 include a background writer, which basically will "trickle" out dirty pages between checkpoints, thereby hopefully reducing the volume of I/O forced at a checkpoint. We have also got code in place that throttles the rate of I/O requests during VACUUM. It seems like it might be useful to similarly throttle the I/O request rate during a CHECKPOINT, though I'm not sure if there'd be any bad side effects from lengthening the elapsed time for a checkpoint. (Jan, any thoughts here?) None of this is necessarily going to fix matters for an installation that has no spare I/O capacity, though. And from the numbers you're quoting I fear you may be in that category. "Buy faster disks" may be the only answer ... regards, tom lane From pgsql-performance-owner@postgresql.org Tue May 11 10:35:46 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DBC90D1B2AC for ; Tue, 11 May 2004 10:35:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02285-06 for ; Tue, 11 May 2004 10:35:26 -0300 (ADT) Received: from ms-smtp-01.tampabay.rr.com (ms-smtp-01-smtplb.tampabay.rr.com [65.32.5.131]) by svr1.postgresql.org (Postfix) with ESMTP id 23CE0D1B3C4 for ; Tue, 11 May 2004 10:35:22 -0300 (ADT) Received: from MATTSPC (222-60.26-24.tampabay.rr.com [24.26.60.222]) by ms-smtp-01.tampabay.rr.com (8.12.10/8.12.7) with ESMTP id i4BDZLDJ010593; Tue, 11 May 2004 09:35:21 -0400 (EDT) Message-Id: <200405111335.i4BDZLDJ010593@ms-smtp-01.tampabay.rr.com> From: "Matthew Nuzum" To: "'Tom Lane'" , "'Jack Orenstein'" Cc: "'Jan Wieck'" , Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints Date: Tue, 11 May 2004 09:35:18 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQ3CBQeaUbSDu33SNuucpKID0lAlwAU8WpQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 In-Reply-To: <24638.1084245829@sss.pgh.pa.us> X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.2 tagged_above=0.0 required=5.0 tests=EARN_MONEY, RCVD_IN_SORBS X-Spam-Level: * X-Archive-Number: 200405/69 X-Sequence-Number: 6900 > > Jack Orenstein writes: > > I'm looking at one case in which two successive transactions, each > > updating a handful of records, take 26 and 18 *seconds* (not msec) to > > complete. These transactions normally complete in under 30 msec. ... > None of this is necessarily going to fix matters for an installation > that has no spare I/O capacity, though. And from the numbers you're > quoting I fear you may be in that category. "Buy faster disks" may > be the only answer ... > I had a computer once that had an out-of-the-box hard drive configuration that provided horrible disk performance. I found a tutorial at O'Reilly that explained how to use hdparm to dramatically speed up disk performance on Linux. I've noticed on other computers I've set up recently that hdparm seems to be used by default out of the box to give good performance. Maybe your computer is using all of it's I/O capacity because it's using PIO mode or some other non-optimal method of accessing the disk. Just a suggestion, I hope it helps, Matthew Nuzum | ISPs: Make $200 - $5,000 per referral by www.followers.net | recomending Elite CMS to your customers! matt@followers.net | http://www.followers.net/isp From pgsql-performance-owner@postgresql.org Tue May 11 11:42:07 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 43AEAD1B3B2 for ; Tue, 11 May 2004 11:42:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 24247-03 for ; Tue, 11 May 2004 11:41:50 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BEB0CD1B578 for ; Tue, 11 May 2004 11:41:45 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4BEfnFf009759; Tue, 11 May 2004 10:41:49 -0400 (EDT) To: Jan Wieck Cc: Jack Orenstein , pgsql-performance@postgresql.org Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-reply-to: <40A0E069.9000006@Yahoo.com> References: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> <40A03435.7020300@geophile.com> <24638.1084245829@sss.pgh.pa.us> <40A0E069.9000006@Yahoo.com> Comments: In-reply-to Jan Wieck message dated "Tue, 11 May 2004 10:17:13 -0400" Date: Tue, 11 May 2004 10:41:48 -0400 Message-ID: <9758.1084286508@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/70 X-Sequence-Number: 6901 Jan Wieck writes: > If we would combine the background writer and the checkpointer, ... which in fact is on my agenda of things to do ... > then a > "checkpoint flush" could actually be implemented as a temporary change > in that activity that basically is done by not reevaluating the list of > to be flushed blocks any more and switching to a constant amount of > blocks flushed per cycle. When that list get's empty, the checkpoint > flush is done, the checkpoint can complete and the background writer > resumes normal business. Sounds like a plan. I'll do it that way. However, we might want to have different configuration settings controlling the write rate during checkpoint and the rate during normal background writing --- what do you think? Also, presumably a shutdown checkpoint should just whomp out the data without any delays. We can't afford to wait around and risk having init decide we took too long. >> None of this is necessarily going to fix matters for an installation >> that has no spare I/O capacity, though. > As a matter of fact, the background writer increases the overall IO. It > writes buffers that possibly get modified again before a checkpoint or > their replacement requires them to be finally written. So if there is no > spare IO bandwidth, it makes things worse. Right, the trickle writes could be wasted effort. regards, tom lane From pgsql-performance-owner@postgresql.org Tue May 11 12:12:55 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CB4FDD1B9A4 for ; Tue, 11 May 2004 12:12:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 30586-07 for ; Tue, 11 May 2004 12:12:29 -0300 (ADT) Received: from mail.dsvr.co.uk (mail.dsvr.co.uk [212.69.192.8]) by svr1.postgresql.org (Postfix) with ESMTP id E436FD1B3CF for ; Tue, 11 May 2004 12:12:28 -0300 (ADT) Received: from [212.69.216.20] (helo=dsvr.net) by mail.dsvr.co.uk with esmtp (Exim 4.30) id 1BNYvd-00076B-Fd; Tue, 11 May 2004 16:12:21 +0100 Message-ID: <40A0ED54.7050708@dsvr.net> Date: Tue, 11 May 2004 16:12:20 +0100 From: Rob Fielding User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040323 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matthew Nuzum , pgsql-performance@postgresql.org Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints References: <200405111335.i4BDZLDJ010593@ms-smtp-01.tampabay.rr.com> In-Reply-To: <200405111335.i4BDZLDJ010593@ms-smtp-01.tampabay.rr.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/71 X-Sequence-Number: 6902 Matthew Nuzum wrote: >>Jack Orenstein writes: >> >>>I'm looking at one case in which two successive transactions, each >>>updating a handful of records, take 26 and 18 *seconds* (not msec) to >>>complete. These transactions normally complete in under 30 msec. >>None of this is necessarily going to fix matters for an installation >>that has no spare I/O capacity, though. And from the numbers you're >>quoting I fear you may be in that category. "Buy faster disks" may >>be the only answer ... >> > I had a computer once that had an out-of-the-box hard drive configuration > that provided horrible disk performance. I found a tutorial at O'Reilly > that explained how to use hdparm to dramatically speed up disk performance > on Linux. I've noticed on other computers I've set up recently that hdparm > seems to be used by default out of the box to give good performance. > > Maybe your computer is using all of it's I/O capacity because it's using PIO > mode or some other non-optimal method of accessing the disk. There's certainly some scope there. I have an SGI Octane whos SCSI 2 disks were set-up by default with no write buffer and CTQ depth of zero :/ IDE drivers in Linux maybe not detecting your IDE chipset correctly and stepping down, however unlikely there maybe something odd going on but you could check hdparm out. Ensure correct cables too, and the aren't crushed or twisted too bad.... I digress... Assuming you're running with optimal schema and index design (ie you're not doing extra work unnecessarily), and your backend has better-then-default config options set-up (plenty of tips around here), then disk arrangement is critical to smoothing the ride. Taking things to a relative extreme, we implemented a set-up with issues similar sounding to yours. It was resolved by first optimising everything but hardware, then finally optimising hardware. This served us because it meant we squeezed as much out of the available hardware, before finally throwing more at it, getting us the best possible returns (plus further post optimisation on the new hardware). First tip would to take your pg_xlog and put it on another disk (and channel). Next if you're running a journalled fs, get that journal off onto another disk (and channel). Finally, get as many disks for the data store and spread the load across spindles. You're aiming here to distribute the contention and disk I/O more evenly to remove the congestion. sar and iostat help out as part of the analysis. You say you're using IDE, for which I'd highly recommend switching to SCSI and mutliple controllers because IDE isn't great for lots of other reasons. Obviously budgets count, and playing with SCSI certainly limits that. We took a total of 8 disks across 2 SCSI 160 channels and split up the drives into a number of software RAID arrays. RAID0 mirrors for the os, pg_xlog, data disk journal and swap and the rest became a RAID5 array for the data. You could instead implement your DATA disk as RAID1+0 if you wanted more perf at the cost of free space. Anyway, it's certainly not the fastest config out there, but it made all the difference to this particular application. Infact, we had so much free I/O we recently installed another app on there (based on mysql, sorry) which runs concurrently, and itself 4 times faster than it originally did... YMMV, just my 2p. -- Rob Fielding rob@dsvr.net www.dsvr.co.uk Development Designer Servers Ltd From pgsql-performance-owner@postgresql.org Tue May 11 13:55:15 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D7794D1B9BD for ; Tue, 11 May 2004 13:55:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 65045-01 for ; Tue, 11 May 2004 13:54:43 -0300 (ADT) Received: from black.geophile.com (h004005242b8e.ne.client2.attbi.com [24.91.49.146]) by svr1.postgresql.org (Postfix) with ESMTP id 0D4D4D1B3CC for ; Tue, 11 May 2004 13:54:42 -0300 (ADT) Received: from black.geophile.com (localhost.localdomain [127.0.0.1]) by black.geophile.com (8.12.8/8.12.8) with ESMTP id i4BGqXxY025341; Tue, 11 May 2004 12:52:33 -0400 Received: (from apache@localhost) by black.geophile.com (8.12.8/8.12.8/Submit) id i4BGqWdQ025339; Tue, 11 May 2004 12:52:32 -0400 X-Authentication-Warning: black.geophile.com: apache set sender to jao@geophile.com using -f Received: from 64.119.142.34 ([64.119.142.34]) by geophile.com (IMP) with HTTP for ; Tue, 11 May 2004 12:52:32 -0400 Message-ID: <1084294352.40a104d04ad0d@geophile.com> Date: Tue, 11 May 2004 12:52:32 -0400 From: jao@geophile.com To: Rob Fielding Cc: Matthew Nuzum , pgsql-performance@postgresql.org Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints References: <200405111335.i4BDZLDJ010593@ms-smtp-01.tampabay.rr.com> <40A0ED54.7050708@dsvr.net> In-Reply-To: <40A0ED54.7050708@dsvr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Originating-IP: 64.119.142.34 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200405/72 X-Sequence-Number: 6903 Quoting Rob Fielding : > Assuming you're running with optimal schema and index design (ie you're > not doing extra work unnecessarily), and your backend has > better-then-default config options set-up (plenty of tips around here), > then disk arrangement is critical to smoothing the ride. The schema and queries are extremely simple. I've been experimenting with config options. One possibility I'm looking into is whether shared_buffers is too high, at 12000. We have some preliminary evidence that setting it lower (1000) reduces the demand for IO bandwidth to a point where the spikes become almost tolerable. > First tip would to take your pg_xlog and put it on another disk (and > channel). That's on my list of things to try. > Next if you're running a journalled fs, get that journal off > onto another disk (and channel). Finally, get as many disks for the data > store and spread the load across spindles. Dumb question: how do I spread the data across spindles? Do you have a pointer to something I could read? Jack Orenstein ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From pgsql-performance-owner@postgresql.org Tue May 11 14:31:48 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20F9DD1CA39 for ; Tue, 11 May 2004 14:31:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 74627-03 for ; Tue, 11 May 2004 14:31:27 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 24FD5D1C943 for ; Tue, 11 May 2004 14:31:26 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BHUhHs015399; Tue, 11 May 2004 11:30:43 -0600 (MDT) Date: Tue, 11 May 2004 11:30:31 -0600 (MDT) From: "scott.marlowe" To: Cc: Rob Fielding , Matthew Nuzum , Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-Reply-To: <1084294352.40a104d04ad0d@geophile.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/73 X-Sequence-Number: 6904 On Tue, 11 May 2004 jao@geophile.com wrote: > Quoting Rob Fielding : > > > Assuming you're running with optimal schema and index design (ie you're > > not doing extra work unnecessarily), and your backend has > > better-then-default config options set-up (plenty of tips around here), > > then disk arrangement is critical to smoothing the ride. > > The schema and queries are extremely simple. I've been experimenting > with config options. One possibility I'm looking into is whether > shared_buffers is too high, at 12000. We have some preliminary evidence > that setting it lower (1000) reduces the demand for IO bandwidth to > a point where the spikes become almost tolerable. If the shared_buffers are large, postgresql seems to have a performance issue with handling them. Plus they can cause the kernel to dump cache on things that would otherwise be right there and therefore forces the database to hit the drives. You might wanna try settings between 1000 and 10000 and see where your sweet spot is. > > First tip would to take your pg_xlog and put it on another disk (and > > channel). > > That's on my list of things to try. > > > Next if you're running a journalled fs, get that journal off > > onto another disk (and channel). Finally, get as many disks for the data > > store and spread the load across spindles. > > Dumb question: how do I spread the data across spindles? Do you have > a pointer to something I could read? Look into a high quality hardware RAID controller with battery backed cache on board. We use the ami/lsi megaraid and I'm quite pleased with its writing performance. How you configure your drives is up to you. For smaller numbers of drives (6 or less) RAID 1+0 is usually a clear winner. For medium numbers of drives, say 8 to 20, RAID 5 works well. For more drives than that, many folks report RAID 5+0 or 0+5 to work well. I've only played around with 12 or fewer drives, so I'm saying RAID 5+0 is a good choice from my experience, just reflecting back what I've heard here on the performance mailing list. If you're not doing much writing, then a software RAID may be a good intermediate solution, especially RAID1 with >2 disks under linux seems a good setup for a mostly read database. From pgsql-admin-owner@postgresql.org Tue May 11 16:13:26 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20F9ED1D138; Tue, 11 May 2004 16:07:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97889-07; Tue, 11 May 2004 16:07:02 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id A9648D1BAFD; Tue, 11 May 2004 16:06:59 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BNcah-0004iK-00; Tue, 11 May 2004 21:06:59 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BNcah-0000Ux-00; Tue, 11 May 2004 21:06:59 +0200 Message-ID: <40A12452.3040505@turtle-entertainment.de> Date: Tue, 11 May 2004 21:06:58 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: "Pgsql-Admin (E-mail)" Subject: Quad processor options Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/84 X-Sequence-Number: 13400 Hi, I am curious if there are any real life production quad processor setups running postgresql out there. Since postgresql lacks a proper replication/cluster solution, we have to buy a bigger machine. Right now we are running on a dual 2.4 Xeon, 3 GB Ram and U160 SCSI hardware-raid 10. Has anyone experiences with quad Xeon or quad Opteron setups? I am looking at the appropriate boards from Tyan, which would be the only option for us to buy such a beast. The 30k+ setups from Dell etc. don't fit our budget. I am thinking of the following: Quad processor (xeon or opteron) 5 x SCSI 15K RPM for Raid 10 + spare drive 2 x IDE for system ICP-Vortex battery backed U320 Hardware Raid 4-8 GB Ram Would be nice to hear from you. Regards, Bjoern From pgsql-performance-owner@postgresql.org Tue May 11 16:13:05 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A8078D1D23E for ; Tue, 11 May 2004 16:13:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02305-05 for ; Tue, 11 May 2004 16:12:41 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 1FC65D1D272 for ; Tue, 11 May 2004 16:12:37 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Tue, 11 May 2004 12:12:29 -0700 In-Reply-To: <1084294352.40a104d04ad0d@geophile.com> References: <200405111335.i4BDZLDJ010593@ms-smtp-01.tampabay.rr.com> <40A0ED54.7050708@dsvr.net> <1084294352.40a104d04ad0d@geophile.com> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <29010F48-A37F-11D8-A34F-000393BD6C3E@tuckfield.com> Content-Transfer-Encoding: 7bit Cc: Matthew Nuzum , pgsql-performance@postgresql.org, Rob Fielding From: Paul Tuckfield Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints Date: Tue, 11 May 2004 12:12:35 -0700 To: jao@geophile.com X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/75 X-Sequence-Number: 6906 The king of statistics in these cases, is probably vmstat. one can drill down on specific things from there, but first you should send some vmstat output. Reducing cache -> reducing IO suggests to me the OS might be paging out shared buffers. This is indicated by activity in the "si" and "so" columns of vmstat. intentional disk activity by the applciation(postgres) shows up in the "bi" and "bo" columns. If you are having a "write storm" or bursty writes that's burying performance, a scsi raid controler with writeback cache will greatly improve the situation, but I do believe they run around $1-2k. If it's write specific problem, the cache matters more than the striping, except to say that write specfic perf problems should avoid raid5 please send the output of "vmstat 10" for about 10 minutes, spanning good performance and bad performance. On May 11, 2004, at 9:52 AM, jao@geophile.com wrote: > Quoting Rob Fielding : > >> Assuming you're running with optimal schema and index design (ie >> you're >> not doing extra work unnecessarily), and your backend has >> better-then-default config options set-up (plenty of tips around >> here), >> then disk arrangement is critical to smoothing the ride. > > The schema and queries are extremely simple. I've been experimenting > with config options. One possibility I'm looking into is whether > shared_buffers is too high, at 12000. We have some preliminary evidence > that setting it lower (1000) reduces the demand for IO bandwidth to > a point where the spikes become almost tolerable. > >> First tip would to take your pg_xlog and put it on another disk (and >> channel). > > That's on my list of things to try. > >> Next if you're running a journalled fs, get that journal off >> onto another disk (and channel). Finally, get as many disks for the >> data >> store and spread the load across spindles. > > Dumb question: how do I spread the data across spindles? Do you have > a pointer to something I could read? > > Jack Orenstein > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: 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-admin-owner@postgresql.org Tue May 11 16:33:25 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EEACFD1B9A9; Tue, 11 May 2004 16:33:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07469-07; Tue, 11 May 2004 16:33:03 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 91A20D1BA75; Tue, 11 May 2004 16:33:01 -0300 (ADT) Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.242]) by www.postgresql.com (Postfix) with ESMTP id 5920CCF4D6C; Tue, 11 May 2004 16:33:00 -0300 (ADT) 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="UTF-8" Content-Transfer-Encoding: base64 Subject: Re: [PERFORM] Quad processor options Date: Tue, 11 May 2004 15:32:57 -0400 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098228@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Quad processor options Thread-Index: AcQ3jCCYdiFvPLlYQcmfiU3ipTdeGwAAd/0E From: "Anjan Dave" To: "Bjoern Metzdorf" , Cc: "Pgsql-Admin (E-mail)" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/86 X-Sequence-Number: 13402 V2UgdXNlIFhFT04gUXVhZHMgKFBvd2VyRWRnZSA2NjUwcykgYW5kIHRoZXkg d29yayBuaWNlLCBwcm92aWRlZCB5b3UgY29uZmlndXJlIHRoZSBwb3N0Z3Jl cyBwcm9wZXJseS4gRGVsbCBpcyB0aGUgY2hlYXBlc3QgcXVhZCB5b3UgY2Fu IGJ1eSBpIHRoaW5rLiBZb3Ugc2hvdWxkbid0IGJlIHBheWluZyAzMEsgdW5s ZXNzIHlvdSBhcmUgZ2V0dGluZyBoaWdoIENQVS1jYWNoZSBvbiBlYWNoIHBy b2Nlc3NvciBhbmQgdG9ucyBvZiBtZW1vcnkuDQogDQpJIGFtIGFjdHVhbGx5 IGN1cmlvdXMsIGhhdmUgeW91IHJlc2VhcmNoZWQvYXR0ZW1wdGVkIGFueSBw b3N0Z3Jlc3FsIGNsdXN0ZXJpbmcgc29sdXRpb25zPyBJIGFncmVlLCB5b3Ug Y2FuJ3QganVzdCBrZWVwIGJ1eWluZyBiaWdnZXIgbWFjaGluZXMuDQogDQpU aGV5IGhhdmUgNSBpbnRlcm5hbCBkcml2ZXMgKDQgaW4gUkFJRCAxMCwgMSBz cGFyZSkgb24gVTMyMCwgMTI4TUIgY2FjaGUgb24gdGhlIFBFUkMgY29udHJv bGxlciwgOEdCIFJBTS4NCiANClRoYW5rcywNCkFuamFuDQoNCgktLS0tLU9y aWdpbmFsIE1lc3NhZ2UtLS0tLSANCglGcm9tOiBCam9lcm4gTWV0emRvcmYg W21haWx0bzpibUB0dXJ0bGUtZW50ZXJ0YWlubWVudC5kZV0gDQoJU2VudDog VHVlIDUvMTEvMjAwNCAzOjA2IFBNIA0KCVRvOiBwZ3NxbC1wZXJmb3JtYW5j ZUBwb3N0Z3Jlc3FsLm9yZyANCglDYzogUGdzcWwtQWRtaW4gKEUtbWFpbCkg DQoJU3ViamVjdDogW1BFUkZPUk1dIFF1YWQgcHJvY2Vzc29yIG9wdGlvbnMN CgkNCgkNCg0KCUhpLA0KCQ0KCUkgYW0gY3VyaW91cyBpZiB0aGVyZSBhcmUg YW55IHJlYWwgbGlmZSBwcm9kdWN0aW9uIHF1YWQgcHJvY2Vzc29yIHNldHVw cw0KCXJ1bm5pbmcgcG9zdGdyZXNxbCBvdXQgdGhlcmUuIFNpbmNlIHBvc3Rn cmVzcWwgbGFja3MgYSBwcm9wZXINCglyZXBsaWNhdGlvbi9jbHVzdGVyIHNv bHV0aW9uLCB3ZSBoYXZlIHRvIGJ1eSBhIGJpZ2dlciBtYWNoaW5lLg0KCQ0K CVJpZ2h0IG5vdyB3ZSBhcmUgcnVubmluZyBvbiBhIGR1YWwgMi40IFhlb24s IDMgR0IgUmFtIGFuZCBVMTYwIFNDU0kNCgloYXJkd2FyZS1yYWlkIDEwLg0K CQ0KCUhhcyBhbnlvbmUgZXhwZXJpZW5jZXMgd2l0aCBxdWFkIFhlb24gb3Ig cXVhZCBPcHRlcm9uIHNldHVwcz8gSSBhbQ0KCWxvb2tpbmcgYXQgdGhlIGFw cHJvcHJpYXRlIGJvYXJkcyBmcm9tIFR5YW4sIHdoaWNoIHdvdWxkIGJlIHRo ZSBvbmx5DQoJb3B0aW9uIGZvciB1cyB0byBidXkgc3VjaCBhIGJlYXN0LiBU aGUgMzBrKyBzZXR1cHMgZnJvbSBEZWxsIGV0Yy4gZG9uJ3QNCglmaXQgb3Vy IGJ1ZGdldC4NCgkNCglJIGFtIHRoaW5raW5nIG9mIHRoZSBmb2xsb3dpbmc6 DQoJDQoJUXVhZCBwcm9jZXNzb3IgKHhlb24gb3Igb3B0ZXJvbikNCgk1IHgg U0NTSSAxNUsgUlBNIGZvciBSYWlkIDEwICsgc3BhcmUgZHJpdmUNCgkyIHgg SURFIGZvciBzeXN0ZW0NCglJQ1AtVm9ydGV4IGJhdHRlcnkgYmFja2VkIFUz MjAgSGFyZHdhcmUgUmFpZA0KCTQtOCBHQiBSYW0NCgkNCglXb3VsZCBiZSBu aWNlIHRvIGhlYXIgZnJvbSB5b3UuDQoJDQoJUmVnYXJkcywNCglCam9lcm4N CgkNCgktLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0oZW5kIG9mIGJyb2Fk Y2FzdCktLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCglUSVAgNDogRG9u J3QgJ2tpbGwgLTknIHRoZSBwb3N0bWFzdGVyDQoJDQoNCg== From pgsql-admin-owner@postgresql.org Tue May 11 17:15:29 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 285C0D1D150 for ; Tue, 11 May 2004 17:15:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 20959-02 for ; Tue, 11 May 2004 17:15:07 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 2C45AD1D248 for ; Tue, 11 May 2004 17:14:57 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Tue, 11 May 2004 13:14:53 -0700 In-Reply-To: <40A12452.3040505@turtle-entertainment.de> References: <40A12452.3040505@turtle-entertainment.de> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: "Pgsql-Admin (E-mail)" , pgsql-performance@postgresql.org From: Paul Tuckfield Subject: Re: [PERFORM] Quad processor options Date: Tue, 11 May 2004 13:14:59 -0700 To: Bjoern Metzdorf X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/87 X-Sequence-Number: 13403 it's very good to understand specific choke points you're trying to address by upgrading so you dont get disappointed. Are you truly CPU constrained, or is it memory footprint or IO thruput that makes you want to upgrade? IMO The best way to begin understanding system choke points is vmstat output. Would you mind forwarding the output of "vmstat 10 120" under peak load period? (I'm asusming this is linux or unix variant) a brief description of what is happening during the vmstat sample would help a lot too. > I am curious if there are any real life production quad processor > setups running postgresql out there. Since postgresql lacks a proper > replication/cluster solution, we have to buy a bigger machine. > > Right now we are running on a dual 2.4 Xeon, 3 GB Ram and U160 SCSI > hardware-raid 10. > > Has anyone experiences with quad Xeon or quad Opteron setups? I am > looking at the appropriate boards from Tyan, which would be the only > option for us to buy such a beast. The 30k+ setups from Dell etc. > don't fit our budget. > > I am thinking of the following: > > Quad processor (xeon or opteron) > 5 x SCSI 15K RPM for Raid 10 + spare drive > 2 x IDE for system > ICP-Vortex battery backed U320 Hardware Raid > 4-8 GB Ram > > Would be nice to hear from you. > > Regards, > Bjoern > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > From pgsql-admin-owner@postgresql.org Tue May 11 17:17:43 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A9A18D1BA45; Tue, 11 May 2004 17:17:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 19025-06; Tue, 11 May 2004 17:17:07 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 01874D1D1C3; Tue, 11 May 2004 17:17:05 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BKGmHs002282; Tue, 11 May 2004 14:16:48 -0600 (MDT) Date: Tue, 11 May 2004 14:16:36 -0600 (MDT) From: "scott.marlowe" To: Bjoern Metzdorf Cc: , "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options In-Reply-To: <40A12452.3040505@turtle-entertainment.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/88 X-Sequence-Number: 13404 On Tue, 11 May 2004, Bjoern Metzdorf wrote: > Hi, > > I am curious if there are any real life production quad processor setups > running postgresql out there. Since postgresql lacks a proper > replication/cluster solution, we have to buy a bigger machine. > > Right now we are running on a dual 2.4 Xeon, 3 GB Ram and U160 SCSI > hardware-raid 10. > > Has anyone experiences with quad Xeon or quad Opteron setups? I am > looking at the appropriate boards from Tyan, which would be the only > option for us to buy such a beast. The 30k+ setups from Dell etc. don't > fit our budget. > > I am thinking of the following: > > Quad processor (xeon or opteron) > 5 x SCSI 15K RPM for Raid 10 + spare drive > 2 x IDE for system > ICP-Vortex battery backed U320 Hardware Raid > 4-8 GB Ram Well, from what I've read elsewhere on the internet, it would seem the Opterons scale better to 4 CPUs than the basic Xeons do. Of course, the exception to this is SGI's altix, which uses their own chipset and runs the itanium with very good memory bandwidth. But, do you really need more CPU horsepower? Are you I/O or CPU or memory or memory bandwidth bound? If you're sitting at 99% idle, and iostat says your drives are only running at some small percentage of what you know they could, you might be memory or memory bandwidth limited. Adding two more CPUs will not help with that situation. If your I/O is saturated, then the answer may well be a better RAID array, with many more drives plugged into it. Do you have any spare drives you can toss on the machine to see if that helps? Sometimes going from 4 drives in a RAID 1+0 to 6 or 8 or more can give a big boost in performance. In short, don't expect 4 CPUs to solve the problem if the problem isn't really the CPUs being maxed out. Also, what type of load are you running? Mostly read, mostly written, few connections handling lots of data, lots of connections each handling a little data, lots of transactions, etc... If you are doing lots of writing, make SURE you have a controller that supports battery backed cache and is configured to write-back, not write-through. From pgsql-performance-owner@postgresql.org Tue May 11 17:23:46 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D80C7D1B367 for ; Tue, 11 May 2004 17:23:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17808-10 for ; Tue, 11 May 2004 17:23:21 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 05277D1D22D for ; Tue, 11 May 2004 17:23:19 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BKMqHs002664; Tue, 11 May 2004 14:22:52 -0600 (MDT) Date: Tue, 11 May 2004 14:22:40 -0600 (MDT) From: "scott.marlowe" To: Paul Tuckfield Cc: , Matthew Nuzum , , Rob Fielding Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-Reply-To: <29010F48-A37F-11D8-A34F-000393BD6C3E@tuckfield.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/80 X-Sequence-Number: 6911 On Tue, 11 May 2004, Paul Tuckfield wrote: > If you are having a "write storm" or bursty writes that's burying > performance, a scsi raid controler with writeback cache will greatly > improve the situation, but I do believe they run around $1-2k. If > it's write specific problem, the cache matters more than the striping, > except to say that write specfic perf problems should avoid raid5 Actually, a single channel MegaRAID 320-1 (single channel ultra 320) is only $421 at http://www.siliconmechanics.com/c248/u320-scsi.php It works pretty well for me, having 6 months of a production server on one with zero hickups and very good performance. They have a dual channel intel card for only $503, but I'm not at all familiar with that card. The top of the line megaraid is the 320-4, which is only $1240, which ain't bad for a four channel RAID controller. Battery backed cache is an addon, but I think it's only about $80 or so. From pgsql-admin-owner@postgresql.org Tue May 11 17:29:05 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20C02D1D09E; Tue, 11 May 2004 17:28:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 22648-07; Tue, 11 May 2004 17:28:15 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 41806D1D13D; Tue, 11 May 2004 17:28:13 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BNdrJ-00042X-00; Tue, 11 May 2004 22:28:13 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BNdrJ-0001nC-00; Tue, 11 May 2004 22:28:13 +0200 Message-ID: <40A1375C.1080806@turtle-entertainment.de> Date: Tue, 11 May 2004 22:28:12 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Anjan Dave Cc: pgsql-performance@postgresql.org, "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098228@vt-pe2550-001.vantage.vantage.com> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF785098228@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/89 X-Sequence-Number: 13405 Anjan Dave wrote: > We use XEON Quads (PowerEdge 6650s) and they work nice, > provided you configure the postgres properly. > Dell is the cheapest quad you can buy i think. > You shouldn't be paying 30K unless you are getting high CPU-cache > on each processor and tons of memory. good to hear, I tried to online configure a quad xeon here at dell germany, but the 6550 is not available for online configuration. at dell usa it works. I will give them a call tomorrow. > I am actually curious, have you researched/attempted any > postgresql clustering solutions? > I agree, you can't just keep buying bigger machines. There are many asynchronous, trigger based solutions out there (eRserver etc..), but what we need is basically a master <-> master setup, which seems not to be available soon for postgresql. Our current dual Xeon runs at 60-70% average cpu load, which is really much. I cannot afford any trigger overhead here. This machine is responsible for over 30M page impressions per month, 50 page impressums per second at peak times. The autovacuum daemon is a god sent gift :) I'm curious how the recently announced mysql cluster will perform, although it is not an option for us. postgresql has far superior functionality. > They have 5 internal drives (4 in RAID 10, 1 spare) on U320, > 128MB cache on the PERC controller, 8GB RAM. Could you tell me what you paid approximately for this setup? How does it perform? It certainly won't be twice as fast a as dual xeon, but I remember benchmarking a quad P3 xeon some time ago, and it was disappointingly slow... Regards, Bjoern From pgsql-admin-owner@postgresql.org Tue May 11 17:44:35 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E9CE6D1D34F; Tue, 11 May 2004 17:39:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25664-06; Tue, 11 May 2004 17:38:50 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 12988D1D28B; Tue, 11 May 2004 17:38:33 -0300 (ADT) Received: from vt-pe2550-001.VANTAGE.vantage.com (unknown [64.80.203.242]) by www.postgresql.com (Postfix) with ESMTP id B4F8ACF5449; Tue, 11 May 2004 17:38:29 -0300 (ADT) 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="UTF-8" Content-Transfer-Encoding: base64 Subject: Re: [PERFORM] Quad processor options Date: Tue, 11 May 2004 16:38:28 -0400 Message-ID: <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509822A@vt-pe2550-001.vantage.vantage.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Quad processor options Thread-Index: AcQ3lny4KvjCBVzMQ+ip0WR3uVO4sQAAIA0X From: "Anjan Dave" To: "Bjoern Metzdorf" Cc: , "Pgsql-Admin (E-mail)" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/93 X-Sequence-Number: 13409 RGlkIHlvdSBtZWFuIHRvIHNheSB0aGUgdHJpZ2dlci1iYXNlZCBjbHVzdGVy aW5nIHNvbHV0aW9uIGlzIGxvYWRpbmcgdGhlIGR1YWwgQ1BVcyA2MC03MCUg cmlnaHQgbm93Pw0KIA0KUGVyZm9ybWFuY2Ugd2lsbCBub3QgYmUgbGluZWFy IHdpdGggbW9yZSBwcm9jZXNzb3JzLCBidXQgaXQgZG9lcyBoZWxwIHdpdGgg bW9yZSBwcm9jZXNzZXMuIFdlIGhhdmVuJ3QgYmVuY2htYXJrZWQgaXQsIGJ1 dCB3ZSBoYXZlbid0IGhhZCBhbnkgcHJvYmxlbXMgYWxzbyBzbyBmYXIgaW4g dGVybXMgb2YgcGVyZm9ybWFuY2UuDQogDQpQcmljZSB3b3VsZCB2YXJ5IHdp dGggeW91ciByZWxhdGlvbi95ZWFybHkgcHVyY2hhc2UsIGV0YywgYnV0IGEg NjY1MCB3aXRoIDIuMEdIei8xTUIgY2FjaGUvOEdCIE1lbW9yeSwgUkFJRCBj YXJkLCBkcml2ZXMsIGV0Yywgc2hvdWxkIGRlZmluaXRlbHkgY29zdCB5b3Ug bGVzcyB0aGFuIDIwSyBVU0QuDQogDQotYW5qYW4NCg0KCS0tLS0tT3JpZ2lu YWwgTWVzc2FnZS0tLS0tIA0KCUZyb206IEJqb2VybiBNZXR6ZG9yZiBbbWFp bHRvOmJtQHR1cnRsZS1lbnRlcnRhaW5tZW50LmRlXSANCglTZW50OiBUdWUg NS8xMS8yMDA0IDQ6MjggUE0gDQoJVG86IEFuamFuIERhdmUgDQoJQ2M6IHBn c3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnOyBQZ3NxbC1BZG1pbiAo RS1tYWlsKSANCglTdWJqZWN0OiBSZTogW1BFUkZPUk1dIFF1YWQgcHJvY2Vz c29yIG9wdGlvbnMNCgkNCgkNCg0KCUFuamFuIERhdmUgd3JvdGU6DQoJDQoJ PiBXZSB1c2UgWEVPTiBRdWFkcyAoUG93ZXJFZGdlIDY2NTBzKSBhbmQgdGhl eSB3b3JrIG5pY2UsDQoJID4gcHJvdmlkZWQgeW91IGNvbmZpZ3VyZSB0aGUg cG9zdGdyZXMgcHJvcGVybHkuDQoJID4gRGVsbCBpcyB0aGUgY2hlYXBlc3Qg cXVhZCB5b3UgY2FuIGJ1eSBpIHRoaW5rLg0KCSA+IFlvdSBzaG91bGRuJ3Qg YmUgcGF5aW5nIDMwSyB1bmxlc3MgeW91IGFyZSBnZXR0aW5nIGhpZ2ggQ1BV LWNhY2hlDQoJID4gb24gZWFjaCBwcm9jZXNzb3IgYW5kIHRvbnMgb2YgbWVt b3J5Lg0KCQ0KCWdvb2QgdG8gaGVhciwgSSB0cmllZCB0byBvbmxpbmUgY29u ZmlndXJlIGEgcXVhZCB4ZW9uIGhlcmUgYXQgZGVsbA0KCWdlcm1hbnksIGJ1 dCB0aGUgNjU1MCBpcyBub3QgYXZhaWxhYmxlIGZvciBvbmxpbmUgY29uZmln dXJhdGlvbi4gYXQgZGVsbA0KCXVzYSBpdCB3b3Jrcy4gSSB3aWxsIGdpdmUg dGhlbSBhIGNhbGwgdG9tb3Jyb3cuDQoJDQoJPiBJIGFtIGFjdHVhbGx5IGN1 cmlvdXMsIGhhdmUgeW91IHJlc2VhcmNoZWQvYXR0ZW1wdGVkIGFueQ0KCSA+ IHBvc3RncmVzcWwgY2x1c3RlcmluZyBzb2x1dGlvbnM/DQoJID4gSSBhZ3Jl ZSwgeW91IGNhbid0IGp1c3Qga2VlcCBidXlpbmcgYmlnZ2VyIG1hY2hpbmVz Lg0KCQ0KCVRoZXJlIGFyZSBtYW55IGFzeW5jaHJvbm91cywgdHJpZ2dlciBi YXNlZCBzb2x1dGlvbnMgb3V0IHRoZXJlIChlUnNlcnZlcg0KCWV0Yy4uKSwg YnV0IHdoYXQgd2UgbmVlZCBpcyBiYXNpY2FsbHkgYSBtYXN0ZXIgPC0+IG1h c3RlciBzZXR1cCwgd2hpY2gNCglzZWVtcyBub3QgdG8gYmUgYXZhaWxhYmxl IHNvb24gZm9yIHBvc3RncmVzcWwuDQoJDQoJT3VyIGN1cnJlbnQgZHVhbCBY ZW9uIHJ1bnMgYXQgNjAtNzAlIGF2ZXJhZ2UgY3B1IGxvYWQsIHdoaWNoIGlz IHJlYWxseQ0KCW11Y2guIEkgY2Fubm90IGFmZm9yZCBhbnkgdHJpZ2dlciBv dmVyaGVhZCBoZXJlLiBUaGlzIG1hY2hpbmUgaXMNCglyZXNwb25zaWJsZSBm b3Igb3ZlciAzME0gcGFnZSBpbXByZXNzaW9ucyBwZXIgbW9udGgsIDUwIHBh Z2UgaW1wcmVzc3Vtcw0KCXBlciBzZWNvbmQgYXQgcGVhayB0aW1lcy4gVGhl IGF1dG92YWN1dW0gZGFlbW9uIGlzIGEgZ29kIHNlbnQgZ2lmdCA6KQ0KCQ0K CUknbSBjdXJpb3VzIGhvdyB0aGUgcmVjZW50bHkgYW5ub3VuY2VkIG15c3Fs IGNsdXN0ZXIgd2lsbCBwZXJmb3JtLA0KCWFsdGhvdWdoIGl0IGlzIG5vdCBh biBvcHRpb24gZm9yIHVzLiBwb3N0Z3Jlc3FsIGhhcyBmYXIgc3VwZXJpb3IN CglmdW5jdGlvbmFsaXR5Lg0KCQ0KCT4gVGhleSBoYXZlIDUgaW50ZXJuYWwg ZHJpdmVzICg0IGluIFJBSUQgMTAsIDEgc3BhcmUpIG9uIFUzMjAsDQoJID4g MTI4TUIgY2FjaGUgb24gdGhlIFBFUkMgY29udHJvbGxlciwgOEdCIFJBTS4N CgkNCglDb3VsZCB5b3UgdGVsbCBtZSB3aGF0IHlvdSBwYWlkIGFwcHJveGlt YXRlbHkgZm9yIHRoaXMgc2V0dXA/DQoJDQoJSG93IGRvZXMgaXQgcGVyZm9y bT8gSXQgY2VydGFpbmx5IHdvbid0IGJlIHR3aWNlIGFzIGZhc3QgYSBhcyBk dWFsIHhlb24sDQoJYnV0IEkgcmVtZW1iZXIgYmVuY2htYXJraW5nIGEgcXVh ZCBQMyB4ZW9uIHNvbWUgdGltZSBhZ28sIGFuZCBpdCB3YXMNCglkaXNhcHBv aW50aW5nbHkgc2xvdy4uLg0KCQ0KCVJlZ2FyZHMsDQoJQmpvZXJuDQoJDQoN Cg== From pgsql-admin-owner@postgresql.org Tue May 11 17:42:48 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 96B0DD1D219; Tue, 11 May 2004 17:41:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25664-07; Tue, 11 May 2004 17:41:32 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 50EDAD1B3DC; Tue, 11 May 2004 17:41:30 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BNe49-0004kS-00; Tue, 11 May 2004 22:41:29 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BNe49-000254-00; Tue, 11 May 2004 22:41:29 +0200 Message-ID: <40A13A78.9000607@turtle-entertainment.de> Date: Tue, 11 May 2004 22:41:28 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "scott.marlowe" Cc: pgsql-performance@postgresql.org, "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------000602000605060104090100" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/91 X-Sequence-Number: 13407 This is a multi-part message in MIME format. --------------000602000605060104090100 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit scott.marlowe wrote: > Well, from what I've read elsewhere on the internet, it would seem the > Opterons scale better to 4 CPUs than the basic Xeons do. Of course, the > exception to this is SGI's altix, which uses their own chipset and runs > the itanium with very good memory bandwidth. This is basically what I read too. But I cannot spent money on a quad opteron just for testing purposes :) > But, do you really need more CPU horsepower? > > Are you I/O or CPU or memory or memory bandwidth bound? If you're sitting > at 99% idle, and iostat says your drives are only running at some small > percentage of what you know they could, you might be memory or memory > bandwidth limited. Adding two more CPUs will not help with that > situation. Right now we have a dual xeon 2.4, 3 GB Ram, Mylex extremeraid controller, running 2 Compaq BD018122C0, 1 Seagate ST318203LC and 1 Quantum ATLAS_V_18_SCA. iostat show between 20 and 60 % user avg-cpu. And this is not even peak time. I attached a "vmstat 10 120" output for perhaps 60-70% peak load. > If your I/O is saturated, then the answer may well be a better RAID > array, with many more drives plugged into it. Do you have any spare > drives you can toss on the machine to see if that helps? Sometimes going > from 4 drives in a RAID 1+0 to 6 or 8 or more can give a big boost in > performance. Next drives I'll buy will certainly be 15k scsi drives. > In short, don't expect 4 CPUs to solve the problem if the problem isn't > really the CPUs being maxed out. > > Also, what type of load are you running? Mostly read, mostly written, few > connections handling lots of data, lots of connections each handling a > little data, lots of transactions, etc... In peak times we can get up to 700-800 connections at the same time. There are quite some updates involved, without having exact numbers I'll think that we have about 70% selects and 30% updates/inserts. > If you are doing lots of writing, make SURE you have a controller that > supports battery backed cache and is configured to write-back, not > write-through. Could you recommend a certain controller type? The only battery backed one that I found on the net is the newest model from icp-vortex.com. Regards, Bjoern --------------000602000605060104090100 Content-Type: text/plain; name="vmstat.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vmstat.txt" ~# vmstat 10 120 procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 1 1 0 24180 10584 32468 2332208 0 1 0 2 1 2 2 0 0 0 2 0 24564 10480 27812 2313528 8 0 7506 574 1199 8674 30 7 63 2 1 0 24692 10060 23636 2259176 0 18 8099 298 2074 6328 25 7 68 2 0 0 24584 18576 21056 2299804 3 6 13208 305 1598 8700 23 6 71 1 21 1 24504 16588 20912 2309468 4 0 1442 1107 754 6874 42 13 45 6 1 0 24632 13148 19992 2319400 0 0 2627 499 1184 9633 37 6 58 5 1 0 24488 10912 19292 2330080 5 0 3404 150 1466 10206 32 6 61 4 1 0 24488 12180 18824 2342280 3 0 2934 40 1052 3866 19 3 78 0 0 0 24420 14776 19412 2347232 6 0 403 216 1123 4702 22 3 74 0 0 0 24548 14408 17380 2321780 4 0 522 715 965 6336 25 5 71 4 0 0 24676 12504 17756 2322988 0 0 564 830 883 7066 31 6 63 0 3 0 24676 14060 18232 2325224 0 0 483 388 1097 3401 21 3 76 0 2 1 24676 13044 18700 2322948 0 0 701 195 1078 5187 23 3 74 2 0 0 24676 21576 18752 2328168 0 0 467 177 1552 3574 18 3 78 --------------000602000605060104090100-- From pgsql-admin-owner@postgresql.org Tue May 11 18:11:09 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2FAF3D1D274; Tue, 11 May 2004 17:45:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 29583-04; Tue, 11 May 2004 17:45:16 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id AB089D1D34A; Tue, 11 May 2004 17:45:13 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BNe7m-000528-00; Tue, 11 May 2004 22:45:14 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BNe7l-00028G-00; Tue, 11 May 2004 22:45:13 +0200 Message-ID: <40A13B59.4060803@turtle-entertainment.de> Date: Tue, 11 May 2004 22:45:13 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Anjan Dave Cc: pgsql-performance@postgresql.org, "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509822A@vt-pe2550-001.vantage.vantage.com> In-Reply-To: <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509822A@vt-pe2550-001.vantage.vantage.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/96 X-Sequence-Number: 13412 Anjan Dave wrote: > Did you mean to say the trigger-based clustering solution > is loading the dual CPUs 60-70% right now? No, this is without any triggers involved. > Performance will not be linear with more processors, > but it does help with more processes. > We haven't benchmarked it, but we haven't had any > problems also so far in terms of performance. From the amount of processes view, we certainly can saturate a quad setup :) > Price would vary with your relation/yearly purchase, etc, > but a 6650 with 2.0GHz/1MB cache/8GB Memory, RAID card, > drives, etc, should definitely cost you less than 20K USD. Which is still very much. Anyone have experience with a self built quad xeon, using the Tyan Thunder board? Regards, Bjoern From pgsql-admin-owner@postgresql.org Tue May 11 17:53:45 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CF237D1B367; Tue, 11 May 2004 17:46:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 31748-01; Tue, 11 May 2004 17:46:39 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id E354FD1D28B; Tue, 11 May 2004 17:46:36 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BNe96-00055f-00; Tue, 11 May 2004 22:46:36 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BNe96-00028b-00; Tue, 11 May 2004 22:46:36 +0200 Message-ID: <40A13BAB.5080500@turtle-entertainment.de> Date: Tue, 11 May 2004 22:46:35 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Paul Tuckfield Cc: "Pgsql-Admin (E-mail)" , pgsql-performance@postgresql.org Subject: Re: [PERFORM] Quad processor options References: <40A12452.3040505@turtle-entertainment.de> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/94 X-Sequence-Number: 13410 Paul Tuckfield wrote: > Would you mind forwarding the output of "vmstat 10 120" under peak load > period? (I'm asusming this is linux or unix variant) a brief > description of what is happening during the vmstat sample would help a > lot too. see my other mail. We are running Linux, Kernel 2.4. As soon as the next debian version comes out, I'll happily switch to 2.6 :) Regards, Bjoern From pgsql-admin-owner@postgresql.org Tue May 11 18:10:41 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7B25BD1D1B2; Tue, 11 May 2004 18:03:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36201-03; Tue, 11 May 2004 18:02:51 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 3D89BD1B3DD; Tue, 11 May 2004 18:02:48 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BL2aHs006643; Tue, 11 May 2004 15:02:36 -0600 (MDT) Date: Tue, 11 May 2004 15:02:24 -0600 (MDT) From: "scott.marlowe" To: Bjoern Metzdorf Cc: , "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options In-Reply-To: <40A13A78.9000607@turtle-entertainment.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/95 X-Sequence-Number: 13411 On Tue, 11 May 2004, Bjoern Metzdorf wrote: > scott.marlowe wrote: > > > Well, from what I've read elsewhere on the internet, it would seem the > > Opterons scale better to 4 CPUs than the basic Xeons do. Of course, the > > exception to this is SGI's altix, which uses their own chipset and runs > > the itanium with very good memory bandwidth. > > This is basically what I read too. But I cannot spent money on a quad > opteron just for testing purposes :) Wouldn't it be nice to just have a lab full of these things? > > If your I/O is saturated, then the answer may well be a better RAID > > array, with many more drives plugged into it. Do you have any spare > > drives you can toss on the machine to see if that helps? Sometimes going > > from 4 drives in a RAID 1+0 to 6 or 8 or more can give a big boost in > > performance. > > Next drives I'll buy will certainly be 15k scsi drives. Better to buy more 10k drives than fewer 15k drives. Other than slightly faster select times, the 15ks aren't really any faster. > > In short, don't expect 4 CPUs to solve the problem if the problem isn't > > really the CPUs being maxed out. > > > > Also, what type of load are you running? Mostly read, mostly written, few > > connections handling lots of data, lots of connections each handling a > > little data, lots of transactions, etc... > > In peak times we can get up to 700-800 connections at the same time. > There are quite some updates involved, without having exact numbers I'll > think that we have about 70% selects and 30% updates/inserts. Wow, a lot of writes then. > > If you are doing lots of writing, make SURE you have a controller that > > supports battery backed cache and is configured to write-back, not > > write-through. > > Could you recommend a certain controller type? The only battery backed > one that I found on the net is the newest model from icp-vortex.com. Sure, adaptec makes one, so does lsi megaraid. Dell resells both of these, the PERC3DI and the PERC3DC are adaptec, then lsi in that order, I believe. We run the lsi megaraid with 64 megs battery backed cache. Intel also makes one, but I've heard nothing about it. If you get the LSI megaraid, make sure you're running the latest megaraid 2 driver, not the older, slower 1.18 series. If you are running linux, look for the dkms packaged version. dkms, (Dynamic Kernel Module System) automagically compiles and installs source rpms for drivers when you install them, and configures the machine to use them to boot up. Most drivers seem to be slowly headed that way in the linux universe, and I really like the simplicity and power of dkms. I haven't directly tested anything but the adaptec and the lsi megaraid. Here at work we've had massive issues trying to get the adaptec cards configured and installed on, while the megaraid was a snap. Installed RH, installed the dkms rpm, installed the dkms enabled megaraid driver and rebooted. Literally, that's all it took. From pgsql-admin-owner@postgresql.org Tue May 11 18:15:49 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 47662D1B3E4; Tue, 11 May 2004 18:11:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38828-01; Tue, 11 May 2004 18:11:14 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 12AC9D1B367; Tue, 11 May 2004 18:11:12 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BNeWu-0006Qm-00; Tue, 11 May 2004 23:11:12 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BNeWu-0002SA-00; Tue, 11 May 2004 23:11:12 +0200 Message-ID: <40A14170.7000201@turtle-entertainment.de> Date: Tue, 11 May 2004 23:11:12 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "scott.marlowe" Cc: pgsql-performance@postgresql.org, "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/97 X-Sequence-Number: 13413 scott.marlowe wrote: >>Next drives I'll buy will certainly be 15k scsi drives. > > Better to buy more 10k drives than fewer 15k drives. Other than slightly > faster select times, the 15ks aren't really any faster. Good to know. I'll remember that. >>In peak times we can get up to 700-800 connections at the same time. >>There are quite some updates involved, without having exact numbers I'll >>think that we have about 70% selects and 30% updates/inserts. > > Wow, a lot of writes then. Yes, it certainly could also be only 15-20% updates/inserts, but this is also not negligible. > Sure, adaptec makes one, so does lsi megaraid. Dell resells both of > these, the PERC3DI and the PERC3DC are adaptec, then lsi in that order, I > believe. We run the lsi megaraid with 64 megs battery backed cache. The LSI sounds good. > Intel also makes one, but I've heard nothing about it. It could well be the ICP Vortex one, ICP was bought by Intel some time ago.. > I haven't directly tested anything but the adaptec and the lsi megaraid. > Here at work we've had massive issues trying to get the adaptec cards > configured and installed on, while the megaraid was a snap. Installed RH, > installed the dkms rpm, installed the dkms enabled megaraid driver and > rebooted. Literally, that's all it took. I didn't hear anything about dkms for debian, so I will be hand-patching as usual :) Regards, Bjoern From pgsql-admin-owner@postgresql.org Tue May 11 18:30:34 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C3784D1D35F; Tue, 11 May 2004 18:30:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41603-09; Tue, 11 May 2004 18:30:11 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id E5F8ED1D166; Tue, 11 May 2004 18:30:07 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BLTxHs008895; Tue, 11 May 2004 15:29:59 -0600 (MDT) Date: Tue, 11 May 2004 15:29:46 -0600 (MDT) From: "scott.marlowe" To: Bjoern Metzdorf Cc: , "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options In-Reply-To: <40A14170.7000201@turtle-entertainment.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/98 X-Sequence-Number: 13414 On Tue, 11 May 2004, Bjoern Metzdorf wrote: > scott.marlowe wrote: > > Sure, adaptec makes one, so does lsi megaraid. Dell resells both of > > these, the PERC3DI and the PERC3DC are adaptec, then lsi in that order, I > > believe. We run the lsi megaraid with 64 megs battery backed cache. > > The LSI sounds good. > > > Intel also makes one, but I've heard nothing about it. > > It could well be the ICP Vortex one, ICP was bought by Intel some time ago.. Also, there are bigger, faster external RAID boxes as well, that make the internal cards seem puny. They're nice because all you need in your main box is a good U320 controller to plug into the external RAID array. That URL I mentioned earlier that had prices has some of the external boxes listed. No price, not for sale on the web, get out the checkbook and write a blank check is my guess. I.e. they're not cheap. The other nice thing about the LSI cards is that you can install >1 and the act like one big RAID array. i.e. install two cards with a 20 drive RAID0 then make a RAID1 across them, and if one or the other cards itself fails, you've still got 100% of your data sitting there. Nice to know you can survive the complete failure of one half of your chain. > > I haven't directly tested anything but the adaptec and the lsi megaraid. > > Here at work we've had massive issues trying to get the adaptec cards > > configured and installed on, while the megaraid was a snap. Installed RH, > > installed the dkms rpm, installed the dkms enabled megaraid driver and > > rebooted. Literally, that's all it took. > > I didn't hear anything about dkms for debian, so I will be hand-patching > as usual :) Yeah, it seems to be an RPM kinda thing. But, I'm thinking the 2.0 drivers got included in the latest 2.6 kernels, so no biggie. I was looking around in google, and it definitely appears the 2.x and 1.x megaraid drivers were merged into "unified" driver in 2.6 kernel. From pgsql-performance-owner@postgresql.org Tue May 11 19:02:12 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EF91FD1D272 for ; Tue, 11 May 2004 19:02:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52816-03 for ; Tue, 11 May 2004 19:01:38 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id B1F59D1D176 for ; Tue, 11 May 2004 19:01:30 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 473163D1F8; Tue, 11 May 2004 19:01:33 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 2F6F83D1C9 for ; Tue, 11 May 2004 19:01:33 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Tue, 11 May 2004 18:41:21 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 63E4E3CC7B for ; Tue, 11 May 2004 18:39:20 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Tue, 11 May 2004 18:39:20 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Tue, 11 May 2004 18:37:17 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D4C5FD1D35F for ; Tue, 11 May 2004 18:37:16 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46454-03 for ; Tue, 11 May 2004 18:36:46 -0300 (ADT) X-Received: from neomail03.traderonline.com (email.traderonline.com [65.213.231.10]) by svr1.postgresql.org (Postfix) with ESMTP id BED6AD1BA75 for ; Tue, 11 May 2004 18:36:36 -0300 (ADT) X-Received: from dyounger-IBM (65-86-118-210.client.dsl.net [65.86.118.210]) by neomail03.traderonline.com (8.12.8/8.12.8) with ESMTP id i4BLaWAm011454 for ; Tue, 11 May 2004 17:36:32 -0400 Message-Id: <6.0.1.1.2.20040511163104.01e9cbb0@mail.traderonline.com> X-Sender: dylists@mail.ptd.net (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.0.1.1 Date: Tue, 11 May 2004 17:36:31 -0400 To: psql-performance@postgresql.org From: Doug Y Subject: Clarification on some settings Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Tue, 11 May 2004 19:01:11 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-performance@postgresql.org ReSent-Subject: Clarification on some settings ReSent-Message-ID: <20040511190111.J34032@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/92 X-Sequence-Number: 6923 Hello, I've been having some performance issues with a DB I use. I'm trying to come up with some performance recommendations to send to the "adminstrator". Hardware: CPU0: Pentium III (Coppermine) 1000MHz (256k cache) CPU1: Pentium III (Coppermine) 1000MHz (256k cache) Memory: 3863468 kB (4 GB) OS: Red Hat Linux release 7.2 (Enigma) Kernel: 2.4.9-31smp I/O I believe is a 3-disk raid 5. /proc/sys/kernel/shmmax and /proc/sys/kernel/shmall were set to 2G Postgres version: 7.3.4 I know its a bit dated, and upgrades are planned, but several months out. Load average seems to hover between 1.0 and 5.0-ish during peak hours. CPU seems to be the limiting factor but I'm not positive (cpu utilization seems to be 40-50%). We have 2 of those set up as the back end to 3 web-servers each... supposedly load-balanced, but one of the 2 dbs consistently has higher load. We have a home-grown replication system that keeps them in sync with each other... peer to peer (master/master). The DB schema is, well to put it nicely... not exactly normalized. No constraints to speak of except for the requisite not-nulls on the primary keys (many of which are compound). Keys are mostly varchar(256) fields. Ok for what I'm uncertain of... shared_buffers: According to http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html Its more of a staging area and more isn't necessarily better. That psql relies on the OS to cache data for later use. But according to http://www.ca.postgresql.org/docs/momjian/hw_performance/node3.html its where psql caches previous data for queries because the OS cache is slower, and should be as big as possible without causing swap. Those seem to be conflicting statements. In our case, the "administrator" kept increasing this until performance seemed to increase, which means its now 250000 (x 8k is 2G). Is this just a staging area for data waiting to move to the OS cache, or is this really the area that psql caches its data? effective_cache_size: Again, according to the Varlena guide this tells psql how much system memory is available for it to do its work in. until recently, this was set at the default value of 1000. It was just recently increased to 180000 (1.5G) according to http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html it should be about 25% of memory? Finally sort_mem: Was until recently left at the default of 1000. Is now 16000. Increasing the effective cache and sort mem didn't seem to make much of a difference. I'm guessing the eff cache was probably raised a bit too much, and shared_buffers is way to high. What can I do to help determine what the proper settings should be and/or look at other possible choke points. What should I look for in iostat, mpstat, or vmstat as red flags that cpu, memory, or i/o bound? DB maintenance wise, I don't believe they were running vacuum full until I told them a few months ago that regular vacuum analyze no longer cleans out dead tuples. Now normal vac is run daily, vac full weekly (supposedly). How can I tell from the output of vacuum if the vac fulls aren't being done, or not done often enough? Or from the system tables, what can I read? Is there anywhere else I can look for possible clues? I have access to the DB super-user, but not the system root/user. Thank you for your time. Please let me know any help or suggestions you may have. Unfortunately upgrading postgres, OS, kernel, or re-writing schema is most likely not an option. From pgsql-performance-owner@postgresql.org Tue May 11 18:43:17 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 05565D1D166 for ; Tue, 11 May 2004 18:43:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 49173-02 for ; Tue, 11 May 2004 18:42:55 -0300 (ADT) Received: from mail.facnd.com (dslstatic-236-59.ideaone.net [64.21.236.59]) by svr1.postgresql.org (Postfix) with ESMTP id D1499D1BA75 for ; Tue, 11 May 2004 18:42:35 -0300 (ADT) Received: from rob (rob [192.1.1.100]) by mail.facnd.com (Postfix) with ESMTP id 6E2B92A5D for ; Tue, 11 May 2004 16:43:03 -0500 (CDT) From: "Rob Sell" To: Subject: Re: Quad processor options Date: Tue, 11 May 2004 16:42:57 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <40A14170.7000201@turtle-entertainment.de> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Thread-Index: AcQ3njSYQKELHoFkRvOnQclsA8jU9wAAf1hg Message-Id: <20040511214303.6E2B92A5D@mail.facnd.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/89 X-Sequence-Number: 6920 -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Bjoern Metzdorf Sent: Tuesday, May 11, 2004 3:11 PM To: scott.marlowe Cc: pgsql-performance@postgresql.org; Pgsql-Admin (E-mail) Subject: Re: [PERFORM] Quad processor options scott.marlowe wrote: >>Next drives I'll buy will certainly be 15k scsi drives. > > Better to buy more 10k drives than fewer 15k drives. Other than slightly > faster select times, the 15ks aren't really any faster. Good to know. I'll remember that. >>In peak times we can get up to 700-800 connections at the same time. >>There are quite some updates involved, without having exact numbers I'll >>think that we have about 70% selects and 30% updates/inserts. > > Wow, a lot of writes then. Yes, it certainly could also be only 15-20% updates/inserts, but this is also not negligible. > Sure, adaptec makes one, so does lsi megaraid. Dell resells both of > these, the PERC3DI and the PERC3DC are adaptec, then lsi in that order, I > believe. We run the lsi megaraid with 64 megs battery backed cache. The LSI sounds good. > Intel also makes one, but I've heard nothing about it. It could well be the ICP Vortex one, ICP was bought by Intel some time ago.. > I haven't directly tested anything but the adaptec and the lsi megaraid. > Here at work we've had massive issues trying to get the adaptec cards > configured and installed on, while the megaraid was a snap. Installed RH, > installed the dkms rpm, installed the dkms enabled megaraid driver and > rebooted. Literally, that's all it took. I didn't hear anything about dkms for debian, so I will be hand-patching as usual :) Regards, Bjoern ------------------------- Personally I would stay away from anything intel over 2 processors. I have done some research and if memory serves it something like this. Intel's architecture makes each processor compete for bandwidth on the bus to the ram. Amd differs in that each proc has its own bus to the ram. Don't take this as god's honest fact but just keep it in mind when considering a Xeon solution, it may be worth your time to do some deeper research into this. There is some on this here http://www4.tomshardware.com/cpu/20030422/ Rob From pgsql-performance-owner@postgresql.org Tue May 11 18:47:10 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4538DD1B22C for ; Tue, 11 May 2004 18:47:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 47987-06 for ; Tue, 11 May 2004 18:46:45 -0300 (ADT) Received: from mail.facnd.com (dslstatic-236-59.ideaone.net [64.21.236.59]) by svr1.postgresql.org (Postfix) with ESMTP id EDC79D1D13D for ; Tue, 11 May 2004 18:46:41 -0300 (ADT) Received: from rob (rob [192.1.1.100]) by mail.facnd.com (Postfix) with ESMTP id 0C48D33B9 for ; Tue, 11 May 2004 16:47:12 -0500 (CDT) From: "Rob Sell" To: Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints Date: Tue, 11 May 2004 16:47:05 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Thread-Index: AcQ3ly26B+Q2JZ96RIuOR+LEGHEa8gACefjQ Message-Id: <20040511214712.0C48D33B9@mail.facnd.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/90 X-Sequence-Number: 6921 -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of scott.marlowe Sent: Tuesday, May 11, 2004 2:23 PM To: Paul Tuckfield Cc: jao@geophile.com; Matthew Nuzum; pgsql-performance@postgresql.org; Rob Fielding Subject: Re: [PERFORM] Configuring PostgreSQL to minimize impact of checkpoints On Tue, 11 May 2004, Paul Tuckfield wrote: > If you are having a "write storm" or bursty writes that's burying > performance, a scsi raid controler with writeback cache will greatly > improve the situation, but I do believe they run around $1-2k. If > it's write specific problem, the cache matters more than the striping, > except to say that write specfic perf problems should avoid raid5 Actually, a single channel MegaRAID 320-1 (single channel ultra 320) is only $421 at http://www.siliconmechanics.com/c248/u320-scsi.php It works pretty well for me, having 6 months of a production server on one with zero hickups and very good performance. They have a dual channel intel card for only $503, but I'm not at all familiar with that card. The top of the line megaraid is the 320-4, which is only $1240, which ain't bad for a four channel RAID controller. Battery backed cache is an addon, but I think it's only about $80 or so. ---------------------------(end of broadcast)--------------------------- TIP 3: 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 ----------------------------- If you don't mind slumming on ebay :-) keep an eye out for PERC III cards, they are dell branded LSI cards. Perc = Power Edge Raid Controller. There are models on there dual channel u320 and dell usually sells them with battery backed cache. That's how I have acquired all my high end raid cards. Rob From pgsql-performance-owner@postgresql.org Tue May 11 18:53:14 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D4768D1B35D for ; Tue, 11 May 2004 18:53:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 49219-07 for ; Tue, 11 May 2004 18:52:55 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 8655FD1B22A for ; Tue, 11 May 2004 18:52:52 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Tue, 11 May 2004 14:52:51 -0700 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <905B43ED-A395-11D8-A34F-000393BD6C3E@tuckfield.com> Content-Transfer-Encoding: 7bit Cc: , Matthew Nuzum , , Rob Fielding From: Paul Tuckfield Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints Date: Tue, 11 May 2004 14:52:57 -0700 To: "scott.marlowe" X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/91 X-Sequence-Number: 6922 Love that froogle. It looks like a nice card. One thing I didn't get straight is if the cache is writethru or write back. If the original posters problem is truly a burst write problem (and not linux caching or virtual memory overcommitment) then writeback is key. > On Tue, 11 May 2004, Paul Tuckfield wrote: > >> If you are having a "write storm" or bursty writes that's burying >> performance, a scsi raid controler with writeback cache will greatly >> improve the situation, but I do believe they run around $1-2k. If >> it's write specific problem, the cache matters more than the striping, >> except to say that write specfic perf problems should avoid raid5 > > Actually, a single channel MegaRAID 320-1 (single channel ultra 320) is > only $421 at http://www.siliconmechanics.com/c248/u320-scsi.php It > works > pretty well for me, having 6 months of a production server on one with > zero hickups and very good performance. They have a dual channel intel > card for only $503, but I'm not at all familiar with that card. > > The top of the line megaraid is the 320-4, which is only $1240, which > ain't bad for a four channel RAID controller. > > Battery backed cache is an addon, but I think it's only about $80 or > so. > > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: 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 Tue May 11 19:08:34 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5BB7DD1B3B6 for ; Tue, 11 May 2004 19:08:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55355-01 for ; Tue, 11 May 2004 19:08:15 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 109C4D1B229 for ; Tue, 11 May 2004 19:08:12 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BM7mHs011941; Tue, 11 May 2004 16:07:48 -0600 (MDT) Date: Tue, 11 May 2004 16:07:36 -0600 (MDT) From: "scott.marlowe" To: Paul Tuckfield Cc: , Matthew Nuzum , , Rob Fielding Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-Reply-To: <905B43ED-A395-11D8-A34F-000393BD6C3E@tuckfield.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/93 X-Sequence-Number: 6924 On Tue, 11 May 2004, Paul Tuckfield wrote: > Love that froogle. > > It looks like a nice card. One thing I didn't get straight is if > the cache is writethru or write back. > > If the original posters problem is truly a burst write problem (and not > linux caching or virtual memory overcommitment) then writeback is key. the MegaRaid can be configured either way. it defaults to writeback if the battery backed cache is present, I believe. From pgsql-performance-owner@postgresql.org Tue May 11 19:09:23 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7B8CBD1B22C for ; Tue, 11 May 2004 19:09:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51442-07 for ; Tue, 11 May 2004 19:09:00 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 934B8D1B3B4 for ; Tue, 11 May 2004 19:08:57 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BM8XHs011999; Tue, 11 May 2004 16:08:33 -0600 (MDT) Date: Tue, 11 May 2004 16:08:20 -0600 (MDT) From: "scott.marlowe" To: Rob Sell Cc: Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints In-Reply-To: <20040511214712.0C48D33B9@mail.facnd.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/94 X-Sequence-Number: 6925 On Tue, 11 May 2004, Rob Sell wrote: > > If you don't mind slumming on ebay :-) keep an eye out for PERC III cards, > they are dell branded LSI cards. Perc = Power Edge Raid Controller. There > are models on there dual channel u320 and dell usually sells them with > battery backed cache. That's how I have acquired all my high end raid > cards. Not all Perc3s are lsi, many are adaptec. The perc3di is adaptec, the perc3dc is lsi/megaraid. From pgsql-performance-owner@postgresql.org Tue May 11 19:10:52 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7CC99D1B3B6 for ; Tue, 11 May 2004 19:10:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55619-01 for ; Tue, 11 May 2004 19:10:32 -0300 (ADT) Received: from mail.gotfrag.com (unknown [66.208.110.11]) by svr1.postgresql.org (Postfix) with ESMTP id C5438D1D15E for ; Tue, 11 May 2004 19:10:28 -0300 (ADT) Received: from jcoene2 (roc-66-66-149-175.rochester.rr.com [66.66.149.175]) by mail.gotfrag.com (8.12.10/8.12.8) with ESMTP id i4BMASam015217; Tue, 11 May 2004 18:10:29 -0400 (EDT) (envelope-from jcoene@gotfrag.com) Message-Id: <200405112210.i4BMASam015217@mail.gotfrag.com> From: "Jason Coene" To: Subject: Intermittent slowdowns, connection delays Date: Tue, 11 May 2004 18:10:30 -0400 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_002C_01C43783.3EB43F20" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Thread-Index: AcQ3pL1mEU+HR8E0RYKJWeQoZ6oQ2A== X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/95 X-Sequence-Number: 6926 This is a multi-part message in MIME format. ------=_NextPart_000_002C_01C43783.3EB43F20 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi All, We have a Postgres 7.4.1 server running on FreeBSD 5.2. Hardware is a Dual Xeon 2.6 (HT enabled), 2 GB Memory, 3Ware SATA RAID-5 w/ 4 7200 RPM Seagate disks and gigabit Intel Server Ethernet. The server is dedicated to serving data to our web-based CMS. We have a few web servers load balanced, and we do around 1M page impressions per day. Our website is highly personalized, and we've optimized it to limit the number of queries, but we still see between 2 and 3 SELECT's (with JOIN's) and 1 UPDATE per page load, selectively more - a fair volume. The single UPDATE per page load is updating a timestamp in a small table (about 150,000 rows) with only 1 index (on the 1 field that needs to be matched). We're seeing some intermittent spikes in query time as actual connection time. I.e., during these seemingly random spikes, our debug output looks like this (times from start of HTTP request): SQL CONNECTION CREATING 'gf' 0.0015 - ESTABLISHING CONNECTION 1.7113 - CONNECTION OK SQL QUERY ID 1 COST 0.8155 ROWS 1 SQL QUERY ID 2 COST 0.5607 ROWS 14 .. etc.. (all queries taking more time than normal, see below) Refresh the page 2 seconds later, and we'll get: SQL CONNECTION CREATING 'gf' 0.0017 - ESTABLISHING CONNECTION 0.0086 - CONNECTION OK SQL QUERY ID 1 COST 0.0128 ROWS 1 SQL QUERY ID 2 COST 0.0033 ROWS 14 .. etc.. (with same queries) Indeed, during these types, it takes a moment for "psql" to connect on the command line (from the same machine using a local file socket), so it's not a network issue or a web-server issue. During these spurts, there's nothing too out of the ordinary in vmstat, systat or top. These programs show that we're not using much CPU (usually 60-80% idle), and disks usage is virtually nil. I've attached 60 seconds of "vmstat 5". Memory usage looks like this (constantly): Mem: 110M Active, 1470M Inact, 206M Wired, 61M Cache, 112M Buf, 26M Free I've cleaned up and tested query after query, and nothing is a "hog". On an idle server, every query will execute in < 0.05 sec. Perhaps some of you veterans have ideas? Thanks, Jason Coene Gotfrag eSports 585-598-6621 Phone 585-598-6633 Fax jcoene@gotfrag.com http://www.gotfrag.com ------=_NextPart_000_002C_01C43783.3EB43F20 Content-Type: text/plain; name="vmstat51min.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vmstat51min.txt" d01.gotfrag.com> vmstat 5 procs memory page disks faults cpu r b w avm fre flt re pi po fr sr tw0 fd0 in sy cs us sy = id 0 9 5 335952 103108 625 0 0 0 319 4 0 0 584 0 437 3 5 = 92 0 4 5 350772 90140 24534 0 0 0 2533 0 8 0 1448 0 45969 8= 22 71 0 0 0 321016 112884 10603 0 0 0 2840 0 3 0 2030 0 26562 6= 12 82 0 0 0 341428 99548 10823 0 0 0 1014 0 4 0 687 0 4891 4 = 5 91 0 0 0 352064 91748 13041 0 0 0 1979 0 6 0 743 0 4950 6 = 6 88 0 0 0 346236 96024 7562 0 0 0 2070 0 2 0 736 0 2057 4 = 3 93 0 1 0 366876 82184 10081 0 0 0 1502 0 50 0 828 0 2607 5 = 5 90 0 0 0 321600 112344 9724 0 0 0 3984 0 1 0 885 0 3440 5 = 5 90 2 0 0 321200 112716 24244 0 0 0 2571 0 8 0 794 0 33756 8= 17 75 0 0 1 329016 107352 16676 0 0 0 2834 0 10 0 922 0 44430 9= 20 71 0 0 0 328620 107328 13862 0 0 0 1713 0 2 0 616 0 8500 4 = 7 90 0 0 0 317376 114780 3798 0 0 0 1321 0 0 0 514 0 1137 2 = 2 97 0 5 0 334724 102396 12999 0 0 0 1106 0 39 0 672 0 24891 5= 13 82 0 3 3 336904 102068 12886 0 0 0 2527 0 29 0 879 0 18817 6= 10 84 2 0 0 324008 110416 14625 0 0 0 2378 0 4 0 745 0 28433 7= 14 79 0 0 4 333692 104400 15440 0 0 0 1154 0 7 0 645 0 31156 4= 16 80 4 12 0 352328 91884 19349 0 0 0 1095 0 5 0 623 0 46283 = 9 21 70 5 5 0 345796 95412 15790 0 0 0 1896 0 2 0 727 0 50062 10= 20 70 4 1 0 331440 105316 16178 0 0 0 2909 0 5 0 1728 0 48194 9= 20 71 0 0 0 326664 108364 11869 0 0 0 1533 0 61 0 640 0 11855 5= 9 85 0 0 2 322980 110452 5970 0 0 0 1520 0 0 0 594 0 1614 3 = 3 95 0 10 6 343108 97884 17571 0 0 0 1409 0 14 0 643 0 33528 = 6 18 76 ------=_NextPart_000_002C_01C43783.3EB43F20-- From pgsql-performance-owner@postgresql.org Tue May 11 19:17:02 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7896FD1D13D for ; Tue, 11 May 2004 19:13:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51026-10 for ; Tue, 11 May 2004 19:12:42 -0300 (ADT) Received: from lifeintegrity.com (h000476f4f1ab.ne.client2.attbi.com [66.30.212.158]) by svr1.postgresql.org (Postfix) with ESMTP id 025E1D1B229 for ; Tue, 11 May 2004 19:12:37 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lifeintegrity.com (Postfix) with ESMTP id 3C86F6004C for ; Tue, 11 May 2004 18:13:17 -0400 (EDT) Received: from lifeintegrity.com ([127.0.0.1]) by localhost (pawan.lifeintegrity.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13707-01-3 for ; Tue, 11 May 2004 18:13:16 -0400 (EDT) Received: by lifeintegrity.com (Postfix, from userid 1000) id E30846004B; Tue, 11 May 2004 18:13:15 -0400 (EDT) Date: Tue, 11 May 2004 18:13:15 -0400 To: pgsql-performance@postgresql.org Subject: Re: Quad processor options Message-ID: <20040511221315.GA12117@lifeintegrity.com> Mail-Followup-To: pgsql-performance@postgresql.org References: <40A14170.7000201@turtle-entertainment.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i From: allanwind@lifeintegrity.com (Allan Wind) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/96 X-Sequence-Number: 6927 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2004-05-11T15:29:46-0600, scott.marlowe wrote: > The other nice thing about the LSI cards is that you can install >1 and= =20 > the act like one big RAID array. i.e. install two cards with a 20 drive= =20 > RAID0 then make a RAID1 across them, and if one or the other cards itself= =20 > fails, you've still got 100% of your data sitting there. Nice to know yo= u=20 > can survive the complete failure of one half of your chain. ... unless that dying controller corrupted your file system. Depending on your tolerance for risk, you may not want to operate for long with a file system in an unknown state. Btw, the Intel and LSI Logic RAID controller cards have suspeciously similar specificationsi, so I would be surprised if one is an OEM. /Allan --=20 Allan Wind P.O. Box 2022 Woburn, MA 01888-0022 USA --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAoU/7uDtNyOwreTYRAlTHAKCxQrS0WvfZoHM9/kkBJFZhemLbrACfV7v9 UYTYsfWyeKAroFjPsadturE= =DROF -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE-- From pgsql-performance-owner@postgresql.org Tue May 11 19:24:23 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B7447D1D2F8 for ; Tue, 11 May 2004 19:23:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55565-09 for ; Tue, 11 May 2004 19:23:30 -0300 (ADT) Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by svr1.postgresql.org (Postfix) with ESMTP id 70B6ED1BB64 for ; Tue, 11 May 2004 19:23:27 -0300 (ADT) Received: from [65.87.16.98] (HELO [10.0.0.210]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 4213513; Tue, 11 May 2004 15:23:29 -0700 Subject: Re: Quad processor options From: "J. Andrew Rogers" To: Bjoern Metzdorf , pgsql-performance@postgresql.org In-Reply-To: <40A12452.3040505@turtle-entertainment.de> References: <40A12452.3040505@turtle-entertainment.de> Content-Type: text/plain Organization: Message-Id: <1084314209.4100.45.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 11 May 2004 15:23:29 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/97 X-Sequence-Number: 6928 On Tue, 2004-05-11 at 12:06, Bjoern Metzdorf wrote: > Has anyone experiences with quad Xeon or quad Opteron setups? I am > looking at the appropriate boards from Tyan, which would be the only > option for us to buy such a beast. The 30k+ setups from Dell etc. don't > fit our budget. > > I am thinking of the following: > > Quad processor (xeon or opteron) > 5 x SCSI 15K RPM for Raid 10 + spare drive > 2 x IDE for system > ICP-Vortex battery backed U320 Hardware Raid > 4-8 GB Ram Just to add my two cents to the fray: We use dual Opterons around here and prefer them to the Xeons for database servers. As others have pointed out, the Opteron systems will scale well to more than two processors unlike the Xeon. I know a couple people with quad Opterons and it apparently scales very nicely, unlike quad Xeons which don't give you much more. On some supercomputing hardware lists I'm on, they seem to be of the opinion that the current Opteron fabric won't really show saturation until you have 6-8 CPUs connected to it. Like the other folks said, skip the 15k drives. Those will only give you a marginal improvement for an integer factor price increase over 10k drives. Instead spend your money on a nice RAID controller with a fat cache and a backup battery, and maybe some extra spindles for your array. I personally like the LSI MegaRAID 320-2, which I always max out to 256Mb of cache RAM and the required battery. A maxed out LSI 320-2 should set you back <$1k. Properly configured, you will notice large improvements in the performance of your disk subsystem, especially if you have a lot of writing going on. I would recommend getting the Opterons, and spending the relatively modest amount of money to get nice RAID controller with a large write-back cache while sticking with 10k drives. Depending on precisely how you configure it, this should cost you no more than $10-12k. We just built a very similar configuration, but with dual Opterons on an HDAMA motherboard rather than a quad Tyan, and it cost <$6k inclusive of everything. Add the money for 4 of the 8xx processors and the Tyan quad motherboard, and the sum comes out to a very reasonable number for what you are getting. j. andrew rogers From pgsql-performance-owner@postgresql.org Tue May 11 19:33:01 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 96480D1D272 for ; Tue, 11 May 2004 19:33:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59263-08 for ; Tue, 11 May 2004 19:32:42 -0300 (ADT) Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by svr1.postgresql.org (Postfix) with ESMTP id 5E66DD1B22A for ; Tue, 11 May 2004 19:32:38 -0300 (ADT) Received: from [65.87.16.98] (HELO [10.0.0.210]) by mx1.neopolitan.us (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 4213593; Tue, 11 May 2004 15:32:41 -0700 Subject: Re: Configuring PostgreSQL to minimize impact of From: "J. Andrew Rogers" To: Paul Tuckfield , pgsql-performance@postgresql.org In-Reply-To: <905B43ED-A395-11D8-A34F-000393BD6C3E@tuckfield.com> References: <905B43ED-A395-11D8-A34F-000393BD6C3E@tuckfield.com> Content-Type: text/plain Organization: Message-Id: <1084314760.4100.53.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 11 May 2004 15:32:41 -0700 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/98 X-Sequence-Number: 6929 On Tue, 2004-05-11 at 14:52, Paul Tuckfield wrote: > Love that froogle. > > It looks like a nice card. One thing I didn't get straight is if > the cache is writethru or write back. The LSI MegaRAID reading/writing/caching behavior is user configurable. It will support both write-back and write-through, and IIRC, three different algorithms for reading (none, read-ahead, adaptive). Plenty of configuration options. It is a pretty mature and feature complete hardware RAID implementation. j. andrew rogers From pgsql-performance-owner@postgresql.org Tue May 11 19:53:41 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9AB77D1CAF5 for ; Tue, 11 May 2004 19:45:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63938-02 for ; Tue, 11 May 2004 19:44:55 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 5F79AD1B347 for ; Tue, 11 May 2004 19:44:51 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4BMiYHs014984; Tue, 11 May 2004 16:44:34 -0600 (MDT) Date: Tue, 11 May 2004 16:44:21 -0600 (MDT) From: "scott.marlowe" To: Allan Wind Cc: Subject: Re: Quad processor options In-Reply-To: <20040511221315.GA12117@lifeintegrity.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/100 X-Sequence-Number: 6931 On Tue, 11 May 2004, Allan Wind wrote: > On 2004-05-11T15:29:46-0600, scott.marlowe wrote: > > The other nice thing about the LSI cards is that you can install >1 and > > the act like one big RAID array. i.e. install two cards with a 20 drive > > RAID0 then make a RAID1 across them, and if one or the other cards itself > > fails, you've still got 100% of your data sitting there. Nice to know you > > can survive the complete failure of one half of your chain. > > ... unless that dying controller corrupted your file system. Depending > on your tolerance for risk, you may not want to operate for long with a > file system in an unknown state. It would have to be the primary controller for that to happen. The way the LSI's work is that you disable the BIOS on the 2nd to 4th cards, and the first card, with the active BIOS acts as the primary controller. In this case, that means the main card is doing the RAID1 work, then handing off the data to the subordinate cards. The subordinate cards do all their own RAID0 work. mobo ---controller 1-- Btw, the Intel and LSI Logic RAID controller cards have suspeciously > similar specificationsi, so I would be surprised if one is an OEM. Hmmm. I'll take a closer look. From pgsql-admin-owner@postgresql.org Tue May 11 19:53:41 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4888BD1B910 for ; Tue, 11 May 2004 19:46:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 61509-07 for ; Tue, 11 May 2004 19:46:26 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 81BD2D1D350 for ; Tue, 11 May 2004 19:46:22 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Tue, 11 May 2004 15:46:19 -0700 In-Reply-To: <40A13A78.9000607@turtle-entertainment.de> References: <40A13A78.9000607@turtle-entertainment.de> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <089ED266-A39D-11D8-A34F-000393BD6C3E@tuckfield.com> Content-Transfer-Encoding: 7bit Cc: "Pgsql-Admin (E-mail)" , "scott.marlowe" , pgsql-performance@postgresql.org From: Paul Tuckfield Subject: Re: [PERFORM] Quad processor options Date: Tue, 11 May 2004 15:46:25 -0700 To: Bjoern Metzdorf X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/100 X-Sequence-Number: 13416 I'm confused why you say the system is 70% busy: the vmstat output shows 70% *idle*. The vmstat you sent shows good things and ambiguous things: - si and so are zero, so your not paging/swapping. Thats always step 1. you're fine. - bi and bo (physical IO) shows pretty high numbers for how many disks you have. (assuming random IO) so please send an "iostat 10" sampling during peak. - note that cpu is only 30% busy. that should mean that adding cpus will *not* help. - the "cache" column shows that linux is using 2.3G for cache. (way too much) you generally want to give memory to postgres to keep it "close" to the user, not leave it unused to be claimed by linux cache (need to leave *some* for linux tho) My recommendations: - I'll bet you have a low value for shared buffers, like 10000. On your 3G system you should ramp up the value to at least 1G (125000 8k buffers) unless something else runs on the system. It's best to not do things too drastically, so if Im right and you sit at 10000 now, try going to 30000 then 60000 then 125000 or above. - if the above is off base, then I wonder why we see high runque numbers in spite of over 60% idle cpu. Maybe some serialization happening somewhere. Also depending on how you've laid out your 4 disk drives, you may see all IOs going to one drive. the 7M/sec is on the high side, if that's the case. iostat numbers will reveal if it's skewed, and if it's random, tho linux iostat doesn't seem to report response times (sigh) Response times are the golden metric when diagnosing IO thruput in OLTP / stripe situation. On May 11, 2004, at 1:41 PM, Bjoern Metzdorf wrote: > scott.marlowe wrote: > >> Well, from what I've read elsewhere on the internet, it would seem >> the Opterons scale better to 4 CPUs than the basic Xeons do. Of >> course, the exception to this is SGI's altix, which uses their own >> chipset and runs the itanium with very good memory bandwidth. > > This is basically what I read too. But I cannot spent money on a quad > opteron just for testing purposes :) > >> But, do you really need more CPU horsepower? >> Are you I/O or CPU or memory or memory bandwidth bound? If you're >> sitting at 99% idle, and iostat says your drives are only running at >> some small percentage of what you know they could, you might be >> memory or memory bandwidth limited. Adding two more CPUs will not >> help with that situation. > > Right now we have a dual xeon 2.4, 3 GB Ram, Mylex extremeraid > controller, running 2 Compaq BD018122C0, 1 Seagate ST318203LC and 1 > Quantum ATLAS_V_18_SCA. > > iostat show between 20 and 60 % user avg-cpu. And this is not even > peak time. > > I attached a "vmstat 10 120" output for perhaps 60-70% peak load. > >> If your I/O is saturated, then the answer may well be a better RAID >> array, with many more drives plugged into it. Do you have any spare >> drives you can toss on the machine to see if that helps? Sometimes >> going from 4 drives in a RAID 1+0 to 6 or 8 or more can give a big >> boost in performance. > > Next drives I'll buy will certainly be 15k scsi drives. > >> In short, don't expect 4 CPUs to solve the problem if the problem >> isn't really the CPUs being maxed out. >> Also, what type of load are you running? Mostly read, mostly >> written, few connections handling lots of data, lots of connections >> each handling a little data, lots of transactions, etc... > > In peak times we can get up to 700-800 connections at the same time. > There are quite some updates involved, without having exact numbers > I'll think that we have about 70% selects and 30% updates/inserts. > >> If you are doing lots of writing, make SURE you have a controller >> that supports battery backed cache and is configured to write-back, >> not write-through. > > Could you recommend a certain controller type? The only battery backed > one that I found on the net is the newest model from icp-vortex.com. > > Regards, > Bjoern > ~# vmstat 10 120 > procs memory swap io system > cpu > r b w swpd free buff cache si so bi bo in cs > us sy id > 1 1 0 24180 10584 32468 2332208 0 1 0 2 1 2 > 2 0 0 > 0 2 0 24564 10480 27812 2313528 8 0 7506 574 1199 8674 > 30 7 63 > 2 1 0 24692 10060 23636 2259176 0 18 8099 298 2074 6328 > 25 7 68 > 2 0 0 24584 18576 21056 2299804 3 6 13208 305 1598 8700 > 23 6 71 > 1 21 1 24504 16588 20912 2309468 4 0 1442 1107 754 6874 > 42 13 45 > 6 1 0 24632 13148 19992 2319400 0 0 2627 499 1184 9633 > 37 6 58 > 5 1 0 24488 10912 19292 2330080 5 0 3404 150 1466 10206 > 32 6 61 > 4 1 0 24488 12180 18824 2342280 3 0 2934 40 1052 3866 > 19 3 78 > 0 0 0 24420 14776 19412 2347232 6 0 403 216 1123 4702 > 22 3 74 > 0 0 0 24548 14408 17380 2321780 4 0 522 715 965 6336 > 25 5 71 > 4 0 0 24676 12504 17756 2322988 0 0 564 830 883 7066 > 31 6 63 > 0 3 0 24676 14060 18232 2325224 0 0 483 388 1097 3401 > 21 3 76 > 0 2 1 24676 13044 18700 2322948 0 0 701 195 1078 5187 > 23 3 74 > 2 0 0 24676 21576 18752 2328168 0 0 467 177 1552 3574 > 18 3 78 > > ---------------------------(end of > broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to > majordomo@postgresql.org) From pgsql-performance-owner@postgresql.org Tue May 11 22:06:56 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 63A9CD1D6C5 for ; Tue, 11 May 2004 22:04:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97086-01 for ; Tue, 11 May 2004 22:04:16 -0300 (ADT) Received: from mail.gotfrag.com (g01.gotfrag.com [66.208.110.11]) by svr1.postgresql.org (Postfix) with ESMTP id 1D8A7D1D294 for ; Tue, 11 May 2004 22:04:12 -0300 (ADT) Received: from jcoene2 (roc-66-66-149-175.rochester.rr.com [66.66.149.175]) by mail.gotfrag.com (8.12.10/8.12.8) with ESMTP id i4C14Fam018939; Tue, 11 May 2004 21:04:15 -0400 (EDT) (envelope-from jcoene@gotfrag.com) Message-Id: <200405120104.i4C14Fam018939@mail.gotfrag.com> From: "Jason Coene" To: "'Paul Tuckfield'" Cc: Subject: Re: Intermittent slowdowns, connection delays Date: Tue, 11 May 2004 21:04:16 -0400 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0008_01C4379B.858F34F0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Thread-Index: AcQ3sp2KAxcpGDclSVGjnIIy1PXloQABF5PA X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/101 X-Sequence-Number: 6932 This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C4379B.858F34F0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi Paul, Thanks for the valuable feedback. I suspect you're correct about the serialization in some capacity, but the actual cause is eluding me. Basically, every time a registered user checks a page, the site has to authenticate them (with a query against a table with > 200,000 records). It doesn't update this table, however - it updates another table with "user stats" information (last click, last ip, etc). From what I've seen, there doesn't seem to be any serious locking issues. It does make sense when a number of users whose information isn't in cache, it could take a bit longer - but AFAIK this shouldn't prevent other simultaneous queries. What else could cause such serialization? If I look at open locks (this is a view, info from pg tables): relname | mode | numlocks ----------------------+------------------+---------- users | AccessShareLock | 4 userstats | AccessShareLock | 4 pg_statistic | AccessShareLock | 2 users_ix_id | AccessShareLock | 2 countries | AccessShareLock | 2 comments | AccessShareLock | 2 countries_ix_id | AccessShareLock | 2 userstats_ix_id | AccessShareLock | 2 comments_ix_parentid | AccessShareLock | 2 users | RowExclusiveLock | 1 filequeue_ix_id | AccessShareLock | 1 pg_class | AccessShareLock | 1 vopenlocks | AccessShareLock | 1 pg_locks | AccessShareLock | 1 userstats | RowExclusiveLock | 1 filequeue | AccessShareLock | 1 pg_class_oid_index | AccessShareLock | 1 Also of note, executing a random "in the blue" query on our "users" table returns results very fast. While there's no doubt that caching may help, returning a row that is definitely not cached is very fast: < 0.05 sec. Top tells me that the system isn't using much memory - almost always under 100MB (of the 2GB we have). Is there a way to increase the amount of physical RAM that PG uses? It seems there's a lot of room there. Postgresql.conf has: shared_buffers = 16384 sort_mem = 8192 vacuum_mem = 8192 Also, would queries becoming serialized effect connection delays? I think there's still something else at large here... I've attached a vmstat output, while running dd. The RAID array is tw0. It does show the tw0 device getting significantly more work, numbers not seen during normal operation. Thanks, Jason Coene Gotfrag eSports 585-598-6621 Phone 585-598-6633 Fax jcoene@gotfrag.com http://www.gotfrag.com -----Original Message----- From: Paul Tuckfield [mailto:paul@tuckfield.com] Sent: Tuesday, May 11, 2004 7:50 PM To: Jason Coene Subject: Re: [PERFORM] Intermittent slowdowns, connection delays The things you point out suggest a heavy dependence on good cache performance (typical of OLTP mind you) Do not be fooled if a query runs in 2 seconds then the second run takes < .01 secons: the first run put it in cache the second got all cache hits :) But beyond that, in an OLTP system, and typical website backing database, "cache is king". And serialization is the devil So look for reasons why your cache performance might deteriorate during peak, (like large historical tables that users pull up dozens of scattered rows from, flooding cache) or why you may be serializing somewhere inside postgres (ex. if every page hit re-logs in, then theres probably serialization trying to spawn what must be 40 processes/sec assuming your 11hit/sec avg peaks at about 40/sec) Also: I am really surprised you see zero IO in the vmstat you sent, but I'm unfamiliar with BSD version of vmstat. AFAIR, Solaris shows cached filesystem reads as "page faults" which is rather confusing. Since you have 1500 page faults per second, yet no paging (bi bo) does thins mean the 1500 page faults are filesystem IO that pg is doing? do an objective test on an idle system by dd'ing a large file in and watching what vmstat does. On May 11, 2004, at 3:10 PM, Jason Coene wrote: > Hi All, > > We have a Postgres 7.4.1 server running on FreeBSD 5.2. Hardware is a > Dual > Xeon 2.6 (HT enabled), 2 GB Memory, 3Ware SATA RAID-5 w/ 4 7200 RPM > Seagate > disks and gigabit Intel Server Ethernet. The server is dedicated to > serving > data to our web-based CMS. > > We have a few web servers load balanced, and we do around 1M page > impressions per day. Our website is highly personalized, and we've > optimized it to limit the number of queries, but we still see between > 2 and > 3 SELECT's (with JOIN's) and 1 UPDATE per page load, selectively more > - a > fair volume. > > The single UPDATE per page load is updating a timestamp in a small > table > (about 150,000 rows) with only 1 index (on the 1 field that needs to be > matched). > > We're seeing some intermittent spikes in query time as actual > connection > time. I.e., during these seemingly random spikes, our debug output > looks > like this (times from start of HTTP request): > > SQL CONNECTION CREATING 'gf' > 0.0015 - ESTABLISHING CONNECTION > 1.7113 - CONNECTION OK > SQL QUERY ID 1 COST 0.8155 ROWS 1 > SQL QUERY ID 2 COST 0.5607 ROWS 14 > .. etc.. (all queries taking more time than normal, see below) > > Refresh the page 2 seconds later, and we'll get: > > SQL CONNECTION CREATING 'gf' > 0.0017 - ESTABLISHING CONNECTION > 0.0086 - CONNECTION OK > SQL QUERY ID 1 COST 0.0128 ROWS 1 > SQL QUERY ID 2 COST 0.0033 ROWS 14 > .. etc.. (with same queries) > > Indeed, during these types, it takes a moment for "psql" to connect on > the > command line (from the same machine using a local file socket), so > it's not > a network issue or a web-server issue. During these spurts, there's > nothing > too out of the ordinary in vmstat, systat or top. > > These programs show that we're not using much CPU (usually 60-80% > idle), and > disks usage is virtually nil. I've attached 60 seconds of "vmstat 5". > Memory usage looks like this (constantly): > > Mem: 110M Active, 1470M Inact, 206M Wired, 61M Cache, 112M Buf, 26M > Free > > I've cleaned up and tested query after query, and nothing is a "hog". > On an > idle server, every query will execute in < 0.05 sec. Perhaps some of > you > veterans have ideas? > > Thanks, > > Jason Coene > Gotfrag eSports > 585-598-6621 Phone > 585-598-6633 Fax > jcoene@gotfrag.com > http://www.gotfrag.com > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org ------=_NextPart_000_0008_01C4379B.858F34F0 Content-Type: text/plain; name="vmstatdd.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vmstatdd.txt" (dd if=3D/dev/zero of=3DX and vmstat 1) procs memory page disks faults cpu r b w avm fre flt re pi po fr sr tw0 fd0 in sy cs us sy = id 1 0 0 245496 294952 652 0 0 0 322 4 0 0 584 0 481 3 5 = 92 0 0 1 245772 294892 10681 0 0 0 2380 0 0 0 780 0 1634 4 = 4 92 0 0 0 248404 293132 6783 0 0 0 1220 0 4 0 641 0 2005 3 = 4 93 0 0 0 243740 296180 89 0 0 0 780 0 0 0 363 0 1038 0 1= 99 0 0 0 247576 293808 4253 0 0 1 897 0 1 0 568 0 1082 2 2= 97 0 0 0 243740 296172 1142 0 0 0 1009 0 0 0 408 0 681 1 1= 99 0 0 0 246072 294572 7128 0 0 0 1495 0 2 0 981 0 2501 4 = 3 93 4 0 0 248988 278004 3977 0 0 0 1292 0 117 0 672 0 6082 2 1= 1 87 <-begin dd 0 0 4 253156 254952 19216 0 0 0 381 0 161 0 657 0 26432 4 = 22 74 8 1 0 256124 239764 23349 0 0 0 827 0 115 0 621 0 32020 5 = 22 73 0 6 4 263236 212068 9642 0 0 0 579 0 174 0 745 0 28661 4 2= 5 71 0 0 13 269392 193476 9983 0 0 0 278 0 137 0 685 0 36589 5 = 24 70 1 6 1 260652 181072 12043 0 0 0 2517 0 130 0 683 0 33646 3= 25 72 0 2 7 265188 162412 7449 0 0 0 39 0 127 0 615 0 38233 6 2= 0 73 4 6 0 266368 144724 8641 0 0 0 822 0 133 0 624 0 35629 5 2= 3 72 0 8 3 268884 125808 4609 0 0 0 703 0 138 0 659 0 38966 3 2= 4 73 7 6 3 271564 111468 19948 0 0 0 1106 0 97 0 589 0 39840 4= 25 71 0 19 3 283872 87824 14926 0 0 0 61 0 105 0 736 0 48359 4= 25 71 0 12 10 291640 109440 7975 12 0 0 3469 11675 147 0 794 0 33581= 6 25 69 8 14 0 292732 89640 11033 6 0 0 6700 0 149 0 782 0 28399 = 6 24 70 4 10 0 293364 71488 13177 0 0 0 8696 0 154 0 2623 0 29119 = 9 22 69 1 5 0 271656 67016 8240 0 0 0 6490 0 170 0 4574 0 30951 5 = 25 70 0 0 3 262840 99200 15399 0 0 0 6278 10814 145 0 879 0 21206 = 5 22 73 0 4 0 261216 95812 12921 0 0 0 1830 0 147 0 595 0 13402 3= 9 87 1 6 0 262204 95228 1843 0 0 0 863 0 119 0 580 0 1266 1 1= 98 0 1 4 265508 82648 15552 0 0 0 4328 0 132 0 736 0 22650 3= 18 78 0 0 6 259920 76580 19770 0 0 0 2761 0 90 0 514 0 37724 3= 24 72 7 0 4 261600 67540 10702 0 0 0 2718 0 62 0 536 0 53733 4= 24 71 0 8 6 269752 98244 7281 0 0 0 5609 13252 139 0 614 0 40253 = 3 27 70 <- end dd 6 10 0 274424 73056 6511 0 0 0 6758 0 161 0 673 0 33534 5= 24 71 0 8 5 283500 111436 20968 0 0 0 3808 12137 36 0 848 0 42361 = 7 22 70 0 10 6 287016 457036 16186 0 0 0 89317 0 11 0 736 0 55810 = 13 29 58 4 15 0 293108 451540 18923 0 0 0 1156 0 8 0 725 0 53572 1= 3 22 64 0 6 4 279592 460536 22728 0 0 0 4110 0 6 0 782 0 26818 15= 15 69 ------=_NextPart_000_0008_01C4379B.858F34F0-- From pgsql-admin-owner@postgresql.org Wed May 12 01:04:08 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3CFEFD1D6B8; Wed, 12 May 2004 01:04:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 27962-06; Wed, 12 May 2004 01:03:44 -0300 (ADT) Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 41608D1D2D3; Wed, 12 May 2004 01:03:43 -0300 (ADT) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id A853A8332; Wed, 12 May 2004 06:03:41 +0200 (CEST) Date: Wed, 12 May 2004 06:03:41 +0200 (CEST) From: Dennis Bjorklund To: Bjoern Metzdorf Cc: pgsql-performance@postgresql.org, "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options In-Reply-To: <40A12452.3040505@turtle-entertainment.de> 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 postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/102 X-Sequence-Number: 13418 On Tue, 11 May 2004, Bjoern Metzdorf wrote: > I am curious if there are any real life production quad processor setups > running postgresql out there. Since postgresql lacks a proper > replication/cluster solution, we have to buy a bigger machine. Du you run the latest version of PG? I've read the thread bug have not seen any information about what pg version. All I've seen was a reference to debian which might just as well mean that you run pg 7.2 (probably not but I have to ask). Some classes of queries run much faster in pg 7.4 then in older versions so if you are lucky that can help. -- /Dennis Bj�rklund From pgsql-admin-owner@postgresql.org Wed May 12 01:59:08 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BFD33D1D0F7; Wed, 12 May 2004 01:59:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41812-01; Wed, 12 May 2004 01:58:44 -0300 (ADT) Received: from elbereth.noviforum.si (unknown [193.189.169.66]) by svr1.postgresql.org (Postfix) with ESMTP id 6349BD1B4FD; Wed, 12 May 2004 01:58:42 -0300 (ADT) Received: from elbereth.noviforum.si (localhost [127.0.0.1]) by elbereth.noviforum.si (8.12.10/8.12.10) with ESMTP id i4C4wWHh010100; Wed, 12 May 2004 06:58:32 +0200 Received: (from gregab@localhost) by elbereth.noviforum.si (8.12.10/8.12.10/Submit) id i4C4wWZJ010099; Wed, 12 May 2004 06:58:32 +0200 Date: Wed, 12 May 2004 06:58:32 +0200 From: Grega Bremec To: "scott.marlowe" Cc: Bjoern Metzdorf , pgsql-performance@postgresql.org, "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options Message-ID: <20040512045832.GA10035@elbereth.noviforum.si> References: <40A13A78.9000607@turtle-entertainment.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UugvWAfsgieZRqgk" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i Organization: Noviforum, Ltd., Software & Media X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/103 X-Sequence-Number: 13419 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ...and on Tue, May 11, 2004 at 03:02:24PM -0600, scott.marlowe used the key= board: >=20 > If you get the LSI megaraid, make sure you're running the latest megaraid= =20 > 2 driver, not the older, slower 1.18 series. If you are running linux,= =20 > look for the dkms packaged version. dkms, (Dynamic Kernel Module System)= =20 > automagically compiles and installs source rpms for drivers when you=20 > install them, and configures the machine to use them to boot up. Most=20 > drivers seem to be slowly headed that way in the linux universe, and I=20 > really like the simplicity and power of dkms. >=20 Hi, Given the fact LSI MegaRAID seems to be a popular solution around here, and many of you folx use Linux as well, I thought sharing this piece of info might be of use. Running v2 megaraid driver on a 2.4 kernel is actually not a good idea _at_ _all_, as it will silently corrupt your data in the event of a disk failure. Sorry to have to say so, but we tested it (on kernels up to 2.4.25, not sure about 2.4.26 yet) and it comes out it doesn't do hotswap the way it should. Somehow the replaced disk drives are not _really_ added to the array, which continues to work in degraded mode for a while and (even worse than that) then starts to think the replaced disk is in order without actually having resynced it, thus beginning to issue writes to non-existant areas of it. The 2.6 megaraid driver indeed seems to be a merged version of the above driver and the old one, giving both improved performance and correct functionality in the event of a hotswap taking place. Hope this helped, --=20 Grega Bremec Senior Administrator Noviforum Ltd., Software & Media http://www.noviforum.si/ --UugvWAfsgieZRqgk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAoa74Do/EMYD4+osRAu8OAKCHKNc2BID0DV9q2jPhOctfVH79GwCgoxwk h4GKg3G3V7U9fnSr5go47zQ= =wAWF -----END PGP SIGNATURE----- --UugvWAfsgieZRqgk-- From pgsql-performance-owner@postgresql.org Wed May 12 02:35:05 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 39829D1D6F3 for ; Wed, 12 May 2004 02:35:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48386-01 for ; Wed, 12 May 2004 02:34:41 -0300 (ADT) Received: from gold.penza.com.ru (gold.penza.com.ru [80.82.170.1]) by svr1.postgresql.org (Postfix) with ESMTP id 0684FD1D6D5 for ; Wed, 12 May 2004 02:34:38 -0300 (ADT) Received: from topalm2.dionis.local ([80.82.171.26]) by gold.penza.com.ru (8.8.7/8.8.7/PUUG) with ESMTP id JAA15341 for ; Wed, 12 May 2004 09:33:26 +0400 From: spied@yandex.ru Received: from [10.0.0.10] (helo=ed.DIONIS.LOCAL) by topalm2.dionis.local with esmtp (Exim 3.35 #1 (Debian)) id 1BNmO2-0006Od-00 for ; Wed, 12 May 2004 09:34:34 +0400 Date: Wed, 12 May 2004 09:34:34 +0400 X-Mailer: The Bat! (v1.61) Personal Reply-To: spied@yandex.ru X-Priority: 3 (Normal) Message-ID: <8886978734.20040512093434@yandex.ru> To: pgsql-performance@postgresql.org Subject: Re: Quad processor options In-Reply-To: <40A13BAB.5080500@turtle-entertainment.de> References: <40A12452.3040505@turtle-entertainment.de> <40A13BAB.5080500@turtle-entertainment.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200405/104 X-Sequence-Number: 6935 BM> see my other mail. BM> We are running Linux, Kernel 2.4. As soon as the next debian version BM> comes out, I'll happily switch to 2.6 :) it's very simple to use 2.6 with testing version, but if you like woody - you can simple install several packets from testing or backports.org if you think about perfomance you must use lastest version of postgresql server - it can be installed from testing or backports.org too (but postgresql from testing depend from many other testing packages). i think if you upgade existing system you can use backports.org for nevest packages, if you install new - use testing - it can be used on production servers today From pgsql-performance-owner@postgresql.org Wed May 12 03:11:35 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EC5EED1C93C for ; Wed, 12 May 2004 03:11:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51455-07 for ; Wed, 12 May 2004 03:11:12 -0300 (ADT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id D7140D1D6D4 for ; Wed, 12 May 2004 03:08:57 -0300 (ADT) Received: from notnot (gateway.census.gov.ph [203.172.28.97]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id i4C65ph9000939 for ; Wed, 12 May 2004 14:06:02 +0800 Message-Id: <200405120606.i4C65ph9000939@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: Subject: Using LIKE expression problem.. Date: Wed, 12 May 2004 14:18:48 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C4382C.0E830300" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQ36PyToYr6Qa3qRZWAE3h3fvjy6Q== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_70_80, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/105 X-Sequence-Number: 6936 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C4382C.0E830300 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi everybody.. Before anything else I would like to thank all those person who answers my previous question. again thank you very much This is my question . In my query .. Select * from table1 where lastname LIKE 'PUNCIA%'.. In the query plan ..it uses seq scan rather than index scan .. why ? I have index on lastname, firtname. Thanks ------=_NextPart_000_0000_01C4382C.0E830300 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi everybody..

   

     Before anything else I would li= ke to thank all those person who answers my previous question… again thank you very much

 

This is my question …

   

     In my query .. Select * from ta= ble1 where lastname LIKE  ‘PUNCIA%’..

 

In the query plan ..it uses seq scan rather than index s= can .. why ? I have index on lastname, firtname…

 

 

Thanks

------=_NextPart_000_0000_01C4382C.0E830300-- From pgsql-performance-owner@postgresql.org Wed May 12 03:41:29 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D21F5D1D716 for ; Wed, 12 May 2004 03:41:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 60090-03 for ; Wed, 12 May 2004 03:41:08 -0300 (ADT) Received: from houston.familyhealth.com.au (fhnet.arach.net.au [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id BBF99D1D6C5 for ; Wed, 12 May 2004 03:41:05 -0300 (ADT) Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (8.12.9p1/8.12.9) with ESMTP id i4C6d6WL096552; Wed, 12 May 2004 14:39:07 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Message-ID: <40A1C8BD.8060900@familyhealth.com.au> Date: Wed, 12 May 2004 14:48:29 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Michael Ryan S. Puncia" Cc: pgsql-performance@postgresql.org Subject: Re: Using LIKE expression problem.. References: <200405120606.i4C65ph9000939@mail.census.gov.ph> In-Reply-To: <200405120606.i4C65ph9000939@mail.census.gov.ph> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/106 X-Sequence-Number: 6937 > In the query plan ..it uses seq scan rather than index scan .. why ? I > have index on lastname, firtname� Have you run VACUUM ANALYZE; on the table recently? Chris From pgsql-performance-owner@postgresql.org Wed May 12 04:39:52 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C09A4D1D524 for ; Wed, 12 May 2004 04:39:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66994-10 for ; Wed, 12 May 2004 04:39:31 -0300 (ADT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id 83B3CD1D6E5 for ; Wed, 12 May 2004 04:35:56 -0300 (ADT) Received: from notnot (gateway.census.gov.ph [203.172.28.97]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id i4C7XCh9003495; Wed, 12 May 2004 15:33:25 +0800 Message-Id: <200405120733.i4C7XCh9003495@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: "'Christopher Kings-Lynne'" , "'Michael Ryan S. Puncia'" Cc: Subject: Re: Using LIKE expression problem.. Date: Wed, 12 May 2004 15:46:07 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQ37Pen7Kup97zuSyuPGa0/XTyv+gACBkNw In-Reply-To: <40A1C8BD.8060900@familyhealth.com.au> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/107 X-Sequence-Number: 6938 Yes , I already do that but the same result .. LIKE uses seq scan -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Christopher Kings-Lynne Sent: Wednesday, May 12, 2004 2:48 PM To: Michael Ryan S. Puncia Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Using LIKE expression problem.. > In the query plan ..it uses seq scan rather than index scan .. why ? I > have index on lastname, firtname. Have you run VACUUM ANALYZE; on the table recently? Chris ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Wed May 12 04:51:12 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DD4F2D1D74F for ; Wed, 12 May 2004 04:51:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 73452-05 for ; Wed, 12 May 2004 04:50:52 -0300 (ADT) Received: from houston.familyhealth.com.au (fhnet.arach.net.au [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 62038D1D747 for ; Wed, 12 May 2004 04:50:49 -0300 (ADT) Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (8.12.9p1/8.12.9) with ESMTP id i4C7njWL004317; Wed, 12 May 2004 15:49:45 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Message-ID: <40A1D94E.9030605@familyhealth.com.au> Date: Wed, 12 May 2004 15:59:10 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Michael Ryan S. Puncia" Cc: pgsql-performance@postgresql.org Subject: Re: Using LIKE expression problem.. References: <200405120733.i4C7XCh9003495@mail.census.gov.ph> In-Reply-To: <200405120733.i4C7XCh9003495@mail.census.gov.ph> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/108 X-Sequence-Number: 6939 Are you in a non-C locale? Chris Michael Ryan S. Puncia wrote: > Yes , I already do that but the same result .. LIKE uses seq scan > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Christopher > Kings-Lynne > Sent: Wednesday, May 12, 2004 2:48 PM > To: Michael Ryan S. Puncia > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Using LIKE expression problem.. > > >>In the query plan ..it uses seq scan rather than index scan .. why ? I >>have index on lastname, firtname. > > > Have you run VACUUM ANALYZE; on the table recently? > > Chris > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Wed May 12 05:07:42 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AB57FD1D74D for ; Wed, 12 May 2004 05:07:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 75244-06 for ; Wed, 12 May 2004 05:07:23 -0300 (ADT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id 56C99D1D75B for ; Wed, 12 May 2004 05:06:58 -0300 (ADT) Received: from notnot (gateway.census.gov.ph [203.172.28.97]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id i4C84gh9004444; Wed, 12 May 2004 16:04:50 +0800 Message-Id: <200405120804.i4C84gh9004444@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: "'Christopher Kings-Lynne'" , "'Michael Ryan S. Puncia'" Cc: Subject: Re: Using LIKE expression problem.. Date: Wed, 12 May 2004 16:17:36 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQ39pCP+kPy71w1QX2Ob2hZdib3tgAApX5g In-Reply-To: <40A1D94E.9030605@familyhealth.com.au> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/109 X-Sequence-Number: 6940 Sorry .. I am a newbie and I don't know :( How can I know that I am in C locale ? How can I change my database to use C locale? -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Christopher Kings-Lynne Sent: Wednesday, May 12, 2004 3:59 PM To: Michael Ryan S. Puncia Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Using LIKE expression problem.. Are you in a non-C locale? Chris Michael Ryan S. Puncia wrote: > Yes , I already do that but the same result .. LIKE uses seq scan > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Christopher > Kings-Lynne > Sent: Wednesday, May 12, 2004 2:48 PM > To: Michael Ryan S. Puncia > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Using LIKE expression problem.. > > >>In the query plan ..it uses seq scan rather than index scan .. why ? I >>have index on lastname, firtname. > > > Have you run VACUUM ANALYZE; on the table recently? > > Chris > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html From pgsql-performance-owner@postgresql.org Thu May 13 22:04:24 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8F569D1B194 for ; Thu, 13 May 2004 22:04:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66758-08 for ; Thu, 13 May 2004 22:03:58 -0300 (ADT) Received: from lamb.mcmillan.net.nz (leibniz.catalyst.net.nz [202.49.159.7]) by svr1.postgresql.org (Postfix) with ESMTP id C99FFD1B181 for ; Thu, 13 May 2004 22:03:53 -0300 (ADT) Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) by lamb.mcmillan.net.nz (Postfix) with ESMTP id 4B7DEAE178BF; Wed, 12 May 2004 20:58:13 +1200 (NZST) Subject: Re: Quad processor options From: Andrew McMillan To: Paul Tuckfield Cc: Bjoern Metzdorf , pgsql-performance@postgresql.org In-Reply-To: <089ED266-A39D-11D8-A34F-000393BD6C3E@tuckfield.com> References: <40A13A78.9000607@turtle-entertainment.de> <089ED266-A39D-11D8-A34F-000393BD6C3E@tuckfield.com> Content-Type: text/plain Message-Id: <1084352292.4785.37.camel@lamb.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.7 Date: Wed, 12 May 2004 20:58:13 +1200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/133 X-Sequence-Number: 6964 On Tue, 2004-05-11 at 15:46 -0700, Paul Tuckfield wrote: > - the "cache" column shows that linux is using 2.3G for cache. (way too > much) you generally want to give memory to postgres to keep it "close" to > the user, not leave it unused to be claimed by linux cache (need to leave > *some* for linux tho) > > My recommendations: > - I'll bet you have a low value for shared buffers, like 10000. On > your 3G system you should ramp up the value to at least 1G (125000 8k buffers) > unless something else runs on the system. It's best to not do things too > drastically, so if Im right and you sit at 10000 now, try going to > 30000 then 60000 then 125000 or above. Huh? Doesn't this run counter to almost every piece of PostgreSQL performance tuning advice given? I run my own boxes with buffers set to around 10000-20000 and an effective_cache_size = 375000 (8k pages - around 3G). That's working well with PostgreSQL 7.4.2 under Debian "woody" (using Oliver Elphick's backported packages from http://people.debian.org/~elphick/debian/). Regards, Andrew. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267 Q: How much does it cost to ride the Unibus? A: 2 bits. ------------------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Wed May 12 10:44:16 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3361ED1E20F for ; Wed, 12 May 2004 10:44:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52023-10 for ; Wed, 12 May 2004 10:43:57 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id 3F044D1E216 for ; Wed, 12 May 2004 10:43:53 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 2CB8F3BCA2; Wed, 12 May 2004 10:43:59 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 29FDB3BC5D for ; Wed, 12 May 2004 10:43:59 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Wed, 12 May 2004 06:06:12 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 197D93DDF9 for ; Wed, 12 May 2004 06:05:46 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Wed, 12 May 2004 06:05:46 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Wed, 12 May 2004 06:03:18 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CFD49D1BAC0 for ; Wed, 12 May 2004 06:03:18 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 89295-06 for ; Wed, 12 May 2004 06:02:59 -0300 (ADT) X-Received: from frodo.hserus.net (frodo.hserus.net [204.74.68.40]) by svr1.postgresql.org (Postfix) with ESMTP id BFDA4D1BA56 for ; Wed, 12 May 2004 06:02:56 -0300 (ADT) X-Received: from concord.pspl.co.in ([202.54.11.72]:61096 helo=frodo.hserus.net) by frodo.hserus.net with asmtp (Cipher TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.34 #0) id 1BNpdi-000KhO-5x by authid with plain; Wed, 12 May 2004 14:32:58 +0530 Message-ID: <40A1E83E.2000402@frodo.hserus.net> Date: Wed, 12 May 2004 14:32:54 +0530 From: Shridhar Daithankar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Doug Y Cc: psql-performance@postgresql.org Subject: Re: Clarification on some settings References: <6.0.1.1.2.20040511163104.01e9cbb0@mail.traderonline.com> In-Reply-To: <6.0.1.1.2.20040511163104.01e9cbb0@mail.traderonline.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Wed, 12 May 2004 10:43:55 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-performance@postgresql.org ReSent-Subject: Re: [PERFORM] Clarification on some settings ReSent-Message-ID: <20040512104354.A35531@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/111 X-Sequence-Number: 6942 Doug Y wrote: > Hello, > I've been having some performance issues with a DB I use. I'm trying > to come up with some performance recommendations to send to the > "adminstrator". > > Hardware: > CPU0: Pentium III (Coppermine) 1000MHz (256k cache) > CPU1: Pentium III (Coppermine) 1000MHz (256k cache) > Memory: 3863468 kB (4 GB) > OS: Red Hat Linux release 7.2 (Enigma) > Kernel: 2.4.9-31smp > I/O I believe is a 3-disk raid 5. > > /proc/sys/kernel/shmmax and /proc/sys/kernel/shmall were set to 2G > > Postgres version: 7.3.4 > The DB schema is, well to put it nicely... not exactly normalized. No > constraints to speak of except for the requisite not-nulls on the > primary keys (many of which are compound). Keys are mostly varchar(256) > fields. > > Ok for what I'm uncertain of... > shared_buffers: > According to http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > Its more of a staging area and more isn't necessarily better. That psql > relies on the OS to cache data for later use. > But according to > http://www.ca.postgresql.org/docs/momjian/hw_performance/node3.html its > where psql caches previous data for queries because the OS cache is > slower, and should be as big as possible without causing swap. > Those seem to be conflicting statements. In our case, the > "administrator" kept increasing this until performance seemed to > increase, which means its now 250000 (x 8k is 2G). > Is this just a staging area for data waiting to move to the OS cache, or > is this really the area that psql caches its data? It is the area where postgresql works. It updates data in this area and pushes it to OS cache for disk writes later. By experience, larger does not mean better for this parameter. For multi-Gig RAM machines, the best(on an average for wide variety of load) value found to be around 10000-15000. May be even lower. It is a well known fact that raising this parameter unnecessarily decreases the performance. You indicate that best performance occurred at 250000. This is very very large compared to other people's experience. > > effective_cache_size: > Again, according to the Varlena guide this tells psql how much system > memory is available for it to do its work in. > until recently, this was set at the default value of 1000. It was just > recently increased to 180000 (1.5G) > according to > http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html > it should be about 25% of memory? No rule of thumb. It is amount of memory OS will dedicate to psotgresql data buffers. Depending uponn what else you run on machine, it could be straight-forward or noodly value to calculate. For a 4GB machine, 1.5GB is quite good but coupled with 2G of shared buffers it could push the machines to swap storm. And swapping shared buffers is a big performance hit. > > Finally sort_mem: > Was until recently left at the default of 1000. Is now 16000. Sort memory is per sort not per query or per connection. So depending upon how many concurrent connections you entertain, it could take quite a chuck of RAM. > > Increasing the effective cache and sort mem didn't seem to make much of > a difference. I'm guessing the eff cache was probably raised a bit too > much, and shared_buffers is way to high. I agree. For shared buffers start with 5000 and increase in batches on 1000. Or set it to a high value and check with ipcs for maximum shared memory usage. If share memory usage peaks at 100MB, you don't need more than say 120MB of buffers. > > What can I do to help determine what the proper settings should be > and/or look at other possible choke points. What should I look for in > iostat, mpstat, or vmstat as red flags that cpu, memory, or i/o bound? Yes. vmstat is usually a lot of help to locate the bottelneck. > DB maintenance wise, I don't believe they were running vacuum full until > I told them a few months ago that regular vacuum analyze no longer > cleans out dead tuples. Now normal vac is run daily, vac full weekly > (supposedly). How can I tell from the output of vacuum if the vac fulls > aren't being done, or not done often enough? Or from the system tables, > what can I read? In 7.4 you can do vacuum full verbose and it will tell you the stats at the end. For 7.3.x, its not there. I suggest you vacuum full database once.(For large database, dumping restoring might work faster. Dump/restore and vacuum full both lock the database exclusively i.e. downtime. So I guess faster the better for you. But there is no tool/guideline to determine which way to go.) > Is there anywhere else I can look for possible clues? I have access to > the DB super-user, but not the system root/user. Other than hardware tuning, find out slow/frequent queries. Use explain analyze to determine why they are so slow. Forgetting to typecast a where clause and using sequential scan could cost you lot more than mistuned postgresql configuration. > Thank you for your time. Please let me know any help or suggestions you > may have. Unfortunately upgrading postgres, OS, kernel, or re-writing > schema is most likely not an option. I hope you can change your queries. HTH Shridhar From pgsql-admin-owner@postgresql.org Wed May 12 07:15:15 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8150ED1E0D5 for ; Wed, 12 May 2004 07:15:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02196-10 for ; Wed, 12 May 2004 07:14:44 -0300 (ADT) Received: from email11.aon.at (WARSL402PIP7.highway.telekom.at [195.3.96.94]) by svr1.postgresql.org (Postfix) with SMTP id 4869CD1DBAF for ; Wed, 12 May 2004 07:14:40 -0300 (ADT) Received: (qmail 79886 invoked from network); 12 May 2004 10:14:40 -0000 Received: from m148p012.dipool.highway.telekom.at (HELO PASCAL) ([62.46.8.108]) (envelope-sender ) by qmail2rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 12 May 2004 10:14:40 -0000 From: Manfred Koizar To: Paul Tuckfield Cc: Bjoern Metzdorf , "Pgsql-Admin (E-mail)" , "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: [PERFORM] Quad processor options Date: Wed, 12 May 2004 12:17:27 +0200 Message-ID: <5nt3a05l0q1ivc2179qsjqhpa141stu9ek@email.aon.at> References: <40A13A78.9000607@turtle-entertainment.de> <089ED266-A39D-11D8-A34F-000393BD6C3E@tuckfield.com> In-Reply-To: <089ED266-A39D-11D8-A34F-000393BD6C3E@tuckfield.com> X-Mailer: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/104 X-Sequence-Number: 13420 On Tue, 11 May 2004 15:46:25 -0700, Paul Tuckfield wrote: >- the "cache" column shows that linux is using 2.3G for cache. (way too >much) There is no such thing as "way too much cache". > you generally want to give memory to postgres to keep it "close" to >the user, Yes, but only a moderate amount of memory. > not leave it unused to be claimed by linux cache Cache is not unused memory. >- I'll bet you have a low value for shared buffers, like 10000. On >your 3G system > you should ramp up the value to at least 1G (125000 8k buffers) In most cases this is almost the worst thing you can do. The only thing even worse would be setting it to 1.5 G. Postgres is just happy with a moderate shared_buffers setting. We usually recommend something like 10000. You could try 20000, but don't increase it beyond that without strong evidence that it helps in your particular case. This has been discussed several times here, on -hackers and on -general. Search the archives for more information. Servus Manfred From pgsql-admin-owner@postgresql.org Wed May 12 07:23:14 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9C4B1D1E0F2 for ; Wed, 12 May 2004 07:23:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10076-04 for ; Wed, 12 May 2004 07:22:49 -0300 (ADT) Received: from jove.stowe.co.za (jove.stowe.co.za [196.30.30.131]) by svr1.postgresql.org (Postfix) with ESMTP id B4F89D1D753 for ; Wed, 12 May 2004 07:22:35 -0300 (ADT) Received: from [196.30.30.135] ([196.30.30.135]) by jove.stowe.co.za (SGI-8.9.3/8.9.3) with ESMTP id MAA30875 for ; Wed, 12 May 2004 12:22:55 +0300 (SAST) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: <5nt3a05l0q1ivc2179qsjqhpa141stu9ek@email.aon.at> References: <40A13A78.9000607@turtle-entertainment.de> <089ED266-A39D-11D8-A34F-000393BD6C3E@tuckfield.com> <5nt3a05l0q1ivc2179qsjqhpa141stu9ek@email.aon.at> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Halford Dace Subject: Re: [PERFORM] Quad processor options Date: Wed, 12 May 2004 12:27:18 +0200 To: pgsql-admin@postgresql.org X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/105 X-Sequence-Number: 13421 On 12 May 2004, at 12:17 PM, Manfred Koizar wrote: > On Tue, 11 May 2004 15:46:25 -0700, Paul Tuckfield > wrote: > >> - I'll bet you have a low value for shared buffers, like 10000. On >> your 3G system >> you should ramp up the value to at least 1G (125000 8k buffers) > > In most cases this is almost the worst thing you can do. The only > thing > even worse would be setting it to 1.5 G. > > Postgres is just happy with a moderate shared_buffers setting. We > usually recommend something like 10000. You could try 20000, but don't > increase it beyond that without strong evidence that it helps in your > particular case. > > This has been discussed several times here, on -hackers and on > -general. > Search the archives for more information. We have definitely found this to be true here. We have some fairly complex queries running on a rather underpowered box (beautiful but steam-driven old Silicon Graphics Challenge DM). We ended up using a very slight increase to shared buffers, but gaining ENORMOUSLY through proper optimisation of queries, appropriate indices and the use of optimizer-bludgeons like "SET ENABLE_SEQSCAN = OFF" Hal From pgsql-admin-owner@postgresql.org Wed May 12 10:46:25 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08130D1E222; Wed, 12 May 2004 10:46:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52216-10; Wed, 12 May 2004 10:46:03 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 63CA6D1E20F; Wed, 12 May 2004 10:45:58 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i4CDitHs019670; Wed, 12 May 2004 07:44:55 -0600 (MDT) Date: Wed, 12 May 2004 07:44:37 -0600 (MDT) From: "scott.marlowe" To: Grega Bremec Cc: Bjoern Metzdorf , , "Pgsql-Admin (E-mail)" Subject: Re: [PERFORM] Quad processor options In-Reply-To: <20040512045832.GA10035@elbereth.noviforum.si> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: scott.marlowe@ihs.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/109 X-Sequence-Number: 13425 On Wed, 12 May 2004, Grega Bremec wrote: > ...and on Tue, May 11, 2004 at 03:02:24PM -0600, scott.marlowe used the keyboard: > > > > If you get the LSI megaraid, make sure you're running the latest megaraid > > 2 driver, not the older, slower 1.18 series. If you are running linux, > > look for the dkms packaged version. dkms, (Dynamic Kernel Module System) > > automagically compiles and installs source rpms for drivers when you > > install them, and configures the machine to use them to boot up. Most > > drivers seem to be slowly headed that way in the linux universe, and I > > really like the simplicity and power of dkms. > > > > Hi, > > Given the fact LSI MegaRAID seems to be a popular solution around here, and > many of you folx use Linux as well, I thought sharing this piece of info > might be of use. > > Running v2 megaraid driver on a 2.4 kernel is actually not a good idea _at_ > _all_, as it will silently corrupt your data in the event of a disk failure. > > Sorry to have to say so, but we tested it (on kernels up to 2.4.25, not sure > about 2.4.26 yet) and it comes out it doesn't do hotswap the way it should. > > Somehow the replaced disk drives are not _really_ added to the array, which > continues to work in degraded mode for a while and (even worse than that) > then starts to think the replaced disk is in order without actually having > resynced it, thus beginning to issue writes to non-existant areas of it. > > The 2.6 megaraid driver indeed seems to be a merged version of the above > driver and the old one, giving both improved performance and correct > functionality in the event of a hotswap taking place. This doesn't make any sense to me, since the hot swapping is handled by the card autonomously. I also tested it with a hot spare and pulled one drive and it worked fine during our acceptance testing. However, I've got a hot spare machine I can test on, so I'll try it again and see if I can make it fail. when testing it, was the problem present in certain RAID configurations or only one type or what? I'm curious to try and reproduce this problem, since I've never heard of it before. Also, what firmware version were those megaraid cards, ours is fairly new, as we got it at the beginning of this year, and I'm wondering if it is a firmware issue. From pgsql-performance-owner@postgresql.org Wed May 12 15:58:24 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 56C85D1E274 for ; Wed, 12 May 2004 15:58:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38636-08 for ; Wed, 12 May 2004 15:58:00 -0300 (ADT) Received: from lorax.kcilink.com (lorax.kcilink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id 659B3D1E26B for ; Wed, 12 May 2004 15:57:58 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kcilink.com (Postfix) with ESMTP id A10403FB1 for ; Wed, 12 May 2004 14:57:59 -0400 (EDT) Received: from lorax.kcilink.com ([127.0.0.1]) by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 42731-08-2 for ; Wed, 12 May 2004 14:57:58 -0400 (EDT) Received: by lorax.kcilink.com (Postfix, from userid 8) id ACB473FAF; Wed, 12 May 2004 14:57:58 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints Date: Wed, 12 May 2004 14:57:58 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 31 Message-ID: References: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> <40A03435.7020300@geophile.com> <24638.1084245829@sss.pgh.pa.us> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kcilink.com 1084388278 14464 65.205.34.180 (12 May 2004 18:57:58 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Wed, 12 May 2004 18:57:58 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, berkeley-unix) Cancel-Lock: sha1:xdoNdGrsXUv8IumQkajGbH/YP6s= X-Virus-Scanned: by amavisd-new at kcilink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/113 X-Sequence-Number: 6944 >>>>> "TL" == Tom Lane writes: TL> Jack Orenstein writes: >> I'm looking at one case in which two successive transactions, each >> updating a handful of records, take 26 and 18 *seconds* (not msec) to >> complete. These transactions normally complete in under 30 msec. TL> I've seen installations in which it seemed that the "normal" query load TL> was close to saturating the available disk bandwidth, and the extra load TL> imposed by a background VACUUM just pushed the entire system's response TL> time over a cliff. In an installation that has I/O capacity to spare, me stand up waving hand... ;-) This is my only killer problem left. I always peg my disk usage at 100% when vacuum runs, and other queries are slow too. When not running vacuum, my queries are incredibly zippy fast, including joins and counts and group by's on upwards of 100k rows at a time. TL> I suspect that the same observations hold true for checkpoints, though TL> I haven't specifically seen an installation suffering from that effect. I don't see that. But I also set checkpoint segments to about 50 on my big server. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Wed May 12 16:05:33 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8B5DDD1E253 for ; Wed, 12 May 2004 16:05:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41127-06 for ; Wed, 12 May 2004 16:05:09 -0300 (ADT) Received: from lorax.kcilink.com (lorax.kcilink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id 1B1CFD1E2C8 for ; Wed, 12 May 2004 16:05:07 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kcilink.com (Postfix) with ESMTP id 59A2A3FAE for ; Wed, 12 May 2004 15:05:06 -0400 (EDT) Received: from lorax.kcilink.com ([127.0.0.1]) by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 91451-01-4 for ; Wed, 12 May 2004 15:05:05 -0400 (EDT) Received: by lorax.kcilink.com (Postfix, from userid 8) id D9C353EB7; Wed, 12 May 2004 15:05:05 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Configuring PostgreSQL to minimize impact of Date: Wed, 12 May 2004 15:05:05 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 18 Message-ID: References: <905B43ED-A395-11D8-A34F-000393BD6C3E@tuckfield.com> <1084314760.4100.53.camel@localhost.localdomain> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kcilink.com 1084388705 14464 65.205.34.180 (12 May 2004 19:05:05 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Wed, 12 May 2004 19:05:05 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, berkeley-unix) Cancel-Lock: sha1:vTsaLsWps91VsdnZ44+ELyitKGE= X-Virus-Scanned: by amavisd-new at kcilink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/114 X-Sequence-Number: 6945 >>>>> "JAR" == J Andrew Rogers writes: JAR> The LSI MegaRAID reading/writing/caching behavior is user configurable. JAR> It will support both write-back and write-through, and IIRC, three JAR> different algorithms for reading (none, read-ahead, adaptive). Plenty JAR> of configuration options. For PG max performance, you want to set it for write-back and read-ahead (adaptive has been claimed to be bad, but I got similar performace from read-ahead and adaptive, so YMMV). -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Wed May 12 16:25:21 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 92950D1E275 for ; Wed, 12 May 2004 16:25:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46054-05 for ; Wed, 12 May 2004 16:24:59 -0300 (ADT) Received: from black.geophile.com (h004005242b8e.ne.client2.attbi.com [24.91.49.146]) by svr1.postgresql.org (Postfix) with ESMTP id 61520D1E26E for ; Wed, 12 May 2004 16:24:57 -0300 (ADT) Received: from black.geophile.com (localhost.localdomain [127.0.0.1]) by black.geophile.com (8.12.8/8.12.8) with ESMTP id i4CJMlxY002022; Wed, 12 May 2004 15:22:48 -0400 Received: (from apache@localhost) by black.geophile.com (8.12.8/8.12.8/Submit) id i4CJMlCU002020; Wed, 12 May 2004 15:22:47 -0400 X-Authentication-Warning: black.geophile.com: apache set sender to jao@geophile.com using -f Received: from 64.119.142.34 ([64.119.142.34]) by geophile.com (IMP) with HTTP for ; Wed, 12 May 2004 15:22:47 -0400 Message-ID: <1084389767.40a27987437da@geophile.com> Date: Wed, 12 May 2004 15:22:47 -0400 From: jao@geophile.com To: Vivek Khera Cc: pgsql-performance@postgresql.org Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints References: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> <40A03435.7020300@geophile.com> <24638.1084245829@sss.pgh.pa.us> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Originating-IP: 64.119.142.34 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200405/115 X-Sequence-Number: 6946 Quoting Vivek Khera : > >>>>> "TL" == Tom Lane writes: > > TL> Jack Orenstein writes: > >> I'm looking at one case in which two successive transactions, each > >> updating a handful of records, take 26 and 18 *seconds* (not msec) to > >> complete. These transactions normally complete in under 30 msec. > > TL> I've seen installations in which it seemed that the "normal" query load > TL> was close to saturating the available disk bandwidth, and the extra load > TL> imposed by a background VACUUM just pushed the entire system's response > TL> time over a cliff. In an installation that has I/O capacity to spare, > ... > TL> I suspect that the same observations hold true for checkpoints, though > TL> I haven't specifically seen an installation suffering from that effect. > > I don't see that. But I also set checkpoint segments to about 50 on > my big server. But wouldn't that affect checkpoint frequency, not checkpoint cost? Jack Orenstein ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. From pgsql-performance-owner@postgresql.org Wed May 12 16:29:33 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 57997D1E247 for ; Wed, 12 May 2004 16:29:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46783-06 for ; Wed, 12 May 2004 16:29:11 -0300 (ADT) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id E3420D1E179 for ; Wed, 12 May 2004 16:29:09 -0300 (ADT) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id F04FA2178A for ; Wed, 12 May 2004 15:29:10 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: <1084389767.40a27987437da@geophile.com> References: <200405101909.i4AJ9Wv09415@candle.pha.pa.us> <40A03435.7020300@geophile.com> <24638.1084245829@sss.pgh.pa.us> <1084389767.40a27987437da@geophile.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Vivek Khera Subject: Re: Configuring PostgreSQL to minimize impact of checkpoints Date: Wed, 12 May 2004 15:29:11 -0400 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/116 X-Sequence-Number: 6947 On May 12, 2004, at 3:22 PM, jao@geophile.com wrote: >> >> I don't see that. But I also set checkpoint segments to about 50 on >> my big server. > > But wouldn't that affect checkpoint frequency, not checkpoint cost Seems reasonable. I suppose checkpointing doesn't cost as much disk I/O as vacuum does. My checkpoints are also on a separate RAID volume on a separate RAID channel, so perhaps that gives me extra bandwidth to perform the checkpoints. From pgsql-admin-owner@postgresql.org Wed May 12 19:41:24 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B80F5D1E389; Wed, 12 May 2004 19:41:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 94426-09; Wed, 12 May 2004 19:41:05 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id D622AD1E376; Wed, 12 May 2004 19:41:01 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BO2PO-0008Fs-00; Thu, 13 May 2004 00:41:02 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BO2PK-0000G9-00; Thu, 13 May 2004 00:40:58 +0200 Message-ID: <40A2A7FA.6060403@turtle-entertainment.de> Date: Thu, 13 May 2004 00:40:58 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Quad processor options - summary References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/118 X-Sequence-Number: 13434 Hi, at first, many thanks for your valuable replies. On my quest for the ultimate hardware platform I'll try to summarize the things I learned. ------------------------------------------------------------- This is our current setup: Hardware: Dual Xeon DP 2.4 on a TYAN S2722-533 with HT enabled 3 GB Ram (2 x 1 GB + 2 x 512 MB) Mylex Extremeraid Controller U160 running RAID 10 with 4 x 18 GB SCSI 10K RPM, no other drives involved (system, pgdata and wal are all on the same volume). Software: Debian 3.0 Woody Postgresql 7.4.1 (selfcompiled, no special optimizations) Kernel 2.4.22 + fixes Database specs: Size of a gzipped -9 full dump is roughly 1 gb 70-80% selects, 20-30% updates (roughly estimated) up to 700-800 connections during peak times kernel.shmall = 805306368 kernel.shmmax = 805306368 max_connections = 900 shared_buffers = 20000 sort_mem = 16384 checkpoint_segments = 6 statistics collector is enabled (for pg_autovacuum) Loads: We are experiencing average CPU loads of up to 70% during peak hours. As Paul Tuckfield correctly pointed out, my vmstat output didn't support this. This output was not taken during peak times, it was freshly grabbed when I wrote my initial mail. It resembles perhaps 50-60% peak time load (30% cpu usage). iostat does not give results about disk usage, I don't know exactly why, the blk_read/wrtn columns are just empty. (Perhaps due to the Mylex rd driver, I don't know). ------------------------------------------------------------- Suggestions and solutions given: Anjan Dave reported, that he is pretty confident with his Quad Xeon setups, which will cost less than $20K at Dell with a reasonable hardware setup. ( Dell 6650 with 2.0GHz/1MB cache/8GB Memory, 5 internal drives (4 in RAID 10, 1 spare) on U320, 128MB cache on the PERC controller) Scott Marlowe pointed out, that one should consider more than 4 drives (6 to 8, 10K rpm is enough, 15K is rip-off) for a Raid 10 setup, because that can boost performance quite a lot. One should also be using a battery backed raid controller. Scott has good experiences with the LSI Megaraid single channel controller, which is reasonably priced at ~ $500. He also stated, that 20-30% writes on a database is quite a lot. Next Rob Sell told us about his research on more-than-2-way Intel based systems. The memory bandwidth on the xeon platform is always shared between the cpus. While a 2way xeon may perform quite well, a 4way system will be suffering due to the reduced memory bandwith available for each processor. J. Andrew Roberts supports this. He said that 4way opteron systems scale much better than a 4way xeon system. Scaling limits begin at 6-8 cpus on the opteron platform. He also says that a fully equipped dual channel LSI Megaraid 320 with 256MB cache ram will be less that $1K. A complete 4way opteron system will be at $10K-$12K. Paul Tuckfield then gave the suggestion to bump up my shared_buffers. With a 3GB memory system, I could happily be using 1GB for shared buffers (125000). This was questioned by Andrew McMillian, Manfred Kolzar and Halford Dace, who say that common tuning advices limit reasonable settings to 10000-20000 shared buffers, because the OS is better at caching than the database. ------------------------------------------------------------- Conclusion: After having read some comparisons between n-way xeon and opteron systems: http://www.anandtech.com/IT/showdoc.html?i=1982 http://www.aceshardware.com/read.jsp?id=60000275 I was given the impression, that an opteron system is the way to go. This is what I am considering the ultimate platform for postgresql: Hardware: Tyan Thunder K8QS board 2-4 x Opteron 848 in NUMA mode 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor) LSI Megaraid 320-2 with 256 MB cache ram and battery backup 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over both channels (3 + 4) for pgdata including indexes and wal. 2 x 80 GB S-ATA IDE for system, running linux software raid 1 or available onboard hardware raid (perhaps also 2 x 36 GB SCSI) Software: Debian Woody in amd64 biarch mode, or perhaps Redhat/SuSE Enterprise 64bit distributions. Kernel 2.6 Postgres 7.4.2 in 64bit mode shared_buffers = 20000 a bumbed up effective_cache_size Now the only problem left (besides my budget) is the availability of such a system. I have found some vendors which ship similar systems, so I will have to talk to them about my dream configuration. I will not self build this system, there are too many obstacles. I expect this system to come out on about 12-15K Euro. Very optimistic, I know :) These are the vendors I found up to now: http://www.appro.com/product/server_4144h.asp http://www.appro.com/product/server_4145h.asp http://www.pyramid.de/d/builttosuit/server/4opteron.shtml http://www.rainbow-it.co.uk/productslist.aspx?CategoryID=4&selection=2 http://www.quadopteron.com/ They all seem to sell more or less the same system. I found also some other vendors which built systems on celestica or amd boards, but they are way too expensive. Buying such a machine is worth some good thoughts. If budget is a limit and such a machine might not be maxed out during the next few months, it would make more sense to go for a slightly slower system and an upgrade when more power is needed. Thanks again for all your replies. I hope to have given a somehow clear summary. Regards, Bjoern From pgsql-performance-owner@postgresql.org Thu May 13 10:02:39 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 27E46D1E92A for ; Thu, 13 May 2004 10:02:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 90351-06 for ; Thu, 13 May 2004 10:02:19 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id 15644D1B231 for ; Thu, 13 May 2004 10:02:16 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 3D54D374D2; Thu, 13 May 2004 10:02:21 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 3A6A0374D0 for ; Thu, 13 May 2004 10:02:21 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Thu, 13 May 2004 03:45:26 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id DD95535690 for ; Thu, 13 May 2004 03:45:21 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Thu, 13 May 2004 03:45:21 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Thu, 13 May 2004 03:44:35 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4009CD1E632 for ; Thu, 13 May 2004 03:44:35 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07155-06 for ; Thu, 13 May 2004 03:44:16 -0300 (ADT) X-Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id 53E94D1E6A5 for ; Thu, 13 May 2004 03:44:14 -0300 (ADT) X-Received: from localhost (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with ESMTP id 4C5AC1FC5; Thu, 13 May 2004 02:44:14 -0400 (EDT) X-Received: from bob.samurai.com ([127.0.0.1]) by localhost (bob.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 49620-01-7; Thu, 13 May 2004 02:44:11 -0400 (EDT) X-Received: from [192.168.1.101] (d226-89-59.home.cgocable.net [24.226.89.59]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by bob.samurai.com (Postfix) with ESMTP id 707811FDE; Thu, 13 May 2004 02:44:09 -0400 (EDT) Subject: Re: Clarification on some settings From: Neil Conway To: Shridhar Daithankar Cc: Doug Y , psql-performance@postgresql.org In-Reply-To: <40A1E83E.2000402@frodo.hserus.net> References: <6.0.1.1.2.20040511163104.01e9cbb0@mail.traderonline.com> <40A1E83E.2000402@frodo.hserus.net> Content-Type: text/plain Message-Id: <1084430647.21452.40.camel@tokyo> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 13 May 2004 02:44:07 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Thu, 13 May 2004 10:02:14 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-performance@postgresql.org ReSent-Subject: Re: [PERFORM] Clarification on some settings ReSent-Message-ID: <20040513100214.W58152@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/119 X-Sequence-Number: 6950 On Wed, 2004-05-12 at 05:02, Shridhar Daithankar wrote: > I agree. For shared buffers start with 5000 and increase in batches on 1000. Or > set it to a high value and check with ipcs for maximum shared memory usage. If > share memory usage peaks at 100MB, you don't need more than say 120MB of buffers. If your DB touches more than 100MB worth of buffers over time, shared memory consumption won't peak at 100MB. PG shared buffers are only "recycled" when there are no unused buffers available, so this isn't a really valid way to determine the right shared_buffers setting. -Neil From pgsql-performance-owner@postgresql.org Thu May 13 10:57:17 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 54659D1B181 for ; Thu, 13 May 2004 10:57:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06332-04 for ; Thu, 13 May 2004 10:56:59 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id 07CB3D1B178 for ; Thu, 13 May 2004 10:56:55 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 1A20F34450; Thu, 13 May 2004 10:57:01 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 18F83342AA for ; Thu, 13 May 2004 10:57:01 -0300 (ADT) X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.3) with LMTP; Thu, 13 May 2004 04:30:42 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id DB7F335A95 for ; Thu, 13 May 2004 04:30:33 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Thu, 13 May 2004 04:30:33 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.3) with LMTP; Thu, 13 May 2004 04:29:49 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D5124D1C9C4 for ; Thu, 13 May 2004 04:29:49 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 19662-01 for ; Thu, 13 May 2004 04:29:30 -0300 (ADT) X-Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [202.0.58.21]) by svr1.postgresql.org (Postfix) with ESMTP id 46909D1E741 for ; Thu, 13 May 2004 04:29:28 -0300 (ADT) X-Received: from smtp-3.paradise.net.nz (smtp-3b.paradise.net.nz [202.0.32.212]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0HXN00EUM65364@linda-2.paradise.net.nz> for psql-performance@postgresql.org; Thu, 13 May 2004 19:29:28 +1200 (NZST) X-Received: from paradise.net.nz (203-79-100-194.adsl.paradise.net.nz [203.79.100.194]) by smtp-3.paradise.net.nz (Postfix) with ESMTP id A386DADF83; Thu, 13 May 2004 19:29:27 +1200 (NZST) Date: Thu, 13 May 2004 19:31:29 +1200 From: Mark Kirkwood Subject: Re: Clarification on some settings In-reply-to: <40A1E83E.2000402@frodo.hserus.net> To: Shridhar Daithankar Cc: Doug Y , psql-performance@postgresql.org Message-id: <40A32451.4010801@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040404 References: <6.0.1.1.2.20040511163104.01e9cbb0@mail.traderonline.com> <40A1E83E.2000402@frodo.hserus.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Thu, 13 May 2004 10:56:55 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-performance@postgresql.org ReSent-Subject: Re: [PERFORM] Clarification on some settings ReSent-Message-ID: <20040513105655.G58152@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/123 X-Sequence-Number: 6954 Note that effective_cache_size is merely a hint to that planner to say "I have this much os buffer cache to use" - it is not actually allocated. It is shared_buffers that will hurt you if it is too high (10000 - 25000 is the usual sweet spot). best wishes Mark Shridhar Daithankar wrote: > >> >> Increasing the effective cache and sort mem didn't seem to make much >> of a difference. I'm guessing the eff cache was probably raised a bit >> too much, and shared_buffers is way to high. > > > I agree. For shared buffers start with 5000 and increase in batches on > 1000. Or set it to a high value and check with ipcs for maximum shared > memory usage. If share memory usage peaks at 100MB, you don't need > more than say 120MB of buffers. > > > From pgsql-performance-owner@postgresql.org Thu May 13 09:33:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 108B9D1E901 for ; Thu, 13 May 2004 09:33:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 84494-05 for ; Thu, 13 May 2004 09:32:59 -0300 (ADT) Received: from mail.interlogica.org (host34-209.pool8174.interbusiness.it [81.74.209.34]) by svr1.postgresql.org (Postfix) with ESMTP id 4F4A7D1E7FD for ; Thu, 13 May 2004 09:32:49 -0300 (ADT) Received: from [10.2.8.2] (helo=ilbug) by mail.interlogica.org with esmtp (Exim 3.16 #1) id 1BOFV9-0003nm-00 for pgsql-performance@postgresql.org; Thu, 13 May 2004 14:39:52 +0200 From: "Fabio Panizzutti" To: Subject: Query plan on identical tables differs . Why ? Date: Thu, 13 May 2004 14:42:51 +0200 Message-ID: <005c01c438e7$ced25c30$3c02020a@ufficio> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=LINES_OF_YELLING, LINES_OF_YELLING_2 X-Spam-Level: X-Archive-Number: 200405/118 X-Sequence-Number: 6949 Hello I'm tuning a postgresql (7.4.2) server for best performance . I have a question about the planner . I have two identical tables : one stores short data (about 2.000.000 record now) and the other historycal data ( about 8.000.000 record now and growing ...) A simple test query : select tag_id,valore_tag,data_tag from storico_misure where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=37423 ; Takes 57,637 ms on the short table and 1321,448 ms (!!) on the historycal table .Tables are vacuumed and reindexed . Tables and query plans : \d storico_misure Table "tenore.storico_misure" Column | Type | Modifiers -------------------------+-----------------------------+----------- data_tag | timestamp without time zone | not null tag_id | integer | not null unita_misura | character varying(6) | not null valore_tag | numeric(20,3) | not null qualita | integer | not null numero_campioni | numeric(5,0) | frequenza_campionamento | numeric(3,0) | Indexes: "pk_storico_misure_2" primary key, btree (data_tag, tag_id) "pk_anagtstorico_misuree_idx_2" btree (tag_id) "storico_misure_data_tag_idx_2" btree (data_tag) storico=# \d storico_misure_short Table "tenore.storico_misure_short" Column | Type | Modifiers -------------------------+-----------------------------+----------- data_tag | timestamp without time zone | not null tag_id | integer | not null unita_misura | character varying(6) | not null valore_tag | numeric(20,3) | not null qualita | integer | not null numero_campioni | numeric(5,0) | frequenza_campionamento | numeric(3,0) | Indexes: "storico_misure_short_pkey_2" primary key, btree (data_tag, tag_id) "pk_anagtstorico_misuree_short_idx_2" btree (tag_id) "storico_misure_short_data_tag_idx_2" btree (data_tag) storico=# storico=# storico=# explain select tag_id,valore_tag,data_tag from storico_misure where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=37423 ; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ -------------------------- Index Scan using pk_storico_misure_2 on storico_misure (cost=0.00..1984.64 rows=658 width=21) Index Cond: ((data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone) AND (tag_id = 37423)) (2 rows) Time: 1,667 ms storico=# explain select tag_id,valore_tag,data_tag from storico_misure_short where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=37423 ; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ - Index Scan using pk_anagtstorico_misuree_short_idx_2 on storico_misure_short (cost=0.00..1784.04 rows=629 width=20) Index Cond: (tag_id = 37423) Filter: ((data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone)) How can i force the planner to use the same query plan ? I'd like to test if using the same query plan i've better performace . Thanks in advance this is my posgresql.conf #----------------------------------------------------------------------- ---- # CONNECTIONS AND AUTHENTICATION #----------------------------------------------------------------------- ---- # - Connection Settings - tcpip_socket = true max_connections = 100 # note: increasing max_connections costs about 500 bytes of shared # memory per connection slot, in addition to costs from shared_buffers # and max_locks_per_transaction. #superuser_reserved_connections = 2 port = 5432 #unix_socket_directory = '' #unix_socket_group = '' #unix_socket_permissions = 0777 # octal #virtual_host = '' # what interface to listen on; defaults to any #rendezvous_name = '' # defaults to the computer name # - Security & Authentication - #authentication_timeout = 60 # 1-600, in seconds #ssl = false #password_encryption = true #krb_server_keyfile = '' #db_user_namespace = false #----------------------------------------------------------------------- ---- # RESOURCE USAGE (except WAL) #----------------------------------------------------------------------- ---- # - Memory - shared_buffers = 3000 # min 16, at least max_connections*2, 8KB each sort_mem = 4096 # min 64, size in KB vacuum_mem = 32768 # min 1024, size in KB # - Free Space Map - #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 1000 # min 100, ~50 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' #----------------------------------------------------------------------- ---- # WRITE AHEAD LOG #----------------------------------------------------------------------- ---- # - Settings - fsync = false # turns forced synchronization on or off #wal_sync_method = fsync # the default varies across platforms: # fsync, fdatasync, open_sync, or open_datasync #wal_buffers = 8 # min 4, 8KB each # - Checkpoints - checkpoint_segments = 12 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 300 # range 30-3600, in seconds #checkpoint_warning = 30 # 0 is off, in seconds #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 #----------------------------------------------------------------------- ---- # QUERY TUNING #----------------------------------------------------------------------- ---- # - Planner Method Enabling - enable_hashagg = false enable_hashjoin = false enable_indexscan = true enable_mergejoin = true enable_nestloop = false enable_seqscan = true enable_sort = false enable_tidscan = false # - Planner Cost Constants - #effective_cache_size = 1000 # typically 8KB each #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 = true #geqo_threshold = 11 #geqo_effort = 1 #geqo_generations = 0 #geqo_pool_size = 0 # default based on tables in statement, # range 128-1024 #geqo_selection_bias = 2.0 # range 1.5-2.0 # - Other Planner Options - #default_statistics_target = 10 # range 1-1000 #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit JOINs #----------------------------------------------------------------------- ---- # ERROR REPORTING AND LOGGING #----------------------------------------------------------------------- ---- # - Syslog - #syslog = 0 # range 0-2; 0=stdout; 1=both; 2=syslog #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' # - When to Log - #client_min_messages = notice # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # log, info, notice, warning, error #log_min_messages = notice # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, log, fatal, # panic #log_error_verbosity = default # terse, default, or verbose messages #log_min_error_statement = panic # Values in order of increasing severity: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) #log_min_duration_statement = -1 # Log all statements whose # execution time exceeds the value, in # milliseconds. Zero prints all queries. # Minus-one disables. #silent_mode = false # DO NOT USE without Syslog! # - What to Log - #debug_print_parse = false #debug_print_rewritten = false #debug_print_plan = false #debug_pretty_print = false #log_connections = false #log_duration = false #log_pid = false #log_statement = false #log_timestamp = false #log_hostname = false #log_source_port = false #----------------------------------------------------------------------- ---- # RUNTIME STATISTICS #----------------------------------------------------------------------- ---- # - Statistics Monitoring - #log_parser_stats = false #log_planner_stats = false #log_executor_stats = false #log_statement_stats = false # - Query/Index Statistics Collector - stats_start_collector = true stats_command_string = true #stats_block_level = false stats_row_level = true #stats_reset_on_server_start = true #----------------------------------------------------------------------- ---- # CLIENT CONNECTION DEFAULTS #----------------------------------------------------------------------- ---- # - Statement Behavior - #search_path = '$user,public' # schema names #check_function_bodies = true #default_transaction_isolation = 'read committed' #default_transaction_read_only = false statement_timeout = 360000 # 0 is disabled, in milliseconds # - Locale and Formatting - #datestyle = 'iso, mdy' #timezone = unknown # actually, defaults to TZ environment setting #australian_timezones = false #extra_float_digits = 0 # min -15, max 2 #client_encoding = sql_ascii # actually, defaults to database encoding # These settings are initialized by initdb -- they may be changed lc_messages = 'it_IT.UTF-8' # locale for system error message strings lc_monetary = 'it_IT.UTF-8' # locale for monetary formatting lc_numeric = 'it_IT.UTF-8' # locale for number formatting lc_time = 'it_IT.UTF-8' # locale for time formatting # - Other Defaults - #explain_pretty_print = true #dynamic_library_path = '$libdir' #max_expr_depth = 10000 # min 10 #----------------------------------------------------------------------- ---- # LOCK MANAGEMENT #----------------------------------------------------------------------- ---- #deadlock_timeout = 1000 # in milliseconds #max_locks_per_transaction = 64 # min 10, ~260*max_connections bytes each #----------------------------------------------------------------------- ---- # VERSION/PLATFORM COMPATIBILITY #----------------------------------------------------------------------- ---- # - Previous Postgres Versions - #add_missing_from = true #regex_flavor = advanced # advanced, extended, or basic #sql_inheritance = true # - Other Platforms & Clients - #transform_null_equals = false From pgsql-performance-owner@postgresql.org Thu May 13 10:05:54 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 20114D1E8AB for ; Thu, 13 May 2004 10:05:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 89477-10 for ; Thu, 13 May 2004 10:05:34 -0300 (ADT) Received: from frodo.hserus.net (frodo.hserus.net [204.74.68.40]) by svr1.postgresql.org (Postfix) with ESMTP id F2382D1B2DD for ; Thu, 13 May 2004 10:05:29 -0300 (ADT) Received: from concord.pspl.co.in ([202.54.11.72]:63114 helo=frodo.hserus.net) by frodo.hserus.net with asmtp (Cipher TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.34 #0) id 1BOFtt-0004WL-EG by authid with plain; Thu, 13 May 2004 18:35:25 +0530 Message-ID: <40A3728F.2030402@frodo.hserus.net> Date: Thu, 13 May 2004 18:35:19 +0530 From: Shridhar Daithankar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Fabio Panizzutti Cc: pgsql-performance@postgresql.org Subject: Re: Query plan on identical tables differs . Why ? References: <005c01c438e7$ced25c30$3c02020a@ufficio> In-Reply-To: <005c01c438e7$ced25c30$3c02020a@ufficio> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/120 X-Sequence-Number: 6951 Fabio Panizzutti wrote: > storico=# explain select tag_id,valore_tag,data_tag from storico_misure > where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and > tag_id=37423 ; Can you please post explain analyze? That includes actual timings. Looking at the schema, can you try "and tag_id=37423::integer" instead? > enable_hashagg = false > enable_hashjoin = false > enable_indexscan = true > enable_mergejoin = true > enable_nestloop = false > enable_seqscan = true > enable_sort = false > enable_tidscan = false Why do you have these off? AFAIK, 7.4 improved hash aggregates a lot. So you might miss on these in this case. > # - Planner Cost Constants - > > #effective_cache_size = 1000 # typically 8KB each You might set it to something realistic. And what is your hardware setup? Disks/CPU/RAM? Just to be sure, you went thr. http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html and http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html? HTH Regards Shridhar From pgsql-admin-owner@postgresql.org Thu May 13 10:15:54 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id ACC75D1B26B; Thu, 13 May 2004 10:15:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95287-03; Thu, 13 May 2004 10:15:32 -0300 (ADT) Received: from COLSWEEPER.cranel.com (newmail.cranel.com [66.192.200.227]) by svr1.postgresql.org (Postfix) with ESMTP id 17E50D1EA37; Thu, 13 May 2004 10:15:26 -0300 (ADT) Received: from colmail01.cranel.local (colmail01.cranel.local) by COLSWEEPER.cranel.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Thu, 13 May 2004 09:14:53 -0400 Received: from cranel.com (192.168.11.134 [192.168.11.134]) by colmail01.cranel.local with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id K4629B6R; Thu, 13 May 2004 09:20:04 -0400 Message-ID: <40A374E8.5040809@cranel.com> Date: Thu, 13 May 2004 09:15:20 -0400 From: Greg Spiegelberg Organization: Cranel, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Off Topic - Re: [PERFORM] Quad processor options - summary References: <40A2A7FA.6060403@turtle-entertainment.de> In-Reply-To: <40A2A7FA.6060403@turtle-entertainment.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/123 X-Sequence-Number: 13439 This is somthing I wish more of us did on the lists. The list archives have solutions and workarounds for every variety of problem but very few summary emails exist. A good example of this practice is in the sun-managers mailling list. The original poster sends a "SUMMARY" reply to the list with the original problem included and all solutions found. Also makes searching the list archives easier. Simply a suggestion for us all including myself. Greg Bjoern Metzdorf wrote: > Hi, > > at first, many thanks for your valuable replies. On my quest for the > ultimate hardware platform I'll try to summarize the things I learned. > > ------------------------------------------------------------- > > This is our current setup: > > Hardware: > Dual Xeon DP 2.4 on a TYAN S2722-533 with HT enabled > 3 GB Ram (2 x 1 GB + 2 x 512 MB) > Mylex Extremeraid Controller U160 running RAID 10 with 4 x 18 GB SCSI > 10K RPM, no other drives involved (system, pgdata and wal are all on the > same volume). > > Software: > Debian 3.0 Woody > Postgresql 7.4.1 (selfcompiled, no special optimizations) > Kernel 2.4.22 + fixes > > Database specs: > Size of a gzipped -9 full dump is roughly 1 gb > 70-80% selects, 20-30% updates (roughly estimated) > up to 700-800 connections during peak times > kernel.shmall = 805306368 > kernel.shmmax = 805306368 > max_connections = 900 > shared_buffers = 20000 > sort_mem = 16384 > checkpoint_segments = 6 > statistics collector is enabled (for pg_autovacuum) > > Loads: > We are experiencing average CPU loads of up to 70% during peak hours. As > Paul Tuckfield correctly pointed out, my vmstat output didn't support > this. This output was not taken during peak times, it was freshly > grabbed when I wrote my initial mail. It resembles perhaps 50-60% peak > time load (30% cpu usage). iostat does not give results about disk > usage, I don't know exactly why, the blk_read/wrtn columns are just > empty. (Perhaps due to the Mylex rd driver, I don't know). > > ------------------------------------------------------------- > > Suggestions and solutions given: > > Anjan Dave reported, that he is pretty confident with his Quad Xeon > setups, which will cost less than $20K at Dell with a reasonable > hardware setup. ( Dell 6650 with 2.0GHz/1MB cache/8GB Memory, 5 internal > drives (4 in RAID 10, 1 spare) on U320, 128MB cache on the PERC controller) > > Scott Marlowe pointed out, that one should consider more than 4 drives > (6 to 8, 10K rpm is enough, 15K is rip-off) for a Raid 10 setup, because > that can boost performance quite a lot. One should also be using a > battery backed raid controller. Scott has good experiences with the LSI > Megaraid single channel controller, which is reasonably priced at ~ > $500. He also stated, that 20-30% writes on a database is quite a lot. > > Next Rob Sell told us about his research on more-than-2-way Intel based > systems. The memory bandwidth on the xeon platform is always shared > between the cpus. While a 2way xeon may perform quite well, a 4way > system will be suffering due to the reduced memory bandwith available > for each processor. > > J. Andrew Roberts supports this. He said that 4way opteron systems scale > much better than a 4way xeon system. Scaling limits begin at 6-8 cpus on > the opteron platform. He also says that a fully equipped dual channel > LSI Megaraid 320 with 256MB cache ram will be less that $1K. A complete > 4way opteron system will be at $10K-$12K. > > Paul Tuckfield then gave the suggestion to bump up my shared_buffers. > With a 3GB memory system, I could happily be using 1GB for shared > buffers (125000). This was questioned by Andrew McMillian, Manfred > Kolzar and Halford Dace, who say that common tuning advices limit > reasonable settings to 10000-20000 shared buffers, because the OS is > better at caching than the database. > > ------------------------------------------------------------- > > Conclusion: > > After having read some comparisons between n-way xeon and opteron systems: > > http://www.anandtech.com/IT/showdoc.html?i=1982 > http://www.aceshardware.com/read.jsp?id=60000275 > > I was given the impression, that an opteron system is the way to go. > > This is what I am considering the ultimate platform for postgresql: > > Hardware: > Tyan Thunder K8QS board > 2-4 x Opteron 848 in NUMA mode > 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor) > LSI Megaraid 320-2 with 256 MB cache ram and battery backup > 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over both > channels (3 + 4) for pgdata including indexes and wal. > 2 x 80 GB S-ATA IDE for system, running linux software raid 1 or > available onboard hardware raid (perhaps also 2 x 36 GB SCSI) > > Software: > Debian Woody in amd64 biarch mode, or perhaps Redhat/SuSE Enterprise > 64bit distributions. > Kernel 2.6 > Postgres 7.4.2 in 64bit mode > shared_buffers = 20000 > a bumbed up effective_cache_size > > Now the only problem left (besides my budget) is the availability of > such a system. > > I have found some vendors which ship similar systems, so I will have to > talk to them about my dream configuration. I will not self build this > system, there are too many obstacles. > > I expect this system to come out on about 12-15K Euro. Very optimistic, > I know :) > > These are the vendors I found up to now: > > http://www.appro.com/product/server_4144h.asp > http://www.appro.com/product/server_4145h.asp > http://www.pyramid.de/d/builttosuit/server/4opteron.shtml > http://www.rainbow-it.co.uk/productslist.aspx?CategoryID=4&selection=2 > http://www.quadopteron.com/ > > They all seem to sell more or less the same system. I found also some > other vendors which built systems on celestica or amd boards, but they > are way too expensive. > > Buying such a machine is worth some good thoughts. If budget is a limit > and such a machine might not be maxed out during the next few months, it > would make more sense to go for a slightly slower system and an upgrade > when more power is needed. > > Thanks again for all your replies. I hope to have given a somehow clear > summary. > > Regards, > Bjoern > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html -- Greg Spiegelberg Product Development Manager Cranel, Incorporated. Phone: 614.318.4314 Fax: 614.431.8388 Email: gspiegelberg@cranel.com Technology. Integrity. Focus. V-Solve! From pgsql-performance-owner@postgresql.org Thu May 13 10:56:30 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 50FB8D1B18E for ; Thu, 13 May 2004 10:56:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 04981-06 for ; Thu, 13 May 2004 10:56:02 -0300 (ADT) Received: from mail.interlogica.org (host34-209.pool8174.interbusiness.it [81.74.209.34]) by svr1.postgresql.org (Postfix) with ESMTP id 5357DD1B175 for ; Thu, 13 May 2004 10:55:57 -0300 (ADT) Received: from [10.2.8.2] (helo=ilbug) by mail.interlogica.org with esmtp (Exim 3.16 #1) id 1BOGnd-00053J-00; Thu, 13 May 2004 16:03:01 +0200 From: "Fabio Panizzutti" To: "'Shridhar Daithankar'" Cc: Subject: R: Query plan on identical tables differs . Why ? Date: Thu, 13 May 2004 16:06:01 +0200 Message-ID: <006301c438f3$6ca33460$3c02020a@ufficio> 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 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Importance: Normal In-Reply-To: <40A3728F.2030402@frodo.hserus.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/122 X-Sequence-Number: 6953 >>>-----Messaggio originale----- >>>Da: pgsql-performance-owner@postgresql.org=20 >>>[mailto:pgsql-performance-owner@postgresql.org] Per conto di=20 >>>Shridhar Daithankar >>>Inviato: gioved=EC 13 maggio 2004 15.05 >>>A: Fabio Panizzutti >>>Cc: pgsql-performance@postgresql.org >>>Oggetto: Re: [PERFORM] Query plan on identical tables differs . Why ? >>> >>> >>>Fabio Panizzutti wrote: >>>> storico=3D# explain select tag_id,valore_tag,data_tag from=20 >>>> storico_misure where (data_tag>'2004-05-03' and data_tag=20 >>>> <'2004-05-12') and tag_id=3D37423 ; >>> >>>Can you please post explain analyze? That includes actual timings. storico=3D# explain analyze select tag_id,valore_tag,data_tag from storico_misure where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=3D37423 ; =20 QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ -------------------------- Index Scan using pk_storico_misure_2 on storico_misure (cost=3D0.00..1984.64 rows=3D658 width=3D21) (actual time=3D723.441..1858.1= 07 rows=3D835 loops=3D1) Index Cond: ((data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone) AND (tag_id =3D 37423)) Total runtime: 1860.641 ms (3 rows) storico=3D# explain analyze select tag_id,valore_tag,data_tag from storico_misure_short where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=3D37423 ; =20 QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------------------- Index Scan using pk_anagtstorico_misuree_short_idx_2 on storico_misure_short (cost=3D0.00..1783.04 rows=3D629 width=3D20) (actual time=3D0.323..42.186 rows=3D864 loops=3D1) Index Cond: (tag_id =3D 37423) Filter: ((data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone)) Total runtime: 43.166 ms >>>Looking at the schema, can you try "and=20 >>>tag_id=3D37423::integer" instead? >>> I try :=20 explain analyze select tag_id,valore_tag,data_tag from storico_misure where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=3D37423::integer; Index Scan using pk_storico_misure_2 on storico_misure (cost=3D0.00..1984.64 rows=3D658 width=3D21) (actual time=3D393.337..1303.9= 98 rows=3D835 loops=3D1) Index Cond: ((data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone) AND (tag_id =3D 37423)) Total runtime: 1306.484 ms >>>> enable_hashagg =3D false >>>> enable_hashjoin =3D false >>>> enable_indexscan =3D true >>>> enable_mergejoin =3D true >>>> enable_nestloop =3D false >>>> enable_seqscan =3D true >>>> enable_sort =3D false >>>> enable_tidscan =3D false >>>Why do you have these off? AFAIK, 7.4 improved hash=20 >>>aggregates a lot. So you=20 >>>might miss on these in this case. I try for debug purpose , now i reset all 'enable' to default : =20 select * from pg_settings where name like 'enable%'; name | setting | context | vartype | source | min_val | max_val ------------------+---------+---------+---------+--------------------+-- -------+--------- enable_hashagg | on | user | bool | configuration file | | enable_hashjoin | on | user | bool | configuration file | | enable_indexscan | on | user | bool | configuration file | | enable_mergejoin | on | user | bool | configuration file | | enable_nestloop | on | user | bool | configuration file | | enable_seqscan | on | user | bool | configuration file | | enable_sort | on | user | bool | configuration file | | enable_tidscan | on | user | bool | configuration file | | (8 rows) The query plan are the same .... >>>> # - Planner Cost Constants - >>>>=20 >>>> #effective_cache_size =3D 1000 # typically 8KB each >>> >>>You might set it to something realistic. >>> I try 10000 and 100000 but nothing change . >>>And what is your hardware setup? Disks/CPU/RAM? 32GB SCSI/DUAL Intel(R) Pentium(R) III CPU family 1133MHz/ 1GB RAM and linux red-hat 9 I don't understand why the planner chose a different query plan on identical tables with same indexes .=20 Thanks a lot for help!. Fabio From pgsql-performance-owner@postgresql.org Thu May 13 12:01:36 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6919FD1B171 for ; Thu, 13 May 2004 12:01:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25390-08 for ; Thu, 13 May 2004 12:01:15 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8ED63D1B16F for ; Thu, 13 May 2004 12:01:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4DF10xB008905; Thu, 13 May 2004 11:01:00 -0400 (EDT) To: "Fabio Panizzutti" Cc: "'Shridhar Daithankar'" , pgsql-performance@postgresql.org Subject: Re: R: Query plan on identical tables differs . Why ? In-reply-to: <006301c438f3$6ca33460$3c02020a@ufficio> References: <006301c438f3$6ca33460$3c02020a@ufficio> Comments: In-reply-to "Fabio Panizzutti" message dated "Thu, 13 May 2004 16:06:01 +0200" Date: Thu, 13 May 2004 11:01:00 -0400 Message-ID: <8904.1084460460@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/124 X-Sequence-Number: 6955 "Fabio Panizzutti" writes: > I don't understand why the planner chose a different query plan on > identical tables with same indexes . Different data statistics; not to mention different table sizes (the cost equations are not linear). Have you ANALYZEd (or VACUUM ANALYZEd) both tables recently? If the stats are up to date but still not doing the right thing, you might try increasing the statistics target for the larger table's tag_id column. See ALTER TABLE SET STATISTICS. regards, tom lane From pgsql-performance-owner@postgresql.org Thu May 13 12:16:58 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3FCA7D1B1B2 for ; Thu, 13 May 2004 12:16:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 30046-06 for ; Thu, 13 May 2004 12:16:35 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 2C2F6D1B1B3 for ; Thu, 13 May 2004 12:16:35 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 7F0F03576D; Thu, 13 May 2004 08:16:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 7D8DB3576C; Thu, 13 May 2004 08:16:34 -0700 (PDT) Date: Thu, 13 May 2004 08:16:34 -0700 (PDT) From: Stephan Szabo To: Fabio Panizzutti Cc: 'Shridhar Daithankar' , pgsql-performance@postgresql.org Subject: Re: R: Query plan on identical tables differs . Why ? In-Reply-To: <006301c438f3$6ca33460$3c02020a@ufficio> Message-ID: <20040513080130.E3465@megazone.bigpanda.com> References: <006301c438f3$6ca33460$3c02020a@ufficio> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/125 X-Sequence-Number: 6956 On Thu, 13 May 2004, Fabio Panizzutti wrote: > I don't understand why the planner chose a different query plan on > identical tables with same indexes . Because it's more than table structure that affects the choice made by the planner. In addition the statistics about the values that are there as well as the estimated size of the table have effects. One way to see is to see what it thinks is best is to remove the indexes it is using and see what plan it gives then, how long it takes and the estimated costs for those plans. In other suggestions, I think having a (tag_id, data_tag) index rather than (data_tag, tag_id) may be a win for queries like this. Also, unless you're doing many select queries by only the first field of the composite index and you're not doing very many insert/update/deletes, you may want to drop the other index on just that field. From pgsql-performance-owner@postgresql.org Thu May 13 16:42:52 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 25636D1B170 for ; Thu, 13 May 2004 16:42:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 92945-09 for ; Thu, 13 May 2004 16:42:30 -0300 (ADT) Received: from neomail.traderonline.com (email.traderonline.com [65.213.231.10]) by svr1.postgresql.org (Postfix) with ESMTP id 4189FD1B1A9 for ; Thu, 13 May 2004 16:42:22 -0300 (ADT) Received: from dyounger-IBM (65-86-118-210.client.dsl.net [65.86.118.210]) by neomail.traderonline.com with ESMTP id i4DJgLV29308 for ; Thu, 13 May 2004 15:42:23 -0400 Message-Id: <6.0.1.1.2.20040513153548.01edaec0@mail.ptd.net> X-Sender: dylists@mail.ptd.net (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.0.1.1 Date: Thu, 13 May 2004 15:42:20 -0400 To: pgsql-performance@postgresql.org From: Doug Y Subject: Re: Clarification on some settings Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/126 X-Sequence-Number: 6957 (Sorry if this ends up being a duplicate post, I sent a reply yesterday, but it doesn't appear to have gone through... I think I typo'd the address but never got a bounce.) Hi, Thanks for your initial help. I have some more questions below. At 05:02 AM 5/12/2004, Shridhar Daithankar wrote: >Doug Y wrote: > >>Hello, >> I've been having some performance issues with a DB I use. I'm trying >> to come up with some performance recommendations to send to the "adminstrator". >> >>Ok for what I'm uncertain of... >>shared_buffers: >>According to http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html >>Its more of a staging area and more isn't necessarily better. That psql >>relies on the OS to cache data for later use. >>But according to >>http://www.ca.postgresql.org/docs/momjian/hw_performance/node3.html its >>where psql caches previous data for queries because the OS cache is >>slower, and should be as big as possible without causing swap. >>Those seem to be conflicting statements. In our case, the "administrator" >>kept increasing this until performance seemed to increase, which means >>its now 250000 (x 8k is 2G). >>Is this just a staging area for data waiting to move to the OS cache, or >>is this really the area that psql caches its data? > >It is the area where postgresql works. It updates data in this area and >pushes it to OS cache for disk writes later. > >By experience, larger does not mean better for this parameter. For >multi-Gig RAM machines, the best(on an average for wide variety of load) >value found to be around 10000-15000. May be even lower. > >It is a well known fact that raising this parameter unnecessarily >decreases the performance. You indicate that best performance occurred at >250000. This is very very large compared to other people's experience. Ok. I think I understand a bit better now. >>effective_cache_size: >>Again, according to the Varlena guide this tells psql how much system >>memory is available for it to do its work in. >>until recently, this was set at the default value of 1000. It was just >>recently increased to 180000 (1.5G) >>according to >>http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html >>it should be about 25% of memory? > >No rule of thumb. It is amount of memory OS will dedicate to psotgresql >data buffers. Depending uponn what else you run on machine, it could be >straight-forward or noodly value to calculate. For a 4GB machine, 1.5GB is >quite good but coupled with 2G of shared buffers it could push the >machines to swap storm. And swapping shared buffers is a big performance hit. We don't seem to be swapping much: # top 2:21pm up 236 days, 19:12, 1 user, load average: 1.45, 1.09, 1.00 53 processes: 51 sleeping, 2 running, 0 zombie, 0 stopped CPU0 states: 30.3% user, 9.1% system, 0.0% nice, 60.0% idle CPU1 states: 32.0% user, 9.3% system, 0.0% nice, 58.1% idle Mem: 3863468K av, 3845844K used, 17624K free, 2035472K shrd, 198340K buff Swap: 1052248K av, 1092K used, 1051156K free 1465112K cached looks like at some point it did swap a little, but from running vmstat, I can't seem to catch it actively swapping. >>Finally sort_mem: >>Was until recently left at the default of 1000. Is now 16000. > >Sort memory is per sort not per query or per connection. So depending upon >how many concurrent connections you entertain, it could take quite a chuck >of RAM. Right I understand that. How does one calculate the size of a sort? Rows * width from an explain? >>Increasing the effective cache and sort mem didn't seem to make much of a >>difference. I'm guessing the eff cache was probably raised a bit too >>much, and shared_buffers is way to high. > >I agree. For shared buffers start with 5000 and increase in batches on >1000. Or set it to a high value and check with ipcs for maximum shared >memory usage. If share memory usage peaks at 100MB, you don't need more >than say 120MB of buffers. My results from ipcs seems confusing... says its using the full 2G of shared cache: # ipcs ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0052e2c1 6389760 postgres 600 2088370176 4 ------ Semaphore Arrays -------- key semid owner perms nsems status 0x0052e2c1 424378368 postgres 600 17 0x0052e2c2 424411137 postgres 600 17 0x0052e2c3 424443906 postgres 600 17 0x0052e2c4 424476675 postgres 600 17 0x0052e2c5 424509444 postgres 600 17 0x0052e2c6 424542213 postgres 600 17 0x0052e2c7 424574982 postgres 600 17 0x0052e2c8 424607751 postgres 600 17 0x0052e2c9 424640520 postgres 600 17 0x0052e2ca 424673289 postgres 600 17 0x0052e2cb 424706058 postgres 600 17 0x0052e2cc 424738827 postgres 600 17 0x0052e2cd 424771596 postgres 600 17 0x0052e2ce 424804365 postgres 600 17 0x0052e2cf 424837134 postgres 600 17 0x0052e2d0 424869903 postgres 600 17 0x0052e2d1 424902672 postgres 600 17 0x00018d45 505544721 root 777 1 ------ Message Queues -------- key msqid owner perms used-bytes messages >>What can I do to help determine what the proper settings should be and/or >>look at other possible choke points. What should I look for in iostat, >>mpstat, or vmstat as red flags that cpu, memory, or i/o bound? > >Yes. vmstat is usually a lot of help to locate the bottelneck. What would I be looking for here? # vmstat 2 10 procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 0 0 0 1092 14780 198120 1467164 0 0 0 0 0 0 0 0 0 0 0 0 1092 19488 198120 1467204 0 0 0 0 240 564 11 5 84 0 0 0 1092 19520 198120 1467300 0 0 0 210 443 1094 29 8 63 0 0 0 1092 15832 198120 1467356 0 0 4 110 368 1455 27 5 68 3 0 0 1092 10956 198120 1467464 0 0 4 336 417 1679 33 10 57 1 0 0 1092 17840 198124 1465980 0 0 200 334 581 1914 63 14 23 1 0 0 1092 16556 198124 1466012 0 0 0 226 397 1069 30 4 66 0 0 0 1092 19096 198124 1466028 0 0 0 160 230 314 12 2 86 2 0 1 1092 16100 198128 1466748 0 0 28 1484 711 1578 23 12 65 0 0 0 1092 20140 198128 1466780 0 0 0 414 291 746 15 8 77 I'm guessing what I should look at is the io: bi & bo ? when I run some particularly large queries I see bo activity so I'm speculating that that means its reading pages from disk, correct? >>DB maintenance wise, I don't believe they were running vacuum full until >>I told them a few months ago that regular vacuum analyze no longer cleans >>out dead tuples. Now normal vac is run daily, vac full weekly >>(supposedly). How can I tell from the output of vacuum if the vac fulls >>aren't being done, or not done often enough? Or from the system tables, >>what can I read? > >In 7.4 you can do vacuum full verbose and it will tell you the stats at >the end. For 7.3.x, its not there. > >I suggest you vacuum full database once.(For large database, dumping >restoring might work faster. Dump/restore and vacuum full both lock the >database exclusively i.e. downtime. So I guess faster the better for you. >But there is no tool/guideline to determine which way to go.) Ok they had not done a full vacuum in a long time. I them run vacuumdb --full --analyze --verbose and dump it into a file. What should I look for to see if it was useful? for example: INFO: Pages 118200: Changed 74, reaped 117525, Empty 0, New 0; Tup 575298: Vac 11006, Keep/VTL 0/0, UnUsed 2454159, MinLen 68, MaxLen 1911; Re-using: Free/Avai l. Space 774122944/774122944; EndEmpty/Avail. Pages 0/118200. CPU 9.41s/1.33u sec elapsed 97.35 sec. Is there any documentation on what those numbers represent? Also do we need to use REINDEX on the indexes, or does vacuum full take case of that? >>Is there anywhere else I can look for possible clues? I have access to >>the DB super-user, but not the system root/user. > >Other than hardware tuning, find out slow/frequent queries. Use explain >analyze to determine why they are so slow. Forgetting to typecast a where >clause and using sequential scan could cost you lot more than mistuned >postgresql configuration. Right. One example I can think of is one particular query takes about 120 seconds to run (explain analyze), but if I set enable_seqscan to off, it takes about 10 seconds. >>Thank you for your time. Please let me know any help or suggestions you >>may have. Unfortunately upgrading postgres, OS, kernel, or re-writing >>schema is most likely not an option. > >I hope you can change your queries. For the most part we're not having too much trouble, just some newer queries were building for some new features is what we're seeing trouble with. >HTH > > Shridhar From pgsql-performance-owner@postgresql.org Thu May 13 17:28:35 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4F6FAD1B16A for ; Thu, 13 May 2004 17:28:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 08295-04 for ; Thu, 13 May 2004 17:28:13 -0300 (ADT) Received: from mail.copelandconsulting.net (dsl-24293-ld.customer.centurytel.net [209.142.135.135]) by svr1.postgresql.org (Postfix) with ESMTP id 8AAFBD1B18A for ; Thu, 13 May 2004 17:28:10 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.copelandconsulting.net (Postfix) with ESMTP id 8DBDAC053C3; Thu, 13 May 2004 15:28:11 -0500 (CDT) Received: from mail.copelandconsulting.net ([127.0.0.1]) by localhost (mouse.copelandconsulting.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14909-04; Thu, 13 May 2004 15:28:11 -0500 (CDT) Received: from shrew.copelandconsulting.net (shrew.copelandconsulting.net [192.168.1.3]) by mail.copelandconsulting.net (Postfix) with ESMTP id 4864BC00114; Thu, 13 May 2004 15:28:11 -0500 (CDT) Subject: Re: Clarification on some settings From: Greg Copeland To: Doug Y Cc: pgsql-performance@postgresql.org In-Reply-To: <6.0.1.1.2.20040513153548.01edaec0@mail.ptd.net> References: <6.0.1.1.2.20040513153548.01edaec0@mail.ptd.net> Content-Type: text/plain Organization: Copeland Computer Consulting Message-Id: <1084480091.2227.20.camel@shrew.copelandconsulting.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4-8mdk Date: Thu, 13 May 2004 15:28:11 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at copelandconsulting.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/127 X-Sequence-Number: 6958 On Thu, 2004-05-13 at 14:42, Doug Y wrote: > We don't seem to be swapping much: > Linux aggressively swaps. If you have any process in memory which is sleeping a lot, Linux may actively attempt to page it out. This is true even when you are not low on memory. Just because you see some swap space being used, does not mean that your actively running processes are causing your system to swap. I didn't catch what kernel version you are running, so I'm tossing this out there. Depending on the kernel (I believe 2.6+, but there may be something like it in older kernels) that you are running, you can attempt to tune this buy setting a value of 0-100 in /proc/sys/vm/swappiness. The higher the number, the more aggressive the kernel will attempt to swap. Some misc. kernel patches attempt to dynamically tune this parameter. For a dedicated DB server, a higher number will probably be better. This is because it should result in the most cache being available to the system. This, of course means, you may have to wait an tad bit long when you ssh into the system, assuming sshd was swapped out. I think you get the idea. > Swap: 1052248K av, 1092K used, 1051156K free 1465112K cached > > looks like at some point it did swap a little, but from running vmstat, I > can't seem to catch it actively swapping. > Chances are, you have some dormant process which is partially or completely paged out. For an interesting read on Linux and swapping, you can find out more here: http://kerneltrap.org/node/view/3080. Cheers! -- Greg Copeland, Owner greg@copelandconsulting.net Copeland Computer Consulting 940.206.8004 From pgsql-admin-owner@postgresql.org Thu May 13 18:01:09 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 002EAD1B176 for ; Thu, 13 May 2004 18:01:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 12210-10 for ; Thu, 13 May 2004 18:00:44 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id 37EBED1B17A for ; Thu, 13 May 2004 18:00:41 -0300 (ADT) Received: (qmail 27536 invoked from network); 13 May 2004 21:23:02 -0000 Received: from unknown (HELO jamesthornton.com) (james@65.65.104.48) by 0 with SMTP; 13 May 2004 21:23:02 -0000 Message-ID: <40A3E250.2020204@jamesthornton.com> Date: Thu, 13 May 2004 16:02:08 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bjoern Metzdorf Cc: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Re: [PERFORM] Quad processor options - summary References: <40A2A7FA.6060403@turtle-entertainment.de> In-Reply-To: <40A2A7FA.6060403@turtle-entertainment.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/135 X-Sequence-Number: 13451 Bjoern Metzdorf wrote: > Hi, > > at first, many thanks for your valuable replies. On my quest for the > ultimate hardware platform I'll try to summarize the things I learned. > > ------------------------------------------------------------- > This is what I am considering the ultimate platform for postgresql: > > Hardware: > Tyan Thunder K8QS board > 2-4 x Opteron 848 in NUMA mode > 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor) > LSI Megaraid 320-2 with 256 MB cache ram and battery backup > 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over both > channels (3 + 4) for pgdata including indexes and wal. You might also consider configuring the Postgres data drives for a RAID 10 SAME configuration as described in the Oracle paper "Optimal Storage Configuration Made Easy" (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has anyone delved into this before? -- James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-admin-owner@postgresql.org Thu May 13 18:53:58 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4CBE4D1B16D; Thu, 13 May 2004 18:53:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 23762-09; Thu, 13 May 2004 18:53:39 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 2CC91D1B169; Thu, 13 May 2004 18:53:36 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BOO8y-0006GW-00; Thu, 13 May 2004 23:53:32 +0200 Received: from ip19.1.1411j-cud12k-02.ish.de ([62.143.1.19] helo=[192.168.100.5]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BOO8x-0002NC-00; Thu, 13 May 2004 23:53:31 +0200 Message-ID: <40A3EE5B.1050104@turtle-entertainment.de> Date: Thu, 13 May 2004 23:53:31 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: James Thornton Cc: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Re: [PERFORM] Quad processor options - summary References: <40A2A7FA.6060403@turtle-entertainment.de> <40A3E250.2020204@jamesthornton.com> In-Reply-To: <40A3E250.2020204@jamesthornton.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/136 X-Sequence-Number: 13452 James Thornton wrote: >> This is what I am considering the ultimate platform for postgresql: >> >> Hardware: >> Tyan Thunder K8QS board >> 2-4 x Opteron 848 in NUMA mode >> 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor) >> LSI Megaraid 320-2 with 256 MB cache ram and battery backup >> 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over both >> channels (3 + 4) for pgdata including indexes and wal. > > You might also consider configuring the Postgres data drives for a RAID > 10 SAME configuration as described in the Oracle paper "Optimal Storage > Configuration Made Easy" > (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has > anyone delved into this before? Ok, if I understand it correctly the papers recommends the following: 1. Get many drives and stripe them into a RAID0 with a stripe width of 1MB. I am not quite sure if this stripe width is to be controlled at the application level (does postgres support this?) or if e.g. the "chunk size" of the linux software driver is meant. Normally a chunk size of 4KB is recommended, so 1MB sounds fairly large. 2. Mirror your RAID0 and get a RAID10. 3. Use primarily the fast, outer regions of your disks. In practice this might be achieved by putting only half of the disk (the outer half) into your stripe set. E.g. put only the outer 18GB of your 36GB disks into the stripe set. Btw, is it common for all drives that the outer region is on the higher block numbers? Or is it sometimes on the lower block numbers? 4. Subset data by partition, not disk. If you have 8 disks, then don't take a 4 disk RAID10 for data and the other one for log or indexes, but make a global 8 drive RAID10 and have it partitioned the way that data and log + indexes are located on all drives. They say, which is very interesting, as it is really contrary to what is normally recommended, that it is good or better to have one big stripe set over all disks available, than to put log + indexes on a separated stripe set. Having one big stripe set means that the speed of this big stripe set is available to all data. In practice this setup is as fast as or even faster than the "old" approach. ---------------------------------------------------------------- Bottom line for a normal, less than 10 disk setup: Get many disks (8 + spare), create a RAID0 with 4 disks and mirror it to the other 4 disks for a RAID10. Make sure to create the RAID on the outer half of the disks (setup may depend on the disk model and raid controller used), leaving the inner half empty. Use a logical volume manager (LVM), which always helps when adding disk space, and create 2 partitions on your RAID10. One for data and one for log + indexes. This should look like this: ----- ----- ----- ----- | 1 | | 1 | | 1 | | 1 | ----- ----- ----- ----- <- outer, faster half of the disk | 2 | | 2 | | 2 | | 2 | part of the RAID10 ----- ----- ----- ----- | | | | | | | | | | | | | | | | <- inner, slower half of the disk | | | | | | | | not used at all ----- ----- ----- ----- Partition 1 for data, partition 2 for log + indexes. All mirrored to the other 4 disks not shown. If you take 36GB disks, this should end up like this: RAID10 has size of 36 / 2 * 4 = 72GB Partition 1 is 36 GB Partition 2 is 36 GB If 36GB is not enough for your pgdata set, you might consider moving to 72GB disks, or (even better) make a 16 drive RAID10 out of 36GB disks, which both will end up in a size of 72GB for your data (but the 16 drive version will be faster). Any comments? Regards, Bjoern From pgsql-admin-owner@postgresql.org Thu May 13 19:49:41 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1F0D4D1B16F for ; Thu, 13 May 2004 19:49:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38930-04 for ; Thu, 13 May 2004 19:49:19 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id 67F64D1B1A6 for ; Thu, 13 May 2004 19:49:16 -0300 (ADT) Received: (qmail 28747 invoked from network); 13 May 2004 23:11:40 -0000 Received: from unknown (HELO jamesthornton.com) (james@65.65.104.48) by 0 with SMTP; 13 May 2004 23:11:40 -0000 Message-ID: <40A3FBC5.8090301@jamesthornton.com> Date: Thu, 13 May 2004 17:50:45 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bjoern Metzdorf Cc: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Re: [PERFORM] Quad processor options - summary References: <40A2A7FA.6060403@turtle-entertainment.de> <40A3E250.2020204@jamesthornton.com> <40A3EE5B.1050104@turtle-entertainment.de> In-Reply-To: <40A3EE5B.1050104@turtle-entertainment.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/137 X-Sequence-Number: 13453 Bjoern Metzdorf wrote: >> You might also consider configuring the Postgres data drives for a >> RAID 10 SAME configuration as described in the Oracle paper "Optimal >> Storage Configuration Made Easy" >> (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has >> anyone delved into this before? > > Ok, if I understand it correctly the papers recommends the following: > > 1. Get many drives and stripe them into a RAID0 with a stripe width of > 1MB. I am not quite sure if this stripe width is to be controlled at the > application level (does postgres support this?) or if e.g. the "chunk > size" of the linux software driver is meant. Normally a chunk size of > 4KB is recommended, so 1MB sounds fairly large. > > 2. Mirror your RAID0 and get a RAID10. Don't use RAID 0+1 -- use RAID 1+0 instead. Performance is the same, but if a disk fails in a RAID 0+1 configuration, you are left with a RAID 0 array. In a RAID 1+0 configuration, multiple disks can fail. A few weeks ago I called LSI asking about the Dell PERC4-Di card, which is actually an LSI Megaraid 320-2. Dell's documentation said that its support for RAID 10 was in the form of RAID-1 concatenated, but LSI said that this is incorrect and that it supports RAID 10 proper. > 3. Use primarily the fast, outer regions of your disks. In practice this > might be achieved by putting only half of the disk (the outer half) into > your stripe set. E.g. put only the outer 18GB of your 36GB disks into > the stripe set. You can still use the inner-half of the drives, just relegate it to less-frequently accessed data. You also need to consider the filesystem. SGI and IBM did a detailed study on Linux filesystem performance, which included XFS, ext2, ext3 (various modes), ReiserFS, and JFS, and the results are presented in a paper entitled "Filesystem Performance and Scalability in Linux 2.4.17" (http://oss.sgi.com/projects/xfs/papers/filesystem-perf-tm.pdf). The scaling and load are key factors when selecting a filesystem. Since Postgres data is stored in large files, ReiserFS is not the ideal choice since it has been optimized for small files. XFS is probably the best choice for a database server running on a quad processor box. However, Dr. Bert Scalzo of Quest argues that general file system benchmarks aren't ideal for benchmarking a filesystem for a database server. In a paper entitled "Tuning an Oracle8i Database running Linux" (http://otn.oracle.com/oramag/webcolumns/2002/techarticles/scalzo_linux02.html), he says, "The trouble with these tests-for example, Bonnie, Bonnie++, Dbench, Iobench, Iozone, Mongo, and Postmark-is that they are basic file system throughput tests, so their results generally do not pertain in any meaningful fashion to the way relational database systems access data files." Instead he suggests using these two well-known and widely accepted database benchmarks: * AS3AP: a scalable, portable ANSI SQL relational database benchmark that provides a comprehensive set of tests of database-processing power; has built-in scalability and portability for testing a broad range of systems; minimizes human effort in implementing and running benchmark tests; and provides a uniform, metric, straightforward interpretation of the results. * TPC-C: an online transaction processing (OLTP) benchmark that involves a mix of five concurrent transactions of various types and either executes completely online or queries for deferred execution. The database comprises nine types of tables, having a wide range of record and population sizes. This benchmark measures the number of transactions per second. In the paper, Scalzo benchmarks ext2, ext3, ReiserFS, JFS, but not XFS. Surprisingly ext3 won, but Scalzo didn't address scaling/load. The results are surprising because most think ext3 is just ext2 with journaling, thus having extra overhead from journaling. If you read papers on ext3, you'll discover that has some optimizations that reduce disk head movement. For example, Daniel Robbins' "Advanced filesystem implementor's guide, Part 7: Introducing ext3" (http://www-106.ibm.com/developerworks/library/l-fs7/) says: "The approach that the [ext3 Journaling Block Device layer API] uses is called physical journaling, which means that the JBD uses complete physical blocks as the underlying currency for implementing the journal...the use of full blocks allows ext3 to perform some additional optimizations, such as "squishing" multiple pending IO operations within a single block into the same in-memory data structure. This, in turn, allows ext3 to write these multiple changes to disk in a single write operation, rather than many. In addition, because the literal block data is stored in memory, little or no massaging of the in-memory data is required before writing it to disk, greatly reducing CPU overhead." I suspect that less writes may be the key factor in ext3 winning Scalzo's DB benchmark. But as I said, Scalzo didn't benchmark XFS and he didn't address scaling. XFS has a feature called delayed allocation that reduces IO (http://www-106.ibm.com/developerworks/library/l-fs9/), and it scales much better than ext3 so while I haven't tested it, I suspect that it may be the ideal choice for large Linux DB servers: "XFS handles allocation by breaking it into a two-step process. First, when XFS receives new data to be written, it records the pending transaction in RAM and simply reserves an appropriate amount of space on the underlying filesystem. However, while XFS reserves space for the new data, it doesn't decide what filesystem blocks will be used to store the data, at least not yet. XFS procrastinates, delaying this decision to the last possible moment, right before this data is actually written to disk. By delaying allocation, XFS gains many opportunities to optimize write performance. When it comes time to write the data to disk, XFS can now allocate free space intelligently, in a way that optimizes filesystem performance. In particular, if a bunch of new data is being appended to a single file, XFS can allocate a single, contiguous region on disk to store this data. If XFS hadn't delayed its allocation decision, it may have unknowingly written the data into multiple non-contiguous chunks, reducing write performance significantly. But, because XFS delayed its allocation decision, it was able to write the data in one fell swoop, improving write performance as well as reducing overall filesystem fragmentation. Delayed allocation also has another performance benefit. In situations where many short-lived temporary files are created, XFS may never need to write these files to disk at all. Since no blocks are ever allocated, there's no need to deallocate any blocks, and the underlying filesystem metadata doesn't even get touched." For further study, I have compiled a list of Linux filesystem resources at: http://jamesthornton.com/hotlist/linux-filesystems/. -- James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-admin-owner@postgresql.org Thu May 13 20:00:29 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 37C86D1B16C; Thu, 13 May 2004 20:00:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41393-04; Thu, 13 May 2004 19:59:42 -0300 (ADT) Received: from gaia.sol.deeper.co.nz (ns1.sol.deeper.co.nz [219.88.66.128]) by svr1.postgresql.org (Postfix) with ESMTP id 2C168D1B16F; Thu, 13 May 2004 19:59:34 -0300 (ADT) Received: from atlas.sol.deeper.co.nz (atlas.sol.deeper.co.nz [192.168.0.127]) by gaia.sol.deeper.co.nz (8.11.6/8.11.6) with ESMTP id i4DMxGM15879; Fri, 14 May 2004 10:59:16 +1200 Subject: Re: [PERFORM] Quad processor options - summary From: Hadley Willan To: Bjoern Metzdorf Cc: James Thornton , pgsql-performance@postgresql.org, pgsql-admin@postgresql.org In-Reply-To: <40A3EE5B.1050104@turtle-entertainment.de> References: <40A2A7FA.6060403@turtle-entertainment.de> <40A3E250.2020204@jamesthornton.com> <40A3EE5B.1050104@turtle-entertainment.de> Content-Type: multipart/alternative; boundary="=-ohWxbOoNulLVxR9g8Rk7" Message-Id: <1084489156.5424.31.camel@atlas.sol.deeper.co.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 14 May 2004 10:59:16 +1200 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.3 tagged_above=0.0 required=5.0 tests=HTML_FONTCOLOR_UNSAFE, HTML_MESSAGE, NO_EXPERIENCE X-Spam-Level: * X-Archive-Number: 200405/138 X-Sequence-Number: 13454 --=-ohWxbOoNulLVxR9g8Rk7 Content-Type: text/plain Content-Transfer-Encoding: 7bit I see you've got an LSI Megaraid card with oodles of Cache. However, don't underestimate the power of the software RAID implementation that Red Hat Linux comes with. We're using RHE 2.1 and I can recommend Red Hat Enterprise Linux if you want an excellent implementation of software RAID. In fact we have found the software implementation more flexible than that of some expensive hardware controllers. In addition there are also tools to enhance the base implementation even further, making setup and maintenance even easier. An advantage of the software implementation is being able to RAID by partition, not necessarily entire disks. To answer question 1, if you use software raid the chunk size is part of the /etc/raidtab file that is used on initial container creation. 4KB is the standard and a LARGE chunk size of 1MB may affect performance if you're not writing down to blocks in that size continuously. If you make it to big and you're constantly needing to write out smaller chunks of information, then you will find the disk "always" working and would be an inefficient use of the blocks. There is some free info around about calculating the ideal chunk size. Looking for "Calculating chunk size for RAID" through google. In the software implementation, after setup the raidtab is uncessary as the superblocks of the disks now contain their relevant information. As for the application knowing any of this, no, the application layers are entirely unaware of the lower implementation. They simply function as normal by writing to directories that are now mounted a different way. The kernel takes care of the underlying RAID writes and syncs. 3 is easy to implement with software raid under linux. You simply partition the drive like normal, mark the partitions you want to "raid" as 'fd' 'linux raid autodetect', then configure the /etc/raidtab and do a mkraid /dev/mdxx where mdxx is the matching partition for the raid setup. You can map them anyway you want, but it can get confusing if you're mapping /dev/sda6 > /dev/sdb8 and calling it /dev/md7. We've found it easier to make them all line up, /dev/sda6 > /dev/sdb6 > /dev/md6 FYI, if you want better performance, use 15K SCSI disks, and make sure you've got more than 8MB of cache per disk. Also, you're correct in splitting the drives across the channel, that's a trap for young players ;-) Bjoern is right to recommend an LVM, it will allow you to dynamically allocate new size to the RAID volume when you add more disks. However I've no experience in implementation with an LVM under the software RAID for Linux, though I believe it can be done. The software RAID implementation allows you to stop and start software RAID devices as desired, add new hot spare disks to the containers as needed and rebuild containers on the fly. You can even change kernel options to speed up or slow down the sync speed when rebuilding the container. Anyway, have fun, cause striping is the hot rod of the RAID implementations ;-) Regards. Hadley On Fri, 2004-05-14 at 09:53, Bjoern Metzdorf wrote: > James Thornton wrote: > > >> This is what I am considering the ultimate platform for postgresql: > >> > >> Hardware: > >> Tyan Thunder K8QS board > >> 2-4 x Opteron 848 in NUMA mode > >> 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor) > >> LSI Megaraid 320-2 with 256 MB cache ram and battery backup > >> 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over both > >> channels (3 + 4) for pgdata including indexes and wal. > > > > You might also consider configuring the Postgres data drives for a RAID > > 10 SAME configuration as described in the Oracle paper "Optimal Storage > > Configuration Made Easy" > > (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has > > anyone delved into this before? > > Ok, if I understand it correctly the papers recommends the following: > > 1. Get many drives and stripe them into a RAID0 with a stripe width of > 1MB. I am not quite sure if this stripe width is to be controlled at the > application level (does postgres support this?) or if e.g. the "chunk > size" of the linux software driver is meant. Normally a chunk size of > 4KB is recommended, so 1MB sounds fairly large. > > 2. Mirror your RAID0 and get a RAID10. > > 3. Use primarily the fast, outer regions of your disks. In practice this > might be achieved by putting only half of the disk (the outer half) into > your stripe set. E.g. put only the outer 18GB of your 36GB disks into > the stripe set. Btw, is it common for all drives that the outer region > is on the higher block numbers? Or is it sometimes on the lower block > numbers? > > 4. Subset data by partition, not disk. If you have 8 disks, then don't > take a 4 disk RAID10 for data and the other one for log or indexes, but > make a global 8 drive RAID10 and have it partitioned the way that data > and log + indexes are located on all drives. > > They say, which is very interesting, as it is really contrary to what is > normally recommended, that it is good or better to have one big stripe > set over all disks available, than to put log + indexes on a separated > stripe set. Having one big stripe set means that the speed of this big > stripe set is available to all data. In practice this setup is as fast > as or even faster than the "old" approach. > > ---------------------------------------------------------------- > > Bottom line for a normal, less than 10 disk setup: > > Get many disks (8 + spare), create a RAID0 with 4 disks and mirror it to > the other 4 disks for a RAID10. Make sure to create the RAID on the > outer half of the disks (setup may depend on the disk model and raid > controller used), leaving the inner half empty. > Use a logical volume manager (LVM), which always helps when adding disk > space, and create 2 partitions on your RAID10. One for data and one for > log + indexes. This should look like this: > > ----- ----- ----- ----- > | 1 | | 1 | | 1 | | 1 | > ----- ----- ----- ----- <- outer, faster half of the disk > | 2 | | 2 | | 2 | | 2 | part of the RAID10 > ----- ----- ----- ----- > | | | | | | | | > | | | | | | | | <- inner, slower half of the disk > | | | | | | | | not used at all > ----- ----- ----- ----- > > Partition 1 for data, partition 2 for log + indexes. All mirrored to the > other 4 disks not shown. > > If you take 36GB disks, this should end up like this: > > RAID10 has size of 36 / 2 * 4 = 72GB > Partition 1 is 36 GB > Partition 2 is 36 GB > > If 36GB is not enough for your pgdata set, you might consider moving to > 72GB disks, or (even better) make a 16 drive RAID10 out of 36GB disks, > which both will end up in a size of 72GB for your data (but the 16 drive > version will be faster). > > Any comments? > > Regards, > Bjoern > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org --=-ohWxbOoNulLVxR9g8Rk7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit I see you've got an LSI Megaraid card with oodles of Cache.  However, don't underestimate the power of the software RAID implementation that Red Hat Linux comes with.

We're using RHE 2.1 and I can recommend Red Hat Enterprise Linux if you want an excellent implementation of software RAID.  In fact we have found the software implementation more flexible than that of some expensive hardware controllers.  In addition there are also tools to enhance the base implementation even further, making setup and maintenance even easier.  An advantage of the software implementation is being able to RAID by partition, not necessarily entire disks.

To answer question 1, if you use software raid the chunk size is part of the /etc/raidtab file that is used on initial container creation. 4KB is the standard and a LARGE chunk size of 1MB may affect performance if you're not writing down to blocks in that size continuously.  If you make it to big and you're constantly needing to write out smaller chunks of information, then you will find the disk "always" working and would be an inefficient use of the blocks. There is some free info around about calculating the ideal chunk size. Looking for "Calculating chunk size for RAID" through google.

In the software implementation, after setup the raidtab is uncessary as the superblocks of the disks now contain their relevant information.
As for the application knowing any of this, no, the application layers are entirely unaware of the lower implementation.  They simply function as normal by writing to directories that are now mounted a different way.  The kernel takes care of the underlying RAID writes and syncs.
3 is easy to implement with software raid under linux.  You simply partition the drive like normal, mark the partitions you want to "raid" as 'fd' 'linux raid autodetect', then configure the /etc/raidtab and do a mkraid /dev/mdxx where mdxx is the matching partition for the raid setup.  You can map them anyway you want, but it can get confusing if you're mapping /dev/sda6 > /dev/sdb8 and calling it /dev/md7.
We've found it easier to make them all line up,  /dev/sda6 > /dev/sdb6 > /dev/md6

FYI, if you want better performance, use 15K SCSI disks, and make sure you've got more than 8MB of cache per disk.  Also, you're correct in splitting the drives across the channel, that's a trap for young players ;-)

Bjoern is right to recommend an LVM, it will allow you to dynamically allocate new size to the RAID volume when you add more disks.  However I've no experience in implementation with an LVM under the software RAID for Linux, though I believe it can be done.

The software RAID implementation allows you to stop and start software RAID devices as desired, add new hot spare disks to the containers as needed and rebuild containers on the fly. You can even change kernel options to speed up or slow down the sync speed when rebuilding the container.

Anyway, have fun, cause striping is the hot rod of the RAID implementations ;-)

Regards.
    Hadley


On Fri, 2004-05-14 at 09:53, Bjoern Metzdorf wrote:
James Thornton wrote:

>> This is what I am considering the ultimate platform for postgresql:
>>
>> Hardware:
>> Tyan Thunder K8QS board
>> 2-4 x Opteron 848 in NUMA mode
>> 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor)
>> LSI Megaraid 320-2 with 256 MB cache ram and battery backup
>> 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over both 
>> channels (3 + 4) for pgdata including indexes and wal.
> 
> You might also consider configuring the Postgres data drives for a RAID 
> 10 SAME configuration as described in the Oracle paper "Optimal Storage 
> Configuration Made Easy" 
> (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has 
> anyone delved into this before?

Ok, if I understand it correctly the papers recommends the following:

1. Get many drives and stripe them into a RAID0 with a stripe width of 
1MB. I am not quite sure if this stripe width is to be controlled at the 
application level (does postgres support this?) or if e.g. the "chunk 
size" of the linux software driver is meant. Normally a chunk size of 
4KB is recommended, so 1MB sounds fairly large.

2. Mirror your RAID0 and get a RAID10.

3. Use primarily the fast, outer regions of your disks. In practice this 
might be achieved by putting only half of the disk (the outer half) into 
your stripe set. E.g. put only the outer 18GB of your 36GB disks into 
the stripe set. Btw, is it common for all drives that the outer region 
is on the higher block numbers? Or is it sometimes on the lower block 
numbers?

4. Subset data by partition, not disk. If you have 8 disks, then don't 
take a 4 disk RAID10 for data and the other one for log or indexes, but 
make a global 8 drive RAID10 and have it partitioned the way that data 
and log + indexes are located on all drives.

They say, which is very interesting, as it is really contrary to what is 
normally recommended, that it is good or better to have one big stripe 
set over all disks available, than to put log + indexes on a separated 
stripe set. Having one big stripe set means that the speed of this big 
stripe set is available to all data. In practice this setup is as fast 
as or even faster than the "old" approach.

----------------------------------------------------------------

Bottom line for a normal, less than 10 disk setup:

Get many disks (8 + spare), create a RAID0 with 4 disks and mirror it to 
the other 4 disks for a RAID10. Make sure to create the RAID on the 
outer half of the disks (setup may depend on the disk model and raid 
controller used), leaving the inner half empty.
Use a logical volume manager (LVM), which always helps when adding disk 
space, and create 2 partitions on your RAID10. One for data and one for 
log + indexes. This should look like this:

----- ----- ----- -----
| 1 | | 1 | | 1 | | 1 |
----- ----- ----- -----  <- outer, faster half of the disk
| 2 | | 2 | | 2 | | 2 |     part of the RAID10
----- ----- ----- -----
|   | |   | |   | |   |
|   | |   | |   | |   |  <- inner, slower half of the disk
|   | |   | |   | |   |     not used at all
----- ----- ----- -----

Partition 1 for data, partition 2 for log + indexes. All mirrored to the 
other 4 disks not shown.

If you take 36GB disks, this should end up like this:

RAID10 has size of 36 / 2 * 4 = 72GB
Partition 1 is 36 GB
Partition 2 is 36 GB

If 36GB is not enough for your pgdata set, you might consider moving to 
72GB disks, or (even better) make a 16 drive RAID10 out of 36GB disks, 
which both will end up in a size of 72GB for your data (but the 16 drive 
version will be faster).

Any comments?

Regards,
Bjoern

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
--=-ohWxbOoNulLVxR9g8Rk7-- From pgsql-admin-owner@postgresql.org Thu May 13 20:35:16 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 99C9FD1B16C for ; Thu, 13 May 2004 20:35:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 47539-06 for ; Thu, 13 May 2004 20:34:50 -0300 (ADT) Received: from roam.unifiedmind.com (unifiedmind.com [209.164.72.58]) by svr1.postgresql.org (Postfix) with SMTP id 22BD1D1B1BD for ; Thu, 13 May 2004 20:34:47 -0300 (ADT) Received: (qmail 29203 invoked from network); 13 May 2004 23:57:11 -0000 Received: from unknown (HELO jamesthornton.com) (james@65.65.104.48) by 0 with SMTP; 13 May 2004 23:57:11 -0000 Message-ID: <40A40670.5030901@jamesthornton.com> Date: Thu, 13 May 2004 18:36:16 -0500 From: James Thornton User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hadley Willan Cc: Bjoern Metzdorf , pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Re: [PERFORM] Quad processor options - summary References: <40A2A7FA.6060403@turtle-entertainment.de> <40A3E250.2020204@jamesthornton.com> <40A3EE5B.1050104@turtle-entertainment.de> <1084489156.5424.31.camel@atlas.sol.deeper.co.nz> In-Reply-To: <1084489156.5424.31.camel@atlas.sol.deeper.co.nz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/139 X-Sequence-Number: 13455 Hadley Willan wrote: > To answer question 1, if you use software raid the chunk size is part of= =20 > the /etc/raidtab file that is used on initial container creation. 4KB is= =20 > the standard and a LARGE chunk size of 1MB may affect performance if=20 > you're not writing down to blocks in that size continuously. If you=20 > make it to big and you're constantly needing to write out smaller chunks= =20 > of information, then you will find the disk "always" working and would=20 > be an inefficient use of the blocks. There is some free info around=20 > about calculating the ideal chunk size. Looking for "Calculating chunk=20 > size for RAID" through google. "Why does the SAME configuration recommend a one megabyte stripe width?=20 Let=92s examine the reasoning behind this choice. Why not use a stripe=20 depth smaller than one megabyte? Smaller stripe depths can improve disk=20 throughput for a single process by spreading a single IO across multiple=20 disks. However IOs that are much smaller than a megabyte can cause seek=20 time to becomes a large fraction of the total IO time. Therefore, the=20 overall efficiency of the storage system is reduced. In some cases it=20 may be worth trading off some efficiency for the increased throughput=20 that smaller stripe depths provide. In general it is not necessary to do=20 this though. Parallel execution at database level achieves high disk=20 throughput while keeping efficiency high. Also, remember that the degree=20 of parallelism can be dynamically tuned, whereas the stripe depth is=20 very costly to change. Why not use a stripe depth bigger than one megabyte? One megabyte is=20 large enough that a sequential scan will spend most of its time=20 transferring data instead of positioning the disk head. A bigger stripe=20 depth will improve scan efficiency but only modestly. One megabyte is=20 small enough that a large IO operation will not =93hog=94 a single disk for= =20 very long before moving to the next one. Further, one megabyte is small=20 enough that Oracle=92s asynchronous readahead operations access multiple=20 disks. One megabyte is also small enough that a single stripe unit will=20 not become a hot-spot. Any access hot-spot that is smaller than a=20 megabyte should fit comfortably in the database buffer cache. Therefore=20 it will not create a hot-spot on disk." The SAME configuration paper says to ensure that that large IO=20 operations aren't broken up between the DB and the disk, you need to be=20 able to ensure that the database file multi-block read count (Oracle has=20 a param called db_file_multiblock_read_count, does Postgres?) is the=20 same size as the stripe width and the OS IO limits should be at least=20 this size. Also, it says, "Ideally we would like to stripe the log files using the=20 same one megabyte stripe width as the rest of the files. However, the=20 log files are written sequentially, and many storage systems limit the=20 maximum size of a single write operation to one megabyte (or even less).=20 If the maximum write size is limited, then using a one megabyte stripe=20 width for the log files may not work well. In this case, a smaller=20 stripe width such as 64K may work better. Caching RAID controllers are=20 an exception to this. If the storage subsystem can cache write=20 operations in nonvolatile RAM, then a one megabyte stripe width will=20 work well for the log files. In this case, the write operation will be=20 buffered in cache and the next log writes can be issued before the=20 previous write is destaged to disk." --=20 James Thornton ______________________________________________________ Internet Business Consultant, http://jamesthornton.com From pgsql-admin-owner@postgresql.org Thu May 13 21:52:07 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D9591D1B1AE for ; Thu, 13 May 2004 21:52:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63986-07 for ; Thu, 13 May 2004 21:51:39 -0300 (ADT) Received: from monsoon.he.net (monsoon.he.net [64.62.221.2]) by svr1.postgresql.org (Postfix) with SMTP id 29F70D1B18A for ; Thu, 13 May 2004 21:51:35 -0300 (ADT) Received: from [10.244.45.7] ([216.113.168.128]) by monsoon.he.net for ; Thu, 13 May 2004 17:51:33 -0700 In-Reply-To: <40A3EE5B.1050104@turtle-entertainment.de> References: <40A2A7FA.6060403@turtle-entertainment.de> <40A3E250.2020204@jamesthornton.com> <40A3EE5B.1050104@turtle-entertainment.de> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: pgsql-admin@postgresql.org, James Thornton , pgsql-performance@postgresql.org From: Paul Tuckfield Subject: Re: [PERFORM] Quad processor options - summary Date: Thu, 13 May 2004 17:51:42 -0700 To: Bjoern Metzdorf X-Mailer: Apple Mail (2.613) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/140 X-Sequence-Number: 13456 One big caveat re. the "SAME" striping strategy, is that readahead can really hurt an OLTP you. Mind you, if you're going from a few disks to a caching array with many disks, it'll be hard to not have a big improvement But if you push the envelope of the array with a "SAME" configuration, readahead will hurt. Readahead is good for sequential reads but bad for random reads, because the various caches (array and filesystem) get flooded with all the blocks that happen to come after whatever random blocks you're reading. Because they're random reads these extra blocks are genarally *not* read by subsequent queries if the database is large enough to be much larger than the cache itself. Of course, the readahead blocks are good if you're doing sequential scans, but you're not doing sequential scans because it's an OLTP database, right? So this'll probably incite flames but: In an OLTP environment of decent size, readahead is bad. The ideal would be to adjust it dynamically til optimum (likely no readahead) if the array allows it, but most people are fooled by good performance of readahead on simple singlethreaded or small dataset tests, and get bitten by this under concurrent loads or large datasets. James Thornton wrote: > >>> This is what I am considering the ultimate platform for postgresql: >>> >>> Hardware: >>> Tyan Thunder K8QS board >>> 2-4 x Opteron 848 in NUMA mode >>> 4-8 GB RAM (DDR400 ECC Registered 1 GB modules, 2 for each processor) >>> LSI Megaraid 320-2 with 256 MB cache ram and battery backup >>> 6 x 36GB SCSI 10K drives + 1 spare running in RAID 10, split over >>> both channels (3 + 4) for pgdata including indexes and wal. >> You might also consider configuring the Postgres data drives for a >> RAID 10 SAME configuration as described in the Oracle paper "Optimal >> Storage Configuration Made Easy" >> (http://otn.oracle.com/deploy/availability/pdf/oow2000_same.pdf). Has >> anyone delved into this before? > > Ok, if I understand it correctly the papers recommends the following: > > 1. Get many drives and stripe them into a RAID0 with a stripe width of > 1MB. I am not quite sure if this stripe width is to be controlled at > the application level (does postgres support this?) or if e.g. the > "chunk size" of the linux software driver is meant. Normally a chunk > size of 4KB is recommended, so 1MB sounds fairly large. > > 2. Mirror your RAID0 and get a RAID10. > > 3. Use primarily the fast, outer regions of your disks. In practice > this might be achieved by putting only half of the disk (the outer > half) into your stripe set. E.g. put only the outer 18GB of your 36GB > disks into the stripe set. Btw, is it common for all drives that the > outer region is on the higher block numbers? Or is it sometimes on the > lower block numbers? > > 4. Subset data by partition, not disk. If you have 8 disks, then don't > take a 4 disk RAID10 for data and the other one for log or indexes, > but make a global 8 drive RAID10 and have it partitioned the way that > data and log + indexes are located on all drives. > > They say, which is very interesting, as it is really contrary to what > is normally recommended, that it is good or better to have one big > stripe set over all disks available, than to put log + indexes on a > separated stripe set. Having one big stripe set means that the speed > of this big stripe set is available to all data. In practice this > setup is as fast as or even faster than the "old" approach. > > ---------------------------------------------------------------- > > Bottom line for a normal, less than 10 disk setup: > > Get many disks (8 + spare), create a RAID0 with 4 disks and mirror it > to the other 4 disks for a RAID10. Make sure to create the RAID on the > outer half of the disks (setup may depend on the disk model and raid > controller used), leaving the inner half empty. > Use a logical volume manager (LVM), which always helps when adding > disk space, and create 2 partitions on your RAID10. One for data and > one for log + indexes. This should look like this: > > ----- ----- ----- ----- > | 1 | | 1 | | 1 | | 1 | > ----- ----- ----- ----- <- outer, faster half of the disk > | 2 | | 2 | | 2 | | 2 | part of the RAID10 > ----- ----- ----- ----- > | | | | | | | | > | | | | | | | | <- inner, slower half of the disk > | | | | | | | | not used at all > ----- ----- ----- ----- > > Partition 1 for data, partition 2 for log + indexes. All mirrored to > the other 4 disks not shown. > > If you take 36GB disks, this should end up like this: > > RAID10 has size of 36 / 2 * 4 = 72GB > Partition 1 is 36 GB > Partition 2 is 36 GB > > If 36GB is not enough for your pgdata set, you might consider moving > to 72GB disks, or (even better) make a 16 drive RAID10 out of 36GB > disks, which both will end up in a size of 72GB for your data (but the > 16 drive version will be faster). > > Any comments? > > Regards, > Bjoern > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: 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 Fri May 14 05:30:55 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 690AFD1B3DE for ; Fri, 14 May 2004 05:30:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 49436-02 for ; Fri, 14 May 2004 05:30:34 -0300 (ADT) Received: from mail.interlogica.org (host34-209.pool8174.interbusiness.it [81.74.209.34]) by svr1.postgresql.org (Postfix) with ESMTP id 82C9AD1B3DD for ; Fri, 14 May 2004 05:30:21 -0300 (ADT) Received: from [10.2.8.2] (helo=ilbug) by mail.interlogica.org with esmtp (Exim 3.16 #1) id 1BOYC4-0007sL-00; Fri, 14 May 2004 10:37:24 +0200 From: "Fabio Panizzutti" To: "'Tom Lane'" Cc: Subject: R: R: Query plan on identical tables differs . Why ? Date: Fri, 14 May 2004 10:40:24 +0200 Message-ID: <000f01c4398f$1a20cbc0$3c02020a@ufficio> 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: <8904.1084460460@sss.pgh.pa.us> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/134 X-Sequence-Number: 6965 >>>-----Messaggio originale----- >>>Da: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 >>>Inviato: gioved=EC 13 maggio 2004 17.01 >>>A: Fabio Panizzutti >>>Cc: 'Shridhar Daithankar'; pgsql-performance@postgresql.org >>>Oggetto: Re: R: [PERFORM] Query plan on identical tables=20 >>>differs . Why ?=20 >>> >>> >>>"Fabio Panizzutti" writes: >>>> I don't understand why the planner chose a different query plan on=20 >>>> identical tables with same indexes . >>> >>>Different data statistics; not to mention different table=20 >>>sizes (the cost equations are not linear). >>> >>>Have you ANALYZEd (or VACUUM ANALYZEd) both tables recently? >>> >>>If the stats are up to date but still not doing the right=20 >>>thing, you might try increasing the statistics target for=20 >>>the larger table's tag_id column. See ALTER TABLE SET STATISTICS. >>> >>> regards, tom lane >>> All tables are vacumed and analyzed .=20 I try so set statistics to 1000 to tag_id columns with ALTER TABLE SET STATISTIC, revacuum analyze , but the planner choose the same query plan .=20 I'm trying now to change the indexes . Thanks=20 From pgsql-performance-owner@postgresql.org Fri May 14 05:45:30 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CCA5DD1B1DD for ; Fri, 14 May 2004 05:45:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46866-09 for ; Fri, 14 May 2004 05:45:09 -0300 (ADT) Received: from mail.interlogica.org (host34-209.pool8174.interbusiness.it [81.74.209.34]) by svr1.postgresql.org (Postfix) with ESMTP id 0BC4AD1B1C8 for ; Fri, 14 May 2004 05:45:06 -0300 (ADT) Received: from [10.2.8.2] (helo=ilbug) by mail.interlogica.org with esmtp (Exim 3.16 #1) id 1BOYQJ-000890-00; Fri, 14 May 2004 10:52:07 +0200 From: "Fabio Panizzutti" To: "'Stephan Szabo'" Cc: Subject: R: R: Query plan on identical tables differs . Why ? Date: Fri, 14 May 2004 10:55:07 +0200 Message-ID: <001001c43991$284506b0$3c02020a@ufficio> 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: <20040513080130.E3465@megazone.bigpanda.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/135 X-Sequence-Number: 6966 >>>-----Messaggio originale----- >>>Da: Stephan Szabo [mailto:sszabo@megazone.bigpanda.com]=20 >>>Inviato: gioved=EC 13 maggio 2004 17.17 >>>A: Fabio Panizzutti >>>Cc: 'Shridhar Daithankar'; pgsql-performance@postgresql.org >>>Oggetto: Re: R: [PERFORM] Query plan on identical tables=20 >>>differs . Why ? >>> >>> >>>On Thu, 13 May 2004, Fabio Panizzutti wrote: >>> >>> >>>> I don't understand why the planner chose a different query plan on=20 >>>> identical tables with same indexes . >>> >>>Because it's more than table structure that affects the=20 >>>choice made by the planner. In addition the statistics=20 >>>about the values that are there as well as the estimated=20 >>>size of the table have effects. One way to see is to see=20 >>>what it thinks is best is to remove the indexes it is using=20 >>>and see what plan it gives then, how long it takes and the=20 >>>estimated costs for those plans. >>> >>>In other suggestions, I think having a (tag_id, data_tag)=20 >>>index rather than (data_tag, tag_id) may be a win for=20 >>>queries like this. Also, unless you're doing many select=20 >>>queries by only the first field of the composite index and=20 >>>you're not doing very many insert/update/deletes, you may=20 >>>want to drop the other index on just that field. >>> Thanks for your attention , i change the indexes on the tables as you suggested : storico=3D# \d storico_misure_short Table "tenore.storico_misure_short" Column | Type | Modifiers -------------------------+-----------------------------+----------- data_tag | timestamp without time zone | not null tag_id | integer | not null unita_misura | character varying(6) | not null valore_tag | numeric(20,3) | not null qualita | integer | not null numero_campioni | numeric(5,0) | frequenza_campionamento | numeric(3,0) | Indexes: "storico_misure_short_idx" primary key, btree (tag_id, data_tag) "storico_misure_short_data_tag_idx2" btree (data_tag) storico=3D# \d storico_misure Table "tenore.storico_misure" Column | Type | Modifiers -------------------------+-----------------------------+----------- data_tag | timestamp without time zone | not null tag_id | integer | not null unita_misura | character varying(6) | not null valore_tag | numeric(20,3) | not null qualita | integer | not null numero_campioni | numeric(5,0) | frequenza_campionamento | numeric(3,0) | Indexes: "storico_misure_idx" primary key, btree (tag_id, data_tag) "storico_misure_data_tag_idx2" btree (data_tag) And now performance are similar and the planner works correctly : storico=3D# \d storico_misure_short Table "tenore.storico_misure_short" Column | Type | Modifiers -------------------------+-----------------------------+----------- data_tag | timestamp without time zone | not null tag_id | integer | not null unita_misura | character varying(6) | not null valore_tag | numeric(20,3) | not null qualita | integer | not null numero_campioni | numeric(5,0) | frequenza_campionamento | numeric(3,0) | Indexes: "storico_misure_short_idx" primary key, btree (tag_id, data_tag) "storico_misure_short_data_tag_idx2" btree (data_tag) storico=3D# \d storico_misure Table "tenore.storico_misure" Column | Type | Modifiers -------------------------+-----------------------------+----------- data_tag | timestamp without time zone | not null tag_id | integer | not null unita_misura | character varying(6) | not null valore_tag | numeric(20,3) | not null qualita | integer | not null numero_campioni | numeric(5,0) | frequenza_campionamento | numeric(3,0) | Indexes: "storico_misure_idx" primary key, btree (tag_id, data_tag) "storico_misure_data_tag_idx2" btree (data_tag) storico=3D# explain analyze select tag_id,valore_tag,data_tag from storico_misure_short where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=3D37423 ; =20 QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ -------------------------- Index Scan using storico_misure_short_idx on storico_misure_short (cost=3D0.00..2104.47 rows=3D584 width=3D20) (actual time=3D0.232..39.932 rows=3D864 loops=3D1) Index Cond: ((tag_id =3D 37423) AND (data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone)) Total runtime: 40.912 ms (3 rows) Time: 43,233 ms storico=3D# explain analyze select tag_id,valore_tag,data_tag from storico_misure where (data_tag>'2004-05-03' and data_tag <'2004-05-12') and tag_id=3D37423 ; =20 QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ -------------------------- Index Scan using storico_misure_idx on storico_misure (cost=3D0.00..2097.56 rows=3D547 width=3D21) (actual time=3D0.518..92.067 rows=3D835 loops=3D1) Index Cond: ((tag_id =3D 37423) AND (data_tag > '2004-05-03 00:00:00'::timestamp without time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without time zone)) Total runtime: 93.459 ms (3 rows) I need the index on data_tag for other query ( last values on the last date ) . Regards=20 Fabio=20 From pgsql-performance-owner@postgresql.org Fri May 14 06:13:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 81BFFD1B3D6 for ; Fri, 14 May 2004 06:13:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 55762-06 for ; Fri, 14 May 2004 06:12:49 -0300 (ADT) Received: from mail.interlogica.org (host34-209.pool8174.interbusiness.it [81.74.209.34]) by svr1.postgresql.org (Postfix) with ESMTP id 6AFCCD1B3C6 for ; Fri, 14 May 2004 06:12:46 -0300 (ADT) Received: from [10.2.8.2] (helo=ilbug) by mail.interlogica.org with esmtp (Exim 3.16 #1) id 1BOYr2-0000AP-00; Fri, 14 May 2004 11:19:44 +0200 From: "Fabio Panizzutti" To: "'Manfred Koizar'" Cc: Subject: R: R: Query plan on identical tables differs . Why ? Date: Fri, 14 May 2004 11:22:44 +0200 Message-ID: <001101c43995$03e8b830$3c02020a@ufficio> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/136 X-Sequence-Number: 6967 >>>> Index Scan using pk_storico_misure_2 on storico_misure >>>>(cost=0.00..1984.64 rows=658 width=21) (actual >>>time=723.441..1858.107 >>>>rows=835 loops=1) >>>> Index Cond: ((data_tag > '2004-05-03 >>>00:00:00'::timestamp without >>>>time zone) AND (data_tag < '2004-05-12 00:00:00'::timestamp without >>>>time >>>>zone) AND (tag_id = 37423)) >>> >>>Either most of the time is spent skipping index tuples in >>>the data_tag range 2004-05-03 to 2004-05-12 which have >>>tag_id <> 37423, or getting those 835 rows causes a lot of >>>disk seeks. >>> >>>If the former is true, an index on (tag_id, data_tag) will help. >>> Is true , i recreate the indexes making an index on (tag_id, data_tag) and works fine . >>>In your first message you wrote: >>>>fsync = false >>> >>>Do this only if you don't care for your data. >>> I set it to false , for performance tests .I've a stored procedure that make about 2000 insert in 2 tables and 2000 delete in another and with fsync false perfomrmance are 2.000 -3.000 ms (stable) with fsync 3.000 ms to 15.000 ms . I trust in my hardware an O.S so fsync setting is a big dubt for my production enviroment . Thanks a lot Bye From pgsql-performance-owner@postgresql.org Fri May 14 06:55:55 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D6B1FD1B1A6 for ; Fri, 14 May 2004 06:55:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 67616-02 for ; Fri, 14 May 2004 06:55:35 -0300 (ADT) Received: from houston.familyhealth.com.au (fhnet.arach.net.au [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 0F473D1B1C6 for ; Fri, 14 May 2004 06:55:31 -0300 (ADT) Received: from houston.familyhealth.com.au (chriskl@localhost [127.0.0.1]) by houston.familyhealth.com.au (8.12.9p1/8.12.9) with ESMTP id i4E9tHWL022758; Fri, 14 May 2004 17:55:17 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Received: from localhost (chriskl@localhost) by houston.familyhealth.com.au (8.12.9p1/8.12.9/Submit) with ESMTP id i4E9tHLI022755; Fri, 14 May 2004 17:55:17 +0800 (WST) X-Authentication-Warning: houston.familyhealth.com.au: chriskl owned process doing -bs Date: Fri, 14 May 2004 17:55:17 +0800 (WST) From: Christopher Kings-Lynne To: Fabio Panizzutti Cc: "'Manfred Koizar'" , Subject: Re: R: R: Query plan on identical tables differs . Why ? In-Reply-To: <001101c43995$03e8b830$3c02020a@ufficio> Message-ID: <20040514175425.S22343-100000@houston.familyhealth.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/137 X-Sequence-Number: 6968 > I trust in my hardware an O.S so fsync setting is a > big dubt for my production enviroment . Then you are making a big mistake, loving your hardware more than your data... Chris From pgsql-admin-owner@postgresql.org Fri May 14 07:15:39 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1F64AD1B20B; Fri, 14 May 2004 07:15:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71203-04; Fri, 14 May 2004 07:15:11 -0300 (ADT) Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [202.0.58.20]) by svr1.postgresql.org (Postfix) with ESMTP id A874FD1B19F; Fri, 14 May 2004 07:15:07 -0300 (ADT) Received: from smtp-2.paradise.net.nz (smtp-2b.paradise.net.nz [202.0.32.211]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0HXP00EWZ8H80F@linda-1.paradise.net.nz>; Fri, 14 May 2004 22:15:09 +1200 (NZST) Received: from paradise.net.nz (203-79-100-84.adsl.paradise.net.nz [203.79.100.84]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id D9A6F9E248; Fri, 14 May 2004 22:15:07 +1200 (NZST) Date: Fri, 14 May 2004 22:17:10 +1200 From: Mark Kirkwood Subject: Re: [PERFORM] Quad processor options - summary In-reply-to: <40A3EE5B.1050104@turtle-entertainment.de> To: Bjoern Metzdorf Cc: James Thornton , pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Message-id: <40A49CA6.1020500@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040404 References: <40A2A7FA.6060403@turtle-entertainment.de> <40A3E250.2020204@jamesthornton.com> <40A3EE5B.1050104@turtle-entertainment.de> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/142 X-Sequence-Number: 13458 I would recommend trying out several stripe sizes, and making your own measurements. A while ago I was involved in building a data warehouse system (Oracle, DB2) and after several file and db benchmark exercises we used 256K stripes, as these gave the best overall performance results for both systems. I am not saying "1M is wrong", but I am saying "1M may not be right" :-) regards Mark Bjoern Metzdorf wrote: > > 1. Get many drives and stripe them into a RAID0 with a stripe width of > 1MB. I am not quite sure if this stripe width is to be controlled at > the application level (does postgres support this?) or if e.g. the > "chunk size" of the linux software driver is meant. Normally a chunk > size of 4KB is recommended, so 1MB sounds fairly large. > > From pgsql-performance-owner@postgresql.org Fri May 14 07:20:47 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 835A7D1B1FE for ; Fri, 14 May 2004 07:20:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 69146-07 for ; Fri, 14 May 2004 07:20:27 -0300 (ADT) Received: from mail.interlogica.org (host34-209.pool8174.interbusiness.it [81.74.209.34]) by svr1.postgresql.org (Postfix) with ESMTP id 33C22D1B20A for ; Fri, 14 May 2004 07:20:22 -0300 (ADT) Received: from [10.2.8.2] (helo=ilbug) by mail.interlogica.org with esmtp (Exim 3.16 #1) id 1BOZuO-0001K9-00; Fri, 14 May 2004 12:27:16 +0200 From: "Fabio Panizzutti" To: "'Christopher Kings-Lynne'" Cc: Subject: R: R: R: Query plan on identical tables differs . Why ? Date: Fri, 14 May 2004 12:30:16 +0200 Message-ID: <001201c4399e$73469cc0$3c02020a@ufficio> 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: <20040514175425.S22343-100000@houston.familyhealth.com.au> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/139 X-Sequence-Number: 6970 >>>-----Messaggio originale----- >>>Da: pgsql-performance-owner@postgresql.org=20 >>>[mailto:pgsql-performance-owner@postgresql.org] Per conto di=20 >>>Christopher Kings-Lynne >>>Inviato: venerd=EC 14 maggio 2004 11.55 >>>A: Fabio Panizzutti >>>Cc: 'Manfred Koizar'; pgsql-performance@postgresql.org >>>Oggetto: Re: R: R: [PERFORM] Query plan on identical tables=20 >>>differs . Why ? >>> >>> >>>> I trust in my hardware an O.S so fsync setting is a >>>> big dubt for my production enviroment . >>> >>>Then you are making a big mistake, loving your hardware more=20 >>>than your data... >>> >>>Chris >>> I'm testing for better performance in insert/delete so i turn off fsync , i don't love hardware more than data , so i'll set fsync on in the production enviroment . Thanks a lot Best regards Fabio=20=20=20=20 From pgsql-performance-owner@postgresql.org Fri May 14 15:12:28 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7A305D1B18A for ; Fri, 14 May 2004 15:12:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 74211-03 for ; Fri, 14 May 2004 15:12:07 -0300 (ADT) Received: from web60608.mail.yahoo.com (web60608.mail.yahoo.com [216.109.119.82]) by svr1.postgresql.org (Postfix) with SMTP id 6E0F1D1B184 for ; Fri, 14 May 2004 15:12:05 -0300 (ADT) Message-ID: <20040514180037.8730.qmail@web60608.mail.yahoo.com> Received: from [200.17.210.82] by web60608.mail.yahoo.com via HTTP; Fri, 14 May 2004 11:00:37 PDT Date: Fri, 14 May 2004 11:00:37 -0700 (PDT) From: Eduardo Almeida Subject: TPCH 100GB - need some help To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/140 X-Sequence-Number: 6971 Hi folks, I need some help in a TPCH 100GB benchmark. I described our settings in: http://archives.postgresql.org/pgsql-performance/2004-04/msg00377.php Some queries are taking to long to finish (4, 8, 9, 10, 19,20 and 22) and I need some help to increase the system performance. Here I put the query #19, the explain and the "top" for it. This query is running since yesterday 10 AM. Query text is: select sum(l_extendedprice* (1 - l_discount)) as revenue from lineitem, part where ( p_partkey = l_partkey and p_brand = 'Brand#32' and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') and l_quantity >= 2 and l_quantity <= 2 + 10 and p_size between 1 and 5 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruct = 'DELIVER IN PERSON' ) or ( p_partkey = l_partkey and p_brand = 'Brand#42' and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') and l_quantity >= 11 and l_quantity <= 11 + 10 and p_size between 1 and 10 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruct = 'DELIVER IN PERSON' ) or ( p_partkey = l_partkey and p_brand = 'Brand#54' and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') and l_quantity >= 27 and l_quantity <= 27 + 10 and p_size between 1 and 15 and l_shipmode in ('AIR', 'AIR REG') and l_shipinstruct = 'DELIVER IN PERSON' ); Tasks: 57 total, 2 running, 55 sleeping, 0 stopped, 0 zombie Cpu(s): 16.5% user, 1.8% system, 0.0% nice, 59.2% idle, 22.5% IO-wait Mem: 4036184k total, 4025008k used, 11176k free, 4868k buffers Swap: 4088500k total, 13204k used, 4075296k free, 3770208k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 28118 postgres 25 0 372m 354m 335m R 99.4 9.0 1724:45 postmaster Aggregate (cost=6825900228313539.00..6825900228313539.00 rows=1 width=22) -> Nested Loop (cost=887411.00..6825900228313538.00 rows=325 width=22) -> Seq Scan on lineitem (cost=0.00..21797716.88 rows=600037888 width=79) -> Materialize (cost=887411.00..1263193.00 rows=20000000 width=36) -> Seq Scan on part (cost=0.00..711629.00 rows=20000000 width=36) __________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ From pgsql-performance-owner@postgresql.org Fri May 14 18:08:41 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BA50BD1B43A for ; Fri, 14 May 2004 18:08:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 05495-09 for ; Fri, 14 May 2004 18:08:20 -0300 (ADT) Received: from hotmail.com (bay8-f54.bay8.hotmail.com [64.4.27.54]) by svr1.postgresql.org (Postfix) with ESMTP id BC956D1B16A for ; Fri, 14 May 2004 18:08:17 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 14 May 2004 14:08:19 -0700 Received: from 69.65.137.210 by by8fd.bay8.hotmail.msn.com with HTTP; Fri, 14 May 2004 21:08:19 GMT X-Originating-IP: [69.65.137.210] X-Originating-Email: [el_vigia_ec@hotmail.com] X-Sender: el_vigia_ec@hotmail.com From: "Jaime Casanova" To: pgsql-performance@postgresql.org Subject: numeric data types Date: Fri, 14 May 2004 21:08:19 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 14 May 2004 21:08:19.0669 (UTC) FILETIME=[953C7850:01C439F7] X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/142 X-Sequence-Number: 6973 Hi all, i have a question, is there any advantages in using numeric(1) or numeric(2) in place of smallint? is there any diff. in performance if i use smallint in place of integer? Thanx in advance, Jaime Casanova _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail From pgsql-performance-owner@postgresql.org Fri May 14 15:26:17 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7ADF7D1B1E4 for ; Fri, 14 May 2004 15:26:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 77474-07 for ; Fri, 14 May 2004 15:25:56 -0300 (ADT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id C7A69D1B26A for ; Fri, 14 May 2004 15:25:52 -0300 (ADT) Received: from [134.22.68.74] (dyn-68-74.tor.dsl.tht.net [134.22.68.74]) by tht.net (Postfix) with ESMTP id 44DC276AD7; Fri, 14 May 2004 14:25:56 -0400 (EDT) Subject: Re: TPCH 100GB - need some help From: Rod Taylor To: Eduardo Almeida Cc: Postgresql Performance In-Reply-To: <20040514180037.8730.qmail@web60608.mail.yahoo.com> References: <20040514180037.8730.qmail@web60608.mail.yahoo.com> Content-Type: text/plain Message-Id: <1084570822.672.43.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 14 May 2004 17:40:23 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.8 tagged_above=0.0 required=5.0 tests=DATE_IN_FUTURE_03_06 X-Spam-Level: ** X-Archive-Number: 200405/141 X-Sequence-Number: 6972 On Fri, 2004-05-14 at 14:00, Eduardo Almeida wrote: > Hi folks, > > I need some help in a TPCH 100GB benchmark. Performance with 7.5 is much improved over 7.4 for TPCH due to efforts of Tom Lane and OSDL. Give it a try with a recent snapshot of PostgreSQL. Otherwise, disable nested loops for that query. set enable_nestloop = off; From pgsql-performance-owner@postgresql.org Sat May 15 01:03:47 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0CC6FD1B170 for ; Sat, 15 May 2004 01:03:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 72978-09 for ; Sat, 15 May 2004 01:03:22 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0F79CD1B3C3 for ; Sat, 15 May 2004 01:03:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4F43GeM003210; Sat, 15 May 2004 00:03:16 -0400 (EDT) To: "Jaime Casanova" Cc: pgsql-performance@postgresql.org Subject: Re: numeric data types In-reply-to: References: Comments: In-reply-to "Jaime Casanova" message dated "Fri, 14 May 2004 21:08:19 -0000" Date: Sat, 15 May 2004 00:03:16 -0400 Message-ID: <3209.1084593796@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/143 X-Sequence-Number: 6974 "Jaime Casanova" writes: > i have a question, is there any advantages in using numeric(1) or numeric(2) > in place of smallint? Performance-wise, smallint is an order of magnitude better. regards, tom lane From pgsql-general-owner@postgresql.org Sun May 16 14:21:36 2004 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BFBC1D1E1F4 for ; Sun, 16 May 2004 14:21:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79262-07 for ; Sun, 16 May 2004 14:21:06 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id CF45ED1E405 for ; Sun, 16 May 2004 13:56:45 -0300 (ADT) Received: from p0.pureserver.info (unknown [217.160.111.113]) by www.postgresql.com (Postfix) with SMTP id 76361CF6833 for ; Sat, 15 May 2004 07:54:45 -0300 (ADT) Received: (qmail 29578 invoked by uid 703); 15 May 2004 10:52:27 -0000 Date: Sat, 15 May 2004 12:52:27 +0200 From: share-postgres@think42.com To: pgsql-general@postgresql.org Subject: filesystem option tuning Message-ID: <20040515125227.A29574@p15097255.pureserver.info> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.16i X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200405/482 X-Sequence-Number: 60916 Hi All, I have recently started evaluating Postgresql 7.4.2 to replace some *cough* more proprietary database systems... Thanks to the _excellent_ documentation (a point I cannot overemphasize) I was up and running in no time, and got a first test application running on the native C interface. There is just one point where I found the documentation lacking any description and practical hints (as opposed to all other topics), namely that of how to tune a setup for maximum performance regarding the layout of partitions on hard-disks and their mount options. I gather that the pg_xlog directory contains the transaction log and would benefit greatly from being put on a separate partition. I would then mount that partition with the noatime and forcedirectio options (on Solaris, the latter to circumvent the OS' buffer cache)? On the other hand the data partition should not be mounted with direct io, since Postgresql is documented as relying heavily on the OS' cache? Then I was wondering whether the fsync option refers only to the wal log (is that another name for the xlog, or is one a subset of the other?), or also to data write operations? With forcedirectio for the wal, do I still need fsync (or O_SYNC...) because otherwise I could corrupt the data? Are there any other directories that might benefit from being put on a dedicated disk, and with which mount options? Even without things like tablespaces there should be some headroom over having everything on one partition like in the default setup. What I should add is that reliability is a premium for us, we do not want to sacrifice integrity for speed, and that we are tuning for a high commit rate of small, simple transactions... I would be greatly thankful if somebody could give me some hints or pointers to further documentation as my search on the web did not show up much. Regards, Colin From pgsql-performance-owner@postgresql.org Sat May 15 13:04:15 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5AA74D1B176 for ; Sat, 15 May 2004 13:01:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 78770-02 for ; Sat, 15 May 2004 13:01:11 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E70D2D1B1C2 for ; Sat, 15 May 2004 13:00:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4FG0Xnp007285; Sat, 15 May 2004 12:00:33 -0400 (EDT) To: Eduardo Almeida Cc: pgsql-performance@postgresql.org Subject: Re: TPCH 100GB - need some help In-reply-to: <20040514180037.8730.qmail@web60608.mail.yahoo.com> References: <20040514180037.8730.qmail@web60608.mail.yahoo.com> Comments: In-reply-to Eduardo Almeida message dated "Fri, 14 May 2004 11:00:37 -0700" Date: Sat, 15 May 2004 12:00:33 -0400 Message-ID: <7284.1084636833@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/144 X-Sequence-Number: 6975 Eduardo Almeida writes: > I need some help in a TPCH 100GB benchmark. > Here I put the query #19, the explain and the "top" > for it. IIRC, this is one of the cases that inspired the work that's been done on the query optimizer for 7.5. I don't think you will be able to get 7.4 to generate a good plan for it (at least not without changing the query, which is against the TPC rules). How do you feel about running CVS tip? BTW, are you aware that OSDL has already done a good deal of work with running TPC benchmarks for Postgres (and some other OS databases)? regards, tom lane From pgsql-performance-owner@postgresql.org Sun May 16 14:13:20 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EB111D1E0B5 for ; Sun, 16 May 2004 14:13:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 76088-06 for ; Sun, 16 May 2004 14:12:56 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 5CBDED1E18D for ; Sun, 16 May 2004 13:56:04 -0300 (ADT) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by www.postgresql.com (Postfix) with ESMTP id 47649CF6831 for ; Sat, 15 May 2004 23:28:32 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with ESMTP id B79A31EB5; Sat, 15 May 2004 22:28:06 -0400 (EDT) Received: from bob.samurai.com ([127.0.0.1]) by localhost (bob.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25671-01-4; Sat, 15 May 2004 22:28:05 -0400 (EDT) Received: from [192.168.1.101] (d226-89-59.home.cgocable.net [24.226.89.59]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by bob.samurai.com (Postfix) with ESMTP id 51CC21E2B; Sat, 15 May 2004 22:28:03 -0400 (EDT) Subject: Re: numeric data types From: Neil Conway To: Jaime Casanova Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Message-Id: <1084674467.25578.115.camel@tokyo> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sat, 15 May 2004 22:27:47 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/145 X-Sequence-Number: 6976 On Fri, 2004-05-14 at 17:08, Jaime Casanova wrote: > is there any diff. in performance if i use smallint in place of integer? Assuming you steer clear of planner deficiencies, smallint should be slightly faster (since it consumes less disk space), but the performance difference should be very small. Also, alignment/padding considerations may mean that smallint doesn't actually save any space anyway. -Neil From pgsql-general-owner@postgresql.org Mon May 17 14:17:34 2004 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C1FB1D1C516 for ; Mon, 17 May 2004 14:07:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 77435-07 for ; Mon, 17 May 2004 14:07:09 -0300 (ADT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id 5CC3DD1B25D for ; Mon, 17 May 2004 14:04:57 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 1BPlXr-000CUY-0V; Mon, 17 May 2004 18:04:55 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 0635415987; Mon, 17 May 2004 18:04:54 +0100 (BST) Message-ID: <40A8F0B6.6060703@archonet.com> Date: Mon, 17 May 2004 18:04:54 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: share-postgres@think42.com Cc: pgsql-general@postgresql.org Subject: Re: filesystem option tuning References: <20040515125227.A29574@p15097255.pureserver.info> In-Reply-To: <20040515125227.A29574@p15097255.pureserver.info> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/523 X-Sequence-Number: 60957 share-postgres@think42.com wrote: > Hi All, > > I have recently started evaluating Postgresql 7.4.2 to replace some *cough* > more proprietary database systems... Thanks to the _excellent_ documentation > (a point I cannot overemphasize) I was up and running in no time, and got a > first test application running on the native C interface. In no official capacity whatsoever, welcome aboard. > There is just one point where I found the documentation lacking any > description and practical hints (as opposed to all other topics), namely > that of how to tune a setup for maximum performance regarding the layout of > partitions on hard-disks and their mount options. I'm not a Sun user, so I can't give any OS-specific notes, but in general: - Don't bypass the filesystem, but feel free to tinker with mount options if you think it will help - If you can put WAL on separate disk(s), all the better. - The general opinion seems to be RAID5 is slower than RAID10 unless you have a lot of disks - Battery-backed write-cache for your SCSI controller can be a big performance win - Tablespaces _should_ be available in the next release of PG, we'll know for sure soon. That might make life simpler for you if you do want to spread your database around by hand, > What I should add is that reliability is a premium for us, we do not want to > sacrifice integrity for speed, and that we are tuning for a high commit rate > of small, simple transactions... Make sure the WAL is on fast disks I'd suggest. At a guess that'll be your bottleneck. For more info, your best bet is to check the archives on the plpgsql-performance list, and then post there. People will probably want to know more about your database size/number of concurrent transactions/disk systems etc. HTH -- Richard Huxton Archonet Ltd From pgsql-admin-owner@postgresql.org Mon May 17 20:10:42 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 53DFED1B16B; Mon, 17 May 2004 20:08:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 21408-09; Mon, 17 May 2004 20:08:41 -0300 (ADT) Received: from mailbox.maricopa.gov (mailbox.maricopa.gov [156.42.4.109]) by svr1.postgresql.org (Postfix) with ESMTP id 3ECC3D1C4DB; Mon, 17 May 2004 20:08:37 -0300 (ADT) Received: from maricopa_xcng2.maricopa.gov (maricopa_xcng2.maricopa.gov [156.42.103.174] (may be forged)) by mailbox.maricopa.gov (8.8.6 (PHNE_17190)/8.8.6) with ESMTP id QAA25456; Mon, 17 May 2004 16:02:13 -0700 (MST) Received: by maricopa_xcng2 with Internet Mail Service (5.5.2657.72) id ; Mon, 17 May 2004 16:08:38 -0700 Message-ID: <64EDC403A1417B4299488BAE87CA7CBF01CD0E15@maricopa_xcng0> From: Duane Lee - EGOVX To: "PG General (E-mail)" , "PGADMIN (E-mail)" , "PSQL Performance (E-mail)" Subject: Hardware Platform Date: Mon, 17 May 2004 16:08:34 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C43C63.E0BF5180" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/169 X-Sequence-Number: 13485 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. ------_=_NextPart_001_01C43C63.E0BF5180 Content-Type: text/plain; charset="iso-8859-1" I'm working on a project using PostgreSQL as our database designing a budget system. We are still in the design and testing phases but I thought I would ask advice about a platform to host this system. We aren't a large system, probably no more than 50-75 users at any one time. >From a data standpoint I can't guess at the number of gigabytes but suffice to say it is not going to be that large. Our biggest table will probably hold about 1 million rows and is about 120 bytes (closer to about 100). Dell and HP servers are being mentioned but we currently have no preference. Any help you could provide will be appreciated. Thanks, Duane P.S. I've only just begun using PostgreSQL after having used (and still using) DB2 on a mainframe for the past 14 years. My experience with Unix/Linux is limited to some community college classes I've taken but we do have a couple of experienced Linux sysadmins on our team. I tell you this because my "ignorance" will probably show more than once in my inquiries. ------_=_NextPart_001_01C43C63.E0BF5180 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hardware Platform

I'm working on a project using PostgreSQL as our database= designing a budget system.  We are still in the design and testing ph= ases but I thought I would ask advice about a platform to host this system.=

We aren't a large system, probably no more than 50-75 use= rs at any one time.  From a data standpoint I can't guess at the numbe= r of gigabytes but suffice to say it is not going to be that large.  O= ur biggest table will probably hold about 1 million rows and is about 120 b= ytes (closer to about 100).

Dell and HP servers are being mentioned but we currently = have no preference.

Any help you could provide will be appreciated.

Thanks,
Duane

P.S. I've only just begun using PostgreSQL after having u= sed (and still using) DB2 on a mainframe for the past 14 years.  My ex= perience with Unix/Linux is limited to some community college classes I've = taken but we do have a couple of experienced Linux sysadmins on our team.&n= bsp; I tell you this because my "ignorance" will probably show mo= re than once in my inquiries.

------_=_NextPart_001_01C43C63.E0BF5180-- From pgsql-performance-owner@postgresql.org Tue May 18 09:51:49 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7926CD1B445 for ; Tue, 18 May 2004 09:49:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 83112-08 for ; Tue, 18 May 2004 09:49:15 -0300 (ADT) Received: from web60603.mail.yahoo.com (web60603.mail.yahoo.com [216.109.118.223]) by svr1.postgresql.org (Postfix) with SMTP id EFAA4D1B1C9 for ; Tue, 18 May 2004 09:49:10 -0300 (ADT) Message-ID: <20040518124912.53506.qmail@web60603.mail.yahoo.com> Received: from [200.17.210.82] by web60603.mail.yahoo.com via HTTP; Tue, 18 May 2004 05:49:12 PDT Date: Tue, 18 May 2004 05:49:12 -0700 (PDT) From: Eduardo Almeida Subject: Re: TPCH 100GB - need some help To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <7284.1084636833@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/147 X-Sequence-Number: 6978 Mr. Tom Lane --- Tom Lane wrote: > Eduardo Almeida writes: > > I need some help in a TPCH 100GB benchmark. > > Here I put the query #19, the explain and the > "top" > > for it. > > IIRC, this is one of the cases that inspired the > work that's been done > on the query optimizer for 7.5. I don't think you > will be able to get > 7.4 to generate a good plan for it (at least not > without changing the > query, which is against the TPC rules). How do you > feel about running > CVS tip? We are testing the postgre 7.4.2 to show results to some projects here in Brazil. We are near the deadline for these projects and we need to show results with a stable version. ASAP I want and I will help the PG community testing the CVS with VLDB. > > BTW, are you aware that OSDL has already done a good > deal of work with > running TPC benchmarks for Postgres (and some other > OS databases)? No! Now I'm considering the use of OSDL because of query rewrite. Yesterday the query #19 that I describe runs in the OSDL way. We found some interesting patterns in queries that take to long to finish in the 100 GB test. � Sub-queries inside other sub-queries (Q20 and Q22); � Exists and Not exists selection (Q4, Q21 and Q22); � Aggregations with in-line views, that is queries inside FROM clause (Q7, Q8, Q9 and Q22); In fact these queries were aborted by timeout statement_timeout = 25000000 I took off the timeout to Q20 and it finished in 23:53:49 hs. tks a lot, Eduardo ps. sorry about my english > > regards, tom lane __________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ From pgsql-performance-owner@postgresql.org Tue May 18 15:43:58 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8FD76D1B1C7 for ; Tue, 18 May 2004 15:43:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 33648-05 for ; Tue, 18 May 2004 15:43:31 -0300 (ADT) Received: from neomail.traderonline.com (email.traderonline.com [65.213.231.10]) by svr1.postgresql.org (Postfix) with ESMTP id C4F8DD1B1AB for ; Tue, 18 May 2004 15:43:29 -0300 (ADT) Received: from dyounger-IBM (65-86-118-210.client.dsl.net [65.86.118.210]) by neomail.traderonline.com with ESMTP id i4IIhUB30414 for ; Tue, 18 May 2004 14:43:30 -0400 Message-Id: <6.0.1.1.2.20040518133210.01eb9ec0@mail.traderonline.com> X-Sender: dylists@mail.ptd.net (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.0.1.1 Date: Tue, 18 May 2004 14:12:14 -0400 To: pgsql-performance@postgresql.org From: Doug Y Subject: Interpreting vmstat Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/148 X-Sequence-Number: 6979 Hello, (note best viewed in fixed-width font) I'm still trying to find where my performance bottle neck is... I have 4G ram, PG 7.3.4 shared_buffers = 75000 effective_cache_size = 75000 Run a query I've been having trouble with and watch the output of vmstat (linux): $ vmstat 1 procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 0 0 0 148 8732 193652 2786668 0 0 0 0 292 151 0 2 98 2 0 2 148 7040 193652 2786668 0 0 0 208 459 697 45 10 45 0 0 0 148 9028 193652 2786684 0 0 16 644 318 613 25 4 71 1 0 0 148 5092 193676 2780196 0 0 12 184 441 491 37 5 58 0 1 0 148 5212 193684 2772512 0 0 112 9740 682 1063 45 12 43 1 0 0 148 5444 193684 2771584 0 0 120 4216 464 1303 44 3 52 1 0 0 148 12232 193660 2771620 0 0 244 628 340 681 43 20 38 1 0 0 148 12168 193664 2771832 0 0 196 552 332 956 42 2 56 1 0 0 148 12080 193664 2772248 0 0 272 204 371 201 40 1 59 1 1 0 148 12024 193664 2772624 0 0 368 0 259 127 42 3 55 Thats the first 10 lines or so... the query takes 60 seconds to run. I'm confused on the bo & bi parts of the io: IO bi: Blocks sent to a block device (blocks/s). bo: Blocks received from a block device (blocks/s). yet it seems to be opposite of that... bi only increases when doing a largish query, while bo also goes up, I typically see periodic bo numbers in the low 100's, which I'd guess are log writes. I would think that my entire DB should end up cached since a raw pg_dump file is about 1G in size, yet my performance doesn't indicate that that is the case... running the same query a few minutes later, I'm not seeing a significant performance improvement. Here's a sample from iostat while the query is running: $ iostat -x -d 1 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949552.96 0.00 0.00 100.00 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949662.96 0.00 0.00 100.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949642.96 0.00 0.00 100.00 sdb 0.00 428.00 0.00 116.00 0.00 4368.00 37.66 2844.40 296.55 86.21 100.00 sdb1 0.00 428.00 0.00 116.00 0.00 4368.00 37.66 6874.40 296.55 86.21 100.00 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949552.96 0.00 0.00 100.00 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949662.96 0.00 0.00 100.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949642.96 0.00 0.00 100.00 sdb 4.00 182.00 6.00 77.00 80.00 2072.00 25.93 2814.50 54.22 120.48 100.00 sdb1 4.00 182.00 6.00 77.00 80.00 2072.00 25.93 6844.50 54.22 120.48 100.00 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949552.96 0.00 0.00 100.00 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949662.96 0.00 0.00 100.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949642.96 0.00 0.00 100.00 sdb 0.00 43.00 0.00 11.00 0.00 432.00 39.27 2810.40 36.36 909.09 100.00 sdb1 0.00 43.00 0.00 11.00 0.00 432.00 39.27 6840.40 36.36 909.09 100.00 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 0.00 15.84 0.00 17.82 0.00 269.31 15.11 42524309.47 44.44 561.11 100.00 sda1 0.00 15.84 0.00 17.82 0.00 269.31 15.11 42524419.47 44.44 561.11 100.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42524398.67 0.00 0.00 100.00 sdb 0.99 222.77 0.99 114.85 15.84 2700.99 23.45 2814.16 35.90 86.32 100.00 sdb1 0.99 222.77 0.99 114.85 15.84 2700.99 23.45 6844.16 35.90 86.32 100.00 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949551.76 0.00 0.00 101.00 sda1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949662.86 0.00 0.00 101.00 sda2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 42949642.66 0.00 0.00 101.00 sdb 1.00 91.00 1.00 28.00 16.00 960.00 33.66 2838.40 10.34 348.28 101.00 sdb1 1.00 91.00 1.00 28.00 16.00 960.00 33.66 6908.70 10.34 348.28 101.00 The DB files and logs are on sdb1. Can someone point me in the direction of some documentation on how to interpret these numbers? Also, I've tried to figure out what's getting cached by PostgreSQL by looking at pg_statio_all_tables. What kind of ratio should I be seeing for heap_blks_read / heap_blks_hit ? Thanks. From pgsql-performance-owner@postgresql.org Tue May 18 18:30:36 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DD6CFD1B203 for ; Tue, 18 May 2004 18:30:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02508-03 for ; Tue, 18 May 2004 18:30:14 -0300 (ADT) Received: from web13121.mail.yahoo.com (web13121.mail.yahoo.com [216.136.174.83]) by svr1.postgresql.org (Postfix) with SMTP id 18FF6D1B172 for ; Tue, 18 May 2004 18:30:12 -0300 (ADT) Message-ID: <20040518211321.23032.qmail@web13121.mail.yahoo.com> Received: from [63.78.248.48] by web13121.mail.yahoo.com via HTTP; Tue, 18 May 2004 14:13:21 PDT Date: Tue, 18 May 2004 14:13:21 -0700 (PDT) From: Litao Wu Subject: where to find out when a table was last analyzed? To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/149 X-Sequence-Number: 6980 All, Does PG store when a table was last analyzed? Thanks, __________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ From pgsql-performance-owner@postgresql.org Wed May 19 00:20:30 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4E4D2D1B1AC for ; Wed, 19 May 2004 00:19:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 11661-09 for ; Wed, 19 May 2004 00:19:20 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 8CD56D1B26E for ; Wed, 19 May 2004 00:19:20 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4J3JFSx013558 for ; Wed, 19 May 2004 03:19:15 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4J2pXF9092486 for pgsql-performance@postgresql.org; Wed, 19 May 2004 02:51:33 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Using LIKE expression problem.. Date: Tue, 18 May 2004 22:51:30 -0400 Organization: Hub.Org Networking Services Lines: 63 Message-ID: <40AACBB2.6060001@selectacast.net> References: <40A1D94E.9030605@familyhealth.com.au> <200405120804.i4C84gh9004444@mail.census.gov.ph> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "Michael Ryan S. Puncia" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en In-Reply-To: <200405120804.i4C84gh9004444@mail.census.gov.ph> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/150 X-Sequence-Number: 6981 Use the text_pattern_ops operator when creating the index, see: http://www.postgresql.org/docs/7.4/static/indexes-opclass.html Michael Ryan S. Puncia wrote: > Sorry .. I am a newbie and I don't know :( > How can I know that I am in C locale ? > How can I change my database to use C locale? > > > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Christopher > Kings-Lynne > Sent: Wednesday, May 12, 2004 3:59 PM > To: Michael Ryan S. Puncia > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Using LIKE expression problem.. > > Are you in a non-C locale? > > Chris > > Michael Ryan S. Puncia wrote: > > >>Yes , I already do that but the same result .. LIKE uses seq scan >> >>-----Original Message----- >>From: pgsql-performance-owner@postgresql.org >>[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Christopher >>Kings-Lynne >>Sent: Wednesday, May 12, 2004 2:48 PM >>To: Michael Ryan S. Puncia >>Cc: pgsql-performance@postgresql.org >>Subject: Re: [PERFORM] Using LIKE expression problem.. >> >> >> >>>In the query plan ..it uses seq scan rather than index scan .. why ? I >>>have index on lastname, firtname. >> >> >>Have you run VACUUM ANALYZE; on the table recently? >> >>Chris >> >> >>---------------------------(end of broadcast)--------------------------- >>TIP 7: don't forget to increase your free space map settings >> > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Wed May 19 00:39:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 281A2D1B18A for ; Wed, 19 May 2004 00:38:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17878-05 for ; Wed, 19 May 2004 00:38:26 -0300 (ADT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id D1080D1B188 for ; Wed, 19 May 2004 00:38:24 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.11.3/8.11.3) with ESMTP id i4J3cP408371 for ; Tue, 18 May 2004 21:38:25 -0600 (MDT) Message-ID: <40AAD6B1.2030901@outputservices.com> Date: Tue, 18 May 2004 21:38:25 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Quad processor options Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/151 X-Sequence-Number: 6982 After reading the replies to this, it is clear that this is a Lintel-centric question, but I will throw in my experience. > I am curious if there are any real life production > quad processor setups running postgresql out there. Yes. We are running a 24/7 operation on a quad CPU Sun V880. > Since postgresql lacks a proper replication/cluster > solution, we have to buy a bigger machine. This was a compelling reason for us to stick with SPARC and avoid Intel/AMD when picking a DB server. We moved off of an IBM mainframe in 1993 to Sun gear and never looked back. We can upgrade to our heart's content with minimal disruption and are only on our third box in 11 years with plenty of life left in our current one. > Right now we are running on a dual 2.4 Xeon, 3 GB Ram > and U160 SCSI hardware-raid 10. A couple people mentioned hardware RAID, which I completely agree with. I prefer an external box with a SCSI or FC connector. There are no driver issues that way. We boot from our arrays. The Nexsan ATABoy2 is a nice blend of performance, reliability and cost. Some of these with 1TB and 2TB of space were recently spotted on ebay for under $5k. We run a VERY random i/o mix on ours and it will consistently sustain 15 MB/s in blended read and write i/o, sustaining well over 1200 io/s. These are IDE drives, so they fail more often than SCSI, so run RAID1 or RAID5. The cache on these pretty much eliminates the RAID5 penalties. > The 30k+ setups from Dell etc. don't fit our budget. For that kind of money you could get a lower end Sun box (or IBM RS/6000 I would imagine) and give yourself an astounding amount of headroom for future growth. Sincerely, Marty From pgsql-performance-owner@postgresql.org Fri May 28 20:57:07 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 35E77D1B28B for ; Sat, 22 May 2004 01:59:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71488-05 for ; Sat, 22 May 2004 01:59:38 -0300 (ADT) Received: from p0.pureserver.info (ami.ga [217.160.111.113]) by svr1.postgresql.org (Postfix) with SMTP id 1FC5CD1B176 for ; Sat, 22 May 2004 01:59:20 -0300 (ADT) Received: (qmail 26116 invoked by uid 703); 19 May 2004 07:32:39 -0000 Date: Wed, 19 May 2004 09:32:39 +0200 From: share-postgres@think42.com To: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: filesystem option tuning Message-ID: <20040519093239.A26016@p15097255.pureserver.info> References: <20040515125227.A29574@p15097255.pureserver.info> <40A8F0B6.6060703@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.16i In-Reply-To: <40A8F0B6.6060703@archonet.com>; from dev@archonet.com on Mon, May 17, 2004 at 06:04:54PM +0100 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200405/223 X-Sequence-Number: 7054 Hi! On Mon, May 17, 2004 at 06:04:54PM +0100, Richard Huxton wrote: > share-postgres@think42.com wrote: > > [...] > > In no official capacity whatsoever, welcome aboard. Thanks ;-) > > There is just one point where I found the documentation lacking any > > description and practical hints (as opposed to all other topics), namely > > that of how to tune a setup for maximum performance regarding the layout of > > partitions on hard-disks and their mount options. > > I'm not a Sun user, so I can't give any OS-specific notes, but in general: > - Don't bypass the filesystem, but feel free to tinker with mount > options if you think it will help Right, raw partitions are too low-level for me these days anyhow... I assume that all postgres partitions can be mounted with noatime? > - If you can put WAL on separate disk(s), all the better. Does that mean only the xlog, or also the clog? As far as I understand, the clog contains some meta-information on the xlog, so presumably it is flushed to disc synchronously together with the xlog? That would mean that they each need a separate disk to prevent one disk having to seek too often...? > - Battery-backed write-cache for your SCSI controller can be a big > performance win I probably won't be able to get such a setup for this project; that's why I am bothering about which disk will be seeking how often. > - Tablespaces _should_ be available in the next release of PG, we'll > know for sure soon. That might make life simpler for you if you do want > to spread your database around by hand, Ok, I think tablespaces are not the important thing - at least for this project of ours. > > What I should add is that reliability is a premium for us, we do not want to > > sacrifice integrity for speed, and that we are tuning for a high commit rate > > of small, simple transactions... > > Make sure the WAL is on fast disks I'd suggest. At a guess that'll be > your bottleneck. > > For more info, your best bet is to check the archives on the > plpgsql-performance list, and then post there. People will probably want > to know more about your database size/number of concurrent > transactions/disk systems etc. Here goes ... we are talking about a database cluster with two tables where things are happening, one is a kind of log that is simply "appended" to and will expect to reach a size of several million entries in the time window that is kept, the other is a persistent backing of application data that will mostly see read-modify-writes of single records. Two writers to the history, one writer to the data table. The volume of data is not very high and RAM is enough... If any more information is required feel free to ask - I would really appreciate getting this disk layout sorted out. Thanks, Colin From pgsql-performance-owner@postgresql.org Wed May 19 04:31:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id F3FADD1B25D for ; Wed, 19 May 2004 04:31:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 86904-02 for ; Wed, 19 May 2004 04:30:58 -0300 (ADT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id BC16FD1B169 for ; Wed, 19 May 2004 04:29:09 -0300 (ADT) Received: from notnot (gateway.census.gov.ph [203.172.28.97]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id i4J7NuPW030497 for ; Wed, 19 May 2004 15:24:08 +0800 Message-Id: <200405190724.i4J7NuPW030497@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: Subject: DB Design Date: Wed, 19 May 2004 15:37:06 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C43DB7.27CE7D90" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcQ9dBU80Ee6Yl+5QvuoK9YDPdPbtg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/152 X-Sequence-Number: 6983 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C43DB7.27CE7D90 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Guys, My question is .. which is better design 1. Single Table with 50 million records or 2. Multiple Table using inheritance to the parents table I will use this only for query purpose .. Thanks .. ------=_NextPart_000_0000_01C43DB7.27CE7D90 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Guys,

  

      My question is .. which i= s better design

 

  1. Single Table with 50 mill= ion records or
  2. Multiple Table using inheritance to the parents table

 

 

I will use this only for query purpose ..

 

Thanks ..

 

 

------=_NextPart_000_0000_01C43DB7.27CE7D90-- From pgsql-performance-owner@postgresql.org Wed May 19 08:22:33 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CEC34D1B1DA for ; Wed, 19 May 2004 08:22:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 65922-03 for ; Wed, 19 May 2004 08:22:10 -0300 (ADT) Received: from lamb.mcmillan.net.nz (218-101-14-65.paradise.net.nz [218.101.14.65]) by svr1.postgresql.org (Postfix) with ESMTP id 2D56CD1B1C7 for ; Wed, 19 May 2004 08:22:03 -0300 (ADT) Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) by lamb.mcmillan.net.nz (Postfix) with ESMTP id AB527AD98585; Wed, 19 May 2004 23:21:22 +1200 (NZST) Subject: Re: DB Design From: Andrew McMillan To: "Michael Ryan S. Puncia" Cc: pgsql-performance@postgresql.org In-Reply-To: <200405190724.i4J7NuPW030497@mail.census.gov.ph> References: <200405190724.i4J7NuPW030497@mail.census.gov.ph> Content-Type: text/plain Message-Id: <1084965682.10589.52.camel@lamb.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.7 Date: Wed, 19 May 2004 23:21:22 +1200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/153 X-Sequence-Number: 6984 On Wed, 2004-05-19 at 15:37 +0800, Michael Ryan S. Puncia wrote: > Hi Guys, > > > > My question is .. which is better design > > > > 1. Single Table with 50 million records or > 2. Multiple Table using inheritance to the parents table It's not that simple. Given your e-mail address I assume you want to store Philippines Census data in such a table, but does Census data fit well in a single flat table structure? Not from what I have seen here in NZ, but perhaps Census is simpler there. So to know what the best answer to that question is, people here will surely need more and better information from you about database schema, record size, indexing and query characteristics, and so on. > I will use this only for query purpose .. Then you may quite possibly want to consider a different database. Particularly if it is single-user query purposes. For example, there are some SQL databases that would load the entire database into RAM from static files, and then allow query against this. This can obviously give huge performance improvements in situations where volatility is not a problem. Cheers, Andrew. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267 Do not overtax your powers. ------------------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Wed May 19 16:51:02 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7E13AD1B34A for ; Wed, 19 May 2004 16:49:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 74503-08 for ; Wed, 19 May 2004 16:49:24 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 6FD2BD1B23C for ; Wed, 19 May 2004 16:49:22 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4JJnLSx091770 for ; Wed, 19 May 2004 19:49:21 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4JJQT1Y087919 for pgsql-performance@postgresql.org; Wed, 19 May 2004 19:26:29 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: shared buffer size on linux Date: Wed, 19 May 2004 15:26:31 -0400 Organization: Hub.Org Networking Services Lines: 3 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/154 X-Sequence-Number: 6985 See http://kerneltrap.org/node/view/3148, about 40% down, under the header "2.6 -aa patchset, object-based reverse mapping". Does this mean that the more shared memory the bigger the potential for a swap storm? From pgsql-performance-owner@postgresql.org Wed May 19 17:07:26 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0B893D1B21B for ; Wed, 19 May 2004 17:07:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 82075-08 for ; Wed, 19 May 2004 17:07:06 -0300 (ADT) Received: from mx1.mail.ru (mx1.mail.ru [194.67.23.121]) by svr1.postgresql.org (Postfix) with ESMTP id 54DE8D1B1CD for ; Wed, 19 May 2004 17:07:04 -0300 (ADT) Received: from [195.225.128.14] (port=4950 helo=localhost) by mx1.mail.ru with esmtp id 1BQXLF-00026n-00 for pgsql-performance@postgresql.org; Thu, 20 May 2004 00:07:05 +0400 Date: Thu, 20 May 2004 00:07:57 +0400 From: Eugeny Balakhonov Reply-To: Eugeny Balakhonov X-Priority: 3 (Normal) Message-ID: <1117434122.20040520000757@mail.ru> To: pgsql-performance@postgresql.org Subject: PostgreSQL performance in simple queries MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: Not detected X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.0 tagged_above=0.0 required=5.0 tests=FROM_ENDS_IN_NUMS, FROM_HAS_MIXED_NUMS, PRIORITY_NO_NAME X-Spam-Level: ** X-Archive-Number: 200405/155 X-Sequence-Number: 6986 Hello for all! I have PostgreSQL 7.4 under last version of Cygwin and have some problems with performance :( It is very strange... I don't remember this problem on previous version Cygwin and PostgreSQL 7.3 I have only two simple tables: CREATE TABLE public.files_t ( id int8 NOT NULL, parent int8, size int8 NOT NULL, dir bool NOT NULL DEFAULT false, ctime timestamp NOT NULL, ftime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, name text NOT NULL, access varchar(10) NOT NULL, host int4 NOT NULL, uname text NOT NULL, CONSTRAINT pk_files_k PRIMARY KEY (id), CONSTRAINT fk_files_k FOREIGN KEY (parent) REFERENCES public.files_t (id) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT fk_hosts_k FOREIGN KEY (host) REFERENCES public.hosts_t (id) ON UPDATE CASCADE ON DELETE CASCADE ) WITH OIDS; and CREATE TABLE public.hosts_t ( id int4 NOT NULL, ftime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, utime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, name text NOT NULL, address inet NOT NULL, CONSTRAINT pk_hosts_k PRIMARY KEY (id) ) WITH OIDS; Table files_t has 249259 records and table hosts_t has only 59 records. I tries to run simple query: select * from files_t where parent = 3333 This query works 0.256 seconds! It is very big time for this small table! I have index for field "parent": CREATE INDEX files_parent_idx ON public.files_t USING btree (parent); But if I tries to see query plan then I see following text: Seq Scan on files_t (cost=0.00..6103.89 rows=54 width=102) Filter: (parent = 3333) PostgreSQL do not uses index files_parent_idx! I have enabled all options of "QUERY TUNING" in postgresql.conf, I have increased memory sizes for PostgreSQL: shared_buffers = 2000 # min 16, at least max_connections*2, 8KB each sort_mem = 32768 # min 64, size in KB vacuum_mem = 65536 # min 1024, size in KB fsync = false # turns forced synchronization on or off checkpoint_segments = 3 # in logfile segments, min 1, 16MB each enable_hashagg = true enable_hashjoin = true enable_indexscan = true enable_mergejoin = true enable_nestloop = true enable_seqscan = true enable_sort = true enable_tidscan = true geqo = true geqo_threshold = 22 geqo_effort = 1 geqo_generations = 0 geqo_pool_size = 0 # default based on tables in statement, # range 128-1024 geqo_selection_bias = 2.0 # range 1.5-2.0 stats_start_collector = true stats_command_string = true stats_block_level = true stats_row_level = true stats_reset_on_server_start = false Please help me! My database has a very small size (only 249259 records) but it works very slowly :( Best regards Eugeny From pgsql-performance-owner@postgresql.org Wed May 19 17:23:59 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 42218D1B3C6 for ; Wed, 19 May 2004 17:23:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95214-01 for ; Wed, 19 May 2004 17:23:37 -0300 (ADT) Received: from gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id E607DD1B18E for ; Wed, 19 May 2004 17:23:33 -0300 (ADT) Received: from gary (unverified [192.168.1.2]) by gpdnet.co.uk (SurgeMail 1.8g3) with ESMTP id 220 for ; Wed, 19 May 2004 21:15:59 +0100 From: "Gary Doades" To: pgsql-performance@postgresql.org Date: Wed, 19 May 2004 21:23:47 +0100 MIME-Version: 1.0 Subject: Re: PostgreSQL performance in simple queries Message-ID: <40ABD063.5457.AA3927B@localhost> In-reply-to: <1117434122.20040520000757@mail.ru> X-mailer: Pegasus Mail for Windows (v4.12a) Content-type: Multipart/Alternative; boundary="Alt-Boundary-1301.178492027" X-Server: High Performance Mail Server - http://surgemail.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=HTML_60_70, HTML_FONTCOLOR_RED, HTML_FONTCOLOR_UNSAFE, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200405/156 X-Sequence-Number: 6987 --Alt-Boundary-1301.178492027 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Try using select * from files_t where parent = 3333::int8 You have declared parent as int8, but the query will assume int4 for "3333" and may not use the index. Also make sure you have ANALYZEd this table. Regards, Gary. On 20 May 2004 at 0:07, Eugeny Balakhonov wrote: > Hello for all! > > I have PostgreSQL 7.4 under last version of Cygwin and have some > problems with performance :( It is very strange... I don't remember > this problem on previous version Cygwin and PostgreSQL 7.3 > > I have only two simple tables: > > CREATE TABLE public.files_t > ( > id int8 NOT NULL, > parent int8, > size int8 NOT NULL, > dir bool NOT NULL DEFAULT false, > ctime timestamp NOT NULL, > ftime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, > name text NOT NULL, > access varchar(10) NOT NULL, > host int4 NOT NULL, > uname text NOT NULL, > CONSTRAINT pk_files_k PRIMARY KEY (id), > CONSTRAINT fk_files_k FOREIGN KEY (parent) REFERENCES public.files_t (id) ON UPDATE CASCADE ON DELETE CASCADE, > CONSTRAINT fk_hosts_k FOREIGN KEY (host) REFERENCES public.hosts_t (id) ON UPDATE CASCADE ON DELETE CASCADE > ) WITH OIDS; > > and > > CREATE TABLE public.hosts_t > ( > id int4 NOT NULL, > ftime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, > utime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone, > name text NOT NULL, > address inet NOT NULL, > CONSTRAINT pk_hosts_k PRIMARY KEY (id) > ) WITH OIDS; > > Table files_t has 249259 records and table hosts_t has only 59 records. > > I tries to run simple query: > > select * from files_t where parent = 3333 > > This query works 0.256 seconds! It is very big time for this small > table! > I have index for field "parent": > > CREATE INDEX files_parent_idx > ON public.files_t > USING btree > (parent); > > But if I tries to see query plan then I see following text: > > Seq Scan on files_t (cost=0.00..6103.89 rows=54 width=102) > Filter: (parent = 3333) > > PostgreSQL do not uses index files_parent_idx! > > I have enabled all options of "QUERY TUNING" in postgresql.conf, I > have increased memory sizes for PostgreSQL: > > shared_buffers = 2000 # min 16, at least max_connections*2, 8KB each > sort_mem = 32768 # min 64, size in KB > vacuum_mem = 65536 # min 1024, size in KB > fsync = false # turns forced synchronization on or off > checkpoint_segments = 3 # in logfile segments, min 1, 16MB each > enable_hashagg = true > enable_hashjoin = true > enable_indexscan = true > enable_mergejoin = true > enable_nestloop = true > enable_seqscan = true > enable_sort = true > enable_tidscan = true > geqo = true > geqo_threshold = 22 > geqo_effort = 1 > geqo_generations = 0 > geqo_pool_size = 0 # default based on tables in statement, > # range 128-1024 > geqo_selection_bias = 2.0 # range 1.5-2.0 > stats_start_collector = true > stats_command_string = true > stats_block_level = true > stats_row_level = true > stats_reset_on_server_start = false > > > Please help me! > My database has a very small size (only 249259 records) but it works > very slowly :( > > Best regards > Eugeny > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: 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 --Alt-Boundary-1301.178492027 Content-type: text/html; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body
Try using

select * from files_t where parent = 3333::int8

You have declared parent as int8, but the query will assume int4 for "3333" and may not use the index.

Also make sure you have ANALYZEd this table.

Regards,
Gary.

On 20 May 2004 at 0:07, Eugeny Balakhonov wrote:

> Hello for all!
>
> I have PostgreSQL 7.4 under last version of Cygwin and have some
> problems with performance :( It is very strange...  I don't remember
> this problem on previous version Cygwin and PostgreSQL 7.3
>
> I have only two simple tables:
>
> CREATE TABLE public.files_t
> (
>   id int8 NOT NULL,
>   parent int8,
>   size int8 NOT NULL,
>   dir bool NOT NULL DEFAULT false,
>   ctime timestamp NOT NULL,
>   ftime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone,
>   name text NOT NULL,
>   access varchar(10) NOT NULL,
>   host int4 NOT NULL,
>   uname text NOT NULL,
>   CONSTRAINT pk_files_k PRIMARY KEY (id),
>   CONSTRAINT fk_files_k FOREIGN KEY (parent) REFERENCES public.files_t (id) ON UPDATE CASCADE ON DELETE CASCADE,
>   CONSTRAINT fk_hosts_k FOREIGN KEY (host) REFERENCES public.hosts_t (id) ON UPDATE CASCADE ON DELETE CASCADE
> ) WITH OIDS;
>
> and
>
> CREATE TABLE public.hosts_t
> (
>   id int4 NOT NULL,
>   ftime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone,
>   utime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone,
>   name text NOT NULL,
>   address inet NOT NULL,
>   CONSTRAINT pk_hosts_k PRIMARY KEY (id)
> ) WITH OIDS;
>
> Table files_t has 249259 records and table hosts_t has only 59 records.
>
> I tries to run simple query:
>
> select * from files_t where parent = 3333
>
> This query works 0.256 seconds! It is very big time for this small
> table!
> I have index for field "parent":
>
> CREATE INDEX files_parent_idx
>   ON public.files_t
>   USING btree
>   (parent);
>
> But if I tries to see query plan then I see following text:
>
> Seq Scan on files_t (cost=0.00..6103.89 rows=54 width=102)
>  Filter: (parent = 3333)
>
> PostgreSQL do not uses index files_parent_idx!
>
> I have enabled all options of "QUERY TUNING" in postgresql.conf, I
> have increased memory sizes for PostgreSQL:
>
> shared_buffers = 2000           # min 16, at least max_connections*2, 8KB each
> sort_mem = 32768                # min 64, size in KB
> vacuum_mem = 65536              # min 1024, size in KB
> fsync = false                   # turns forced synchronization on or off
> checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
> enable_hashagg = true
> enable_hashjoin = true
> enable_indexscan = true
> enable_mergejoin = true
> enable_nestloop = true
> enable_seqscan = true
> enable_sort = true
> enable_tidscan = true
> geqo = true
> geqo_threshold = 22
> geqo_effort = 1
> geqo_generations = 0
> geqo_pool_size = 0              # default based on tables in statement,
>                                 # range 128-1024
> geqo_selection_bias = 2.0       # range 1.5-2.0
> stats_start_collector = true
> stats_command_string = true
> stats_block_level = true
> stats_row_level = true
> stats_reset_on_server_start = false
>
>
> Please help me!
> My database has a very small size (only 249259 records) but it works
> very slowly :(
>
> Best regards
> Eugeny
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: 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

--Alt-Boundary-1301.178492027-- From pgsql-performance-owner@postgresql.org Wed May 19 18:51:22 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EF215D1B18A for ; Wed, 19 May 2004 18:51:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 24441-06 for ; Wed, 19 May 2004 18:51:02 -0300 (ADT) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id A9D4BD1B34A for ; Wed, 19 May 2004 18:50:59 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with ESMTP id 33BEA1FE1; Wed, 19 May 2004 17:51:01 -0400 (EDT) Received: from bob.samurai.com ([127.0.0.1]) by localhost (bob.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 91247-01-5; Wed, 19 May 2004 17:51:00 -0400 (EDT) Received: from [24.156.130.254] (CPE000a95ab279e-CM014470008056.cpe.net.cable.rogers.com [24.156.130.254]) by bob.samurai.com (Postfix) with ESMTP id 5A30F1FD0; Wed, 19 May 2004 17:51:00 -0400 (EDT) Message-ID: <40ABD6CC.3070206@samurai.com> Date: Wed, 19 May 2004 17:51:08 -0400 From: Neil Conway User-Agent: Mozilla Thunderbird 0.6 (Macintosh/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Eugeny Balakhonov Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance in simple queries References: <1117434122.20040520000757@mail.ru> In-Reply-To: <1117434122.20040520000757@mail.ru> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/157 X-Sequence-Number: 6988 Eugeny Balakhonov wrote: > I tries to run simple query: > > select * from files_t where parent = 3333 Use this instead: select * from files_t where parent = '3333'; ("parent = 3333::int8" would work as well.) PostgreSQL (< 7.5) won't consider using an indexscan when the predicate involves an integer literal and the column datatype is int2 or int8. -Neil From pgsql-performance-owner@postgresql.org Wed May 19 22:22:15 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 07172D1B17B for ; Wed, 19 May 2004 22:21:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 01541-06 for ; Wed, 19 May 2004 22:21:24 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 9D5E8D1B188 for ; Wed, 19 May 2004 22:21:19 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4K1KKm06350; Wed, 19 May 2004 21:20:20 -0400 (EDT) From: Bruce Momjian Message-Id: <200405200120.i4K1KKm06350@candle.pha.pa.us> Subject: Re: Wierd context-switching issue on Xeon In-Reply-To: <1083512362.25096.131.camel@localhost.localdomain> To: pg@fastcrypt.com Date: Wed, 19 May 2004 21:20:20 -0400 (EDT) Cc: Robert Creager , Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/158 X-Sequence-Number: 6989 Did we ever come to a conclusion about excessive SMP context switching under load? --------------------------------------------------------------------------- Dave Cramer wrote: > Robert, > > The real question is does it help under real life circumstances ? > > Did you do the tests with Tom's sql code that is designed to create high > context switchs ? > > Dave > On Sun, 2004-05-02 at 11:20, Robert Creager wrote: > > Found some co-workers at work yesterday to load up my library... > > > > The sample period is 5 minutes long (vs 2 minutes previously): > > > > Context switches - avg max > > > > Default 7.4.1 code : 48784 107354 > > Default patch - 10 : 20400 28160 > > patch at 100 : 38574 85372 > > patch at 1000 : 41188 106569 > > > > The reading at 1000 was not produced under the same circumstances as the prior > > readings as I had to replace my device under test with a simulated one. The > > real one died. > > > > The previous run with smaller database and 120 second averages: > > > > Context switches - avg max > > > > Default 7.4.1 code : 10665 69470 > > Default patch - 10 : 17297 21929 > > patch at 100 : 26825 87073 > > patch at 1000 : 37580 110849 > -- > Dave Cramer > 519 939 0336 > ICQ # 14675561 > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- 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 May 19 23:00:51 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8A8E8D1B34F for ; Wed, 19 May 2004 23:00:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 18002-03 for ; Wed, 19 May 2004 23:00:13 -0300 (ADT) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id F1EC8D1B1BD for ; Wed, 19 May 2004 23:00:08 -0300 (ADT) Received: (qmail 21165 invoked by uid 104); 20 May 2004 02:00:12 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.65. spamassassin: 2.55. Clear:SA:0(-7.7/6.0):. Processed in 33.358499 secs); 20 May 2004 02:00:12 -0000 Received: from unknown (HELO thunder.mshome.net) (216.58.165.126) by srvr3.iniquinet.com with SMTP; 20 May 2004 01:59:38 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with ESMTP id 071CC705C8; Wed, 19 May 2004 19:59:38 -0600 (MDT) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with SMTP id 53DC3701EA; Wed, 19 May 2004 19:59:34 -0600 (MDT) Date: Wed, 19 May 2004 19:59:26 -0600 From: Robert Creager To: Bruce Momjian Cc: pg@fastcrypt.com, Josh Berkus , =?ISO-8859-1?Q?Dirk?= =?ISO-8859-1?Q?=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon Message-Id: <20040519195926.3c5fa3bc@thunder.mshome.net> In-Reply-To: <200405200120.i4K1KKm06350@candle.pha.pa.us> References: <1083512362.25096.131.camel@localhost.localdomain> <200405200120.i4K1KKm06350@candle.pha.pa.us> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Wed__19_May_2004_19_59_26_-0600_qr.ctZpT0duCxZPR" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/159 X-Sequence-Number: 6990 --Signature=_Wed__19_May_2004_19_59_26_-0600_qr.ctZpT0duCxZPR Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit When grilled further on (Wed, 19 May 2004 21:20:20 -0400 (EDT)), Bruce Momjian confessed: > > Did we ever come to a conclusion about excessive SMP context switching > under load? > I just figured out what was causing the problem on my system Monday. I'm using the pg_autovacuum daemon, and it was not vacuuming my db. I've no idea why and didn't get a chance to investigate. This lack of vacuuming was causing a huge number of context switches and query delays. the queries that normally take .1 seconds were taking 11 seconds, and the context switches were averaging 160k/s, peaking at 190k/s Unfortunately, I was under pressure to fix the db at the time so I didn't get a chance to play with the patch. I restarted the vacuum daemon, and will keep an eye on it to see if it behaves. If the problem re-occurs, is it worth while to attempt the different patch delay settings? Cheers, Rob -- 19:45:40 up 21 days, 2:30, 4 users, load average: 2.03, 2.09, 2.06 Linux 2.6.5-01 #7 SMP Fri Apr 16 22:45:31 MDT 2004 --Signature=_Wed__19_May_2004_19_59_26_-0600_qr.ctZpT0duCxZPR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iEYEARECAAYFAkCsEQYACgkQLQ/DKuwDYzkKFACfRyQ1FLQ9o1u9gX+4OBXdGtqn UhUAoIJ3vfYVjNU0bm6xGNycKOobtIX6 =WXZG -----END PGP SIGNATURE----- --Signature=_Wed__19_May_2004_19_59_26_-0600_qr.ctZpT0duCxZPR-- From pgsql-performance-owner@postgresql.org Wed May 19 23:42:51 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D5746D1B1CF for ; Wed, 19 May 2004 23:42:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 23466-08 for ; Wed, 19 May 2004 23:42:21 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5433ED1B1B3 for ; Wed, 19 May 2004 23:42:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4K2fQ47024374; Wed, 19 May 2004 22:41:26 -0400 (EDT) To: Bruce Momjian Cc: pg@fastcrypt.com, Robert Creager , Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon In-reply-to: <200405200120.i4K1KKm06350@candle.pha.pa.us> References: <200405200120.i4K1KKm06350@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Wed, 19 May 2004 21:20:20 -0400" Date: Wed, 19 May 2004 22:41:26 -0400 Message-ID: <24373.1085020886@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/160 X-Sequence-Number: 6991 Bruce Momjian writes: > Did we ever come to a conclusion about excessive SMP context switching > under load? Yeah: it's bad. Oh, you wanted a fix? That seems harder :-(. AFAICS we need a redesign that causes less load on the BufMgrLock. However, the traditional solution to too-much-contention-for-a-lock is to break up the locked data structure into finer-grained units, which means *more* lock operations in total. Normally you expect that the finer-grained lock units will mean less contention. But given that the issue here seems to be trading physical ownership of the lock's cache line back and forth, I'm afraid that the traditional approach would actually make things worse. The SMP issue seems to be not with whether there is instantaneous contention for the locked datastructure, but with the cost of making it possible for processor B to acquire a lock recently held by processor A. regards, tom lane From pgsql-performance-owner@postgresql.org Wed May 19 23:44:02 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D06B3D1B1CF for ; Wed, 19 May 2004 23:43:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 27138-03 for ; Wed, 19 May 2004 23:43:06 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3666DD1B1B3 for ; Wed, 19 May 2004 23:43:02 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4K2gQq8024406; Wed, 19 May 2004 22:42:26 -0400 (EDT) To: Robert Creager Cc: Bruce Momjian , pg@fastcrypt.com, Josh Berkus , =?ISO-8859-1?Q?Dirk?= =?ISO-8859-1?Q?=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon In-reply-to: <20040519195926.3c5fa3bc@thunder.mshome.net> References: <1083512362.25096.131.camel@localhost.localdomain> <200405200120.i4K1KKm06350@candle.pha.pa.us> <20040519195926.3c5fa3bc@thunder.mshome.net> Comments: In-reply-to Robert Creager message dated "Wed, 19 May 2004 19:59:26 -0600" Date: Wed, 19 May 2004 22:42:26 -0400 Message-ID: <24405.1085020946@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/161 X-Sequence-Number: 6992 Robert Creager writes: > I just figured out what was causing the problem on my system Monday. > I'm using the pg_autovacuum daemon, and it was not vacuuming my db. Do you have the post-7.4.2 datatype fixes for pg_autovacuum? regards, tom lane From pgsql-performance-owner@postgresql.org Thu May 20 00:07:05 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A8419D1B524 for ; Thu, 20 May 2004 00:00:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 34485-03 for ; Thu, 20 May 2004 00:00:18 -0300 (ADT) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id 7796AD1B25F for ; Thu, 20 May 2004 00:00:17 -0300 (ADT) Received: (qmail 8153 invoked by uid 104); 20 May 2004 03:00:16 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.65. spamassassin: 2.55. Clear:SA:0(-7.8/6.0):. Processed in 34.177073 secs); 20 May 2004 03:00:16 -0000 Received: from unknown (HELO thunder.mshome.net) (216.58.165.126) by srvr3.iniquinet.com with SMTP; 20 May 2004 02:59:41 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with ESMTP id 078DB2DFD8; Wed, 19 May 2004 20:59:28 -0600 (MDT) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by thunder.mshome.net (Postfix) with SMTP id 341A42DFD8; Wed, 19 May 2004 20:59:23 -0600 (MDT) Date: Wed, 19 May 2004 20:59:21 -0600 From: Robert Creager To: Tom Lane Cc: Bruce Momjian , pg@fastcrypt.com, Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon Message-Id: <20040519205921.46510067@thunder.mshome.net> In-Reply-To: <24405.1085020946@sss.pgh.pa.us> References: <1083512362.25096.131.camel@localhost.localdomain> <200405200120.i4K1KKm06350@candle.pha.pa.us> <20040519195926.3c5fa3bc@thunder.mshome.net> <24405.1085020946@sss.pgh.pa.us> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.10claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Wed__19_May_2004_20_59_21_-0600_w/th.GtNChfsNfUS" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/163 X-Sequence-Number: 6994 --Signature=_Wed__19_May_2004_20_59_21_-0600_w/th.GtNChfsNfUS Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit When grilled further on (Wed, 19 May 2004 22:42:26 -0400), Tom Lane confessed: > Robert Creager writes: > > I just figured out what was causing the problem on my system Monday. > > I'm using the pg_autovacuum daemon, and it was not vacuuming my db. > > Do you have the post-7.4.2 datatype fixes for pg_autovacuum? No. I'm still running 7.4.1 w/associated contrib. I guess an upgrade is in order then. I'm currently downloading 7.4.2 to see what the change is that I need. Is it just the 7.4.2 pg_autovacuum that is needed here? I've caught a whiff that 7.4.3 is nearing release? Any idea when? Thanks, Rob -- 20:45:52 up 21 days, 3:30, 4 users, load average: 2.02, 2.05, 2.05 Linux 2.6.5-01 #7 SMP Fri Apr 16 22:45:31 MDT 2004 --Signature=_Wed__19_May_2004_20_59_21_-0600_w/th.GtNChfsNfUS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iEYEARECAAYFAkCsHwkACgkQLQ/DKuwDYzlt0QCcDihJQm/zXQUy4KpBUIICEmHl uRkAnRrIYj/zW20IW3BBWYM6V61uJCl0 =J81W -----END PGP SIGNATURE----- --Signature=_Wed__19_May_2004_20_59_21_-0600_w/th.GtNChfsNfUS-- From pgsql-performance-owner@postgresql.org Thu May 20 00:05:29 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2C36CD1B1BD for ; Thu, 20 May 2004 00:03:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 29842-10 for ; Thu, 20 May 2004 00:03:13 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id F0713D1B1C7 for ; Thu, 20 May 2004 00:03:08 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4K32G721749; Wed, 19 May 2004 23:02:16 -0400 (EDT) From: Bruce Momjian Message-Id: <200405200302.i4K32G721749@candle.pha.pa.us> Subject: Re: Wierd context-switching issue on Xeon In-Reply-To: <24373.1085020886@sss.pgh.pa.us> To: Tom Lane Date: Wed, 19 May 2004 23:02:16 -0400 (EDT) Cc: pg@fastcrypt.com, Robert Creager , Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/162 X-Sequence-Number: 6993 Tom Lane wrote: > Bruce Momjian writes: > > Did we ever come to a conclusion about excessive SMP context switching > > under load? > > Yeah: it's bad. > > Oh, you wanted a fix? That seems harder :-(. AFAICS we need a redesign > that causes less load on the BufMgrLock. However, the traditional > solution to too-much-contention-for-a-lock is to break up the locked > data structure into finer-grained units, which means *more* lock > operations in total. Normally you expect that the finer-grained lock > units will mean less contention. But given that the issue here seems to > be trading physical ownership of the lock's cache line back and forth, > I'm afraid that the traditional approach would actually make things > worse. The SMP issue seems to be not with whether there is > instantaneous contention for the locked datastructure, but with the cost > of making it possible for processor B to acquire a lock recently held by > processor A. I see. I don't even see a TODO in there. :-( -- 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 Thu May 20 01:01:01 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BC240D1B4A8 for ; Thu, 20 May 2004 01:00:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 47644-09 for ; Thu, 20 May 2004 00:59:46 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B3257D1CB08 for ; Thu, 20 May 2004 00:59:45 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4K3wujN025438; Wed, 19 May 2004 23:58:56 -0400 (EDT) To: Bruce Momjian Cc: pg@fastcrypt.com, Robert Creager , Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon In-reply-to: <200405200302.i4K32G721749@candle.pha.pa.us> References: <200405200302.i4K32G721749@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Wed, 19 May 2004 23:02:16 -0400" Date: Wed, 19 May 2004 23:58:56 -0400 Message-ID: <25437.1085025536@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/164 X-Sequence-Number: 6995 Bruce Momjian writes: > Tom Lane wrote: >> ... The SMP issue seems to be not with whether there is >> instantaneous contention for the locked datastructure, but with the cost >> of making it possible for processor B to acquire a lock recently held by >> processor A. > I see. I don't even see a TODO in there. :-( Nothing more specific than "investigate SMP context switching issues", anyway. We are definitely in a research mode here, rather than an engineering mode. ObQuote: "Research is what I am doing when I don't know what I am doing." - attributed to Werner von Braun, but has anyone got a definitive reference? regards, tom lane From pgsql-performance-owner@postgresql.org Thu May 20 01:05:39 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 203F0D1CB08 for ; Thu, 20 May 2004 01:03:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51017-06 for ; Thu, 20 May 2004 01:03:25 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8B98CD1D74B for ; Thu, 20 May 2004 01:03:24 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4K42fRs025481; Thu, 20 May 2004 00:02:41 -0400 (EDT) To: Robert Creager Cc: Bruce Momjian , pg@fastcrypt.com, Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon In-reply-to: <20040519205921.46510067@thunder.mshome.net> References: <1083512362.25096.131.camel@localhost.localdomain> <200405200120.i4K1KKm06350@candle.pha.pa.us> <20040519195926.3c5fa3bc@thunder.mshome.net> <24405.1085020946@sss.pgh.pa.us> <20040519205921.46510067@thunder.mshome.net> Comments: In-reply-to Robert Creager message dated "Wed, 19 May 2004 20:59:21 -0600" Date: Thu, 20 May 2004 00:02:41 -0400 Message-ID: <25480.1085025761@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/165 X-Sequence-Number: 6996 Robert Creager writes: > Tom Lane confessed: >> Do you have the post-7.4.2 datatype fixes for pg_autovacuum? > No. I'm still running 7.4.1 w/associated contrib. I guess an upgrade is in > order then. I'm currently downloading 7.4.2 to see what the change is that I > need. Is it just the 7.4.2 pg_autovacuum that is needed here? Nope, the fixes I was thinking about just missed the 7.4.2 release. I think you can only get them from CVS. (Maybe we should offer a nightly build of the latest stable release branch, not only development tip...) > I've caught a whiff that 7.4.3 is nearing release? Any idea when? Not scheduled yet, but there was talk of pushing one out before 7.5 goes into feature freeze. regards, tom lane From pgsql-performance-owner@postgresql.org Thu May 20 01:12:54 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 09215D1B172 for ; Thu, 20 May 2004 01:12:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51599-10 for ; Thu, 20 May 2004 01:12:23 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id E4FCDD1DDF3 for ; Thu, 20 May 2004 01:11:56 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4K4B5F03803; Thu, 20 May 2004 00:11:05 -0400 (EDT) From: Bruce Momjian Message-Id: <200405200411.i4K4B5F03803@candle.pha.pa.us> Subject: Re: Wierd context-switching issue on Xeon In-Reply-To: <25437.1085025536@sss.pgh.pa.us> To: Tom Lane Date: Thu, 20 May 2004 00:11:05 -0400 (EDT) Cc: pg@fastcrypt.com, Robert Creager , Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/166 X-Sequence-Number: 6997 OK, added to TODO: * Investigate SMP context switching issues --------------------------------------------------------------------------- Tom Lane wrote: > Bruce Momjian writes: > > Tom Lane wrote: > >> ... The SMP issue seems to be not with whether there is > >> instantaneous contention for the locked datastructure, but with the cost > >> of making it possible for processor B to acquire a lock recently held by > >> processor A. > > > I see. I don't even see a TODO in there. :-( > > Nothing more specific than "investigate SMP context switching issues", > anyway. We are definitely in a research mode here, rather than an > engineering mode. > > ObQuote: "Research is what I am doing when I don't know what I am > doing." - attributed to Werner von Braun, but has anyone got a > definitive reference? > > regards, tom lane > -- 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 Thu May 20 01:13:36 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BD621D1D6C3 for ; Thu, 20 May 2004 01:13:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59249-01 for ; Thu, 20 May 2004 01:13:07 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id DFE97D1B25F for ; Thu, 20 May 2004 01:12:45 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4K4BvV03958; Thu, 20 May 2004 00:11:57 -0400 (EDT) From: Bruce Momjian Message-Id: <200405200411.i4K4BvV03958@candle.pha.pa.us> Subject: Re: Wierd context-switching issue on Xeon In-Reply-To: <25480.1085025761@sss.pgh.pa.us> To: Tom Lane Date: Thu, 20 May 2004 00:11:57 -0400 (EDT) Cc: Robert Creager , pg@fastcrypt.com, Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/167 X-Sequence-Number: 6998 Tom Lane wrote: > Robert Creager writes: > > Tom Lane confessed: > >> Do you have the post-7.4.2 datatype fixes for pg_autovacuum? > > > No. I'm still running 7.4.1 w/associated contrib. I guess an upgrade is in > > order then. I'm currently downloading 7.4.2 to see what the change is that I > > need. Is it just the 7.4.2 pg_autovacuum that is needed here? > > Nope, the fixes I was thinking about just missed the 7.4.2 release. > I think you can only get them from CVS. (Maybe we should offer a > nightly build of the latest stable release branch, not only development > tip...) > > > I've caught a whiff that 7.4.3 is nearing release? Any idea when? > > Not scheduled yet, but there was talk of pushing one out before 7.5 goes > into feature freeze. We need the temp table autovacuum fix before we do 7.4.3. -- 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 Thu May 20 02:19:52 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2B513D1D103 for ; Thu, 20 May 2004 02:19:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 77277-04 for ; Thu, 20 May 2004 02:19:31 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 52A30D1DD65 for ; Thu, 20 May 2004 02:19:29 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4K5JST1025148 for ; Thu, 20 May 2004 05:19:28 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4K4oNlc016782 for pgsql-performance@postgresql.org; Thu, 20 May 2004 04:50:23 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Wierd context-switching issue on Xeon Date: Thu, 20 May 2004 00:48:48 -0400 Organization: cbbrowne Computing Inc Lines: 12 Message-ID: References: <200405200302.i4K32G721749@candle.pha.pa.us> <25437.1085025536@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:jqNaG7AivO6x1PLFT3FZRv7MGaM= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/170 X-Sequence-Number: 7001 In an attempt to throw the authorities off his trail, tgl@sss.pgh.pa.us (Tom Lane) transmitted: > ObQuote: "Research is what I am doing when I don't know what I am > doing." - attributed to Werner von Braun, but has anyone got a > definitive reference? That points to a bunch of seemingly authoritative sources... -- (reverse (concatenate 'string "moc.enworbbc" "@" "enworbbc")) http://www.ntlug.org/~cbbrowne/lsf.html "Terrrrrific." -- Ford Prefect From pgsql-performance-owner@postgresql.org Thu May 20 02:19:50 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 49F6AD1B896 for ; Thu, 20 May 2004 02:19:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 78324-04 for ; Thu, 20 May 2004 02:19:29 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id E05D2D1DD0F for ; Thu, 20 May 2004 02:19:28 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4K5JSSx025148 for ; Thu, 20 May 2004 05:19:28 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4K4nhSm016361 for pgsql-performance@postgresql.org; Thu, 20 May 2004 04:49:43 GMT From: Joseph Shraibman X-Newsgroups: comp.databases.postgresql.performance Subject: Re: PostgreSQL performance in simple queries Date: Thu, 20 May 2004 00:49:43 -0400 Organization: Hub.Org Networking Services Lines: 7 Message-ID: References: <1117434122.20040520000757@mail.ru> <40ABD6CC.3070206@samurai.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en In-Reply-To: <40ABD6CC.3070206@samurai.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/169 X-Sequence-Number: 7000 Neil Conway wrote: > PostgreSQL (< 7.5) won't consider using an indexscan when the predicate > involves an integer literal and the column datatype is int2 or int8. Is this fixed for 7.5? It isn't checked off on the TODO list at http://developer.postgresql.org/todo.php From pgsql-performance-owner@postgresql.org Thu May 20 02:11:16 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 86381D1B262 for ; Thu, 20 May 2004 02:11:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 75008-03 for ; Thu, 20 May 2004 02:10:55 -0300 (ADT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id 0F641D1B28B for ; Thu, 20 May 2004 02:10:54 -0300 (ADT) Received: from ool-4352919e.dyn.optonline.net ([67.82.145.158] helo=[192.168.1.10]) by outbound.mailhop.org with asmtp (Exim 4.20) id 1BQfow-000FWV-SE; Thu, 20 May 2004 01:10:18 -0400 Subject: Re: Wierd context-switching issue on Xeon From: "Matthew T. O'Connor" To: Robert Creager Cc: Bruce Momjian , pg@fastcrypt.com, Josh Berkus , =?ISO-8859-1?Q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Tom Lane , Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway In-Reply-To: <20040519195926.3c5fa3bc@thunder.mshome.net> References: <1083512362.25096.131.camel@localhost.localdomain> <200405200120.i4K1KKm06350@candle.pha.pa.us> <20040519195926.3c5fa3bc@thunder.mshome.net> Content-Type: text/plain Message-Id: <1085029814.32765.10.camel@zedora2> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 20 May 2004 01:10:14 -0400 Content-Transfer-Encoding: 7bit X-Mail-Handler: MailHop Outbound by DynDNS.org X-Originating-IP: 67.82.145.158 X-Report-Abuse-To: abuse@dyndns.org (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: Zeut X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/168 X-Sequence-Number: 6999 On Wed, 2004-05-19 at 21:59, Robert Creager wrote: > When grilled further on (Wed, 19 May 2004 21:20:20 -0400 (EDT)), > Bruce Momjian confessed: > > > > > Did we ever come to a conclusion about excessive SMP context switching > > under load? > > > > I just figured out what was causing the problem on my system Monday. I'm using > the pg_autovacuum daemon, and it was not vacuuming my db. I've no idea why and > didn't get a chance to investigate. Strange. There is a known bug in the 7.4.2 version of pg_autovacuum related to data type mismatches which is fixed in CVS. But that bug doesn't cause pg_autovacuum to stop vacuuming but rather to vacuum to often. So perhaps this is a different issue? Please let me know what you find. Thanks, Matthew O'Connor From pgsql-performance-owner@postgresql.org Thu May 20 06:28:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 44188D1B896 for ; Thu, 20 May 2004 06:28:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58588-10 for ; Thu, 20 May 2004 06:27:57 -0300 (ADT) Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz [202.0.58.20]) by svr1.postgresql.org (Postfix) with ESMTP id D7360D1B262 for ; Thu, 20 May 2004 06:26:28 -0300 (ADT) Received: from smtp-2.paradise.net.nz (smtp-2b.paradise.net.nz [202.0.32.211]) by linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id <0HY0005E8A80XR@linda-1.paradise.net.nz> for pgsql-performance@postgresql.org; Thu, 20 May 2004 21:26:30 +1200 (NZST) Received: from paradise.net.nz (203-79-100-70.adsl.paradise.net.nz [203.79.100.70]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 800B59E248; Thu, 20 May 2004 21:26:24 +1200 (NZST) Date: Thu, 20 May 2004 21:28:28 +1200 From: Mark Kirkwood Subject: Re: DB Design In-reply-to: <200405190724.i4J7NuPW030497@mail.census.gov.ph> To: "Michael Ryan S. Puncia" Cc: pgsql-performance@postgresql.org Message-id: <40AC7A3C.2050001@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/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040404 References: <200405190724.i4J7NuPW030497@mail.census.gov.ph> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/171 X-Sequence-Number: 7002 The complete answer is probably "it depends", but this does not help much...:-) I would try out the simple approach first (i.e one 50 million row table), but read up about : i) partial indexes and maybe ii) clustering iii) think about presorting the data before loading to place "likely to be accessed" rows "close" together in the table (if possible). iv) get to know the analyze, explain, explain analyze commands.... Best wishes Mark Michael Ryan S. Puncia wrote: > Hi Guys, > > > > My question is .. which is better design > > > > 1. Single Table with 50 million records or > 2. Multiple Table using inheritance to the parents table > > > > > > I will use this only for query purpose .. > > > > Thanks .. > > > > > From pgsql-performance-owner@postgresql.org Thu May 20 10:46:29 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 346BFD1B182 for ; Thu, 20 May 2004 10:46:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48136-05 for ; Thu, 20 May 2004 10:46:07 -0300 (ADT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 63DAED1B459 for ; Thu, 20 May 2004 10:46:03 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.11.3/8.11.3) with ESMTP id i4KDk8417619 for ; Thu, 20 May 2004 07:46:08 -0600 (MDT) Message-ID: <40ACB6A0.3070802@outputservices.com> Date: Thu, 20 May 2004 07:46:08 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Hardware Platform Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/172 X-Sequence-Number: 7003 Duane wrote: > P.S. I've only just begun using PostgreSQL after having > used (and still using) DB2 on a mainframe for the past 14 > years. My experience with Unix/Linux is limited to some > community college classes I've taken but we do have > a couple of experienced Linux sysadmins on our team. > I tell you this because my "ignorance" will probably > show more than once in my inquiries. Duane, If you've been actively using and developing in DB2, presumably under MVS or whatever big blue is calling it these days, for 14 years, then you will bring a wealth of big system expertise to Pg. Please stay involved and make suggestions where you thing Pg could be improved. Marty From pgsql-performance-owner@postgresql.org Thu May 20 12:38:24 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 83D1FD1CE42 for ; Thu, 20 May 2004 12:38:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95660-04 for ; Thu, 20 May 2004 12:37:58 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C23F7D1BAAD for ; Thu, 20 May 2004 12:34:01 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4KFXxNs001455; Thu, 20 May 2004 11:33:59 -0400 (EDT) To: Joseph Shraibman Cc: pgsql-performance@postgresql.org, Bruce Momjian Subject: Re: PostgreSQL performance in simple queries In-reply-to: References: <1117434122.20040520000757@mail.ru> <40ABD6CC.3070206@samurai.com> Comments: In-reply-to Joseph Shraibman message dated "Thu, 20 May 2004 00:49:43 -0400" Date: Thu, 20 May 2004 11:33:59 -0400 Message-ID: <1454.1085067239@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/173 X-Sequence-Number: 7004 Joseph Shraibman writes: > Neil Conway wrote: >> PostgreSQL (< 7.5) won't consider using an indexscan when the predicate >> involves an integer literal and the column datatype is int2 or int8. > Is this fixed for 7.5? It isn't checked off on the TODO list at > http://developer.postgresql.org/todo.php It is. I don't know why Bruce hasn't checked it off. Some other stuff that needs work in TODO: : Bracketed items "[]" have more detailed. More detailed what? Grammar please. : * Remove unreferenced table files and temp tables during database vacuum : or postmaster startup (Bruce) I'm not sure this is still needed given that we now log file deletion in WAL. : * Allow pg_dump to dump sequences using NO_MAXVALUE and NO_MINVALUE Seems to be done. : * Prevent whole-row references from leaking memory, e.g. SELECT COUNT(tab.*) Done. : * Make LENGTH() of CHAR() not count trailing spaces Done. : * Allow SELECT * FROM tab WHERE int2col = 4 to use int2col index, int8, : float4, numeric/decimal too Done, per above. : * Allow more ISOLATION LEVELS to be accepted, but issue a warning for them Presently we accept all four with no warning ... : * Add GUC setting to make created tables default to WITHOUT OIDS Seems to be done, other than the argument about how pg_dump should work. : * Allow fastpast to pass values in portable format This was done in 7.4. : * Move psql backslash database information into the backend, use nmumonic : commands? [psql] Spelling problem... : * JDBC With JDBC out of the core, I'm not sure why we still have a JDBC section in the core TODO. : * Have pg_dump -c clear the database using dependency information I think this works now. Not really tested, but in principle it should work. : * Cache last known per-tuple offsets to speed long tuple access This sounds exactly like attcacheoff, which has been there since Berkeley. Either remove this or fix the description to give some idea what's really meant. : * Automatically place fixed-width, NOT NULL columns first in a table This is not ever going to happen, given that we've rejected the idea of having separate logical and physical column positions. : * Change representation of whole-tuple parameters to functions Done. (However, you might want to add something about supporting composite types as table columns, which isn't done.) : * Allow the regression tests to start postmaster with -i so the tests : can be run on systems that don't support unix-domain sockets Done long ago. regards, tom lane From pgsql-performance-owner@postgresql.org Thu May 20 12:58:32 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7DF42D1B28B; Thu, 20 May 2004 12:57:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 05385-03; Thu, 20 May 2004 12:57:15 -0300 (ADT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 0DACAD1B1CA; Thu, 20 May 2004 12:57:00 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i4KFutB17015; Thu, 20 May 2004 11:56:55 -0400 (EDT) From: Bruce Momjian Message-Id: <200405201556.i4KFutB17015@candle.pha.pa.us> Subject: Re: PostgreSQL performance in simple queries In-Reply-To: <1454.1085067239@sss.pgh.pa.us> To: Tom Lane Date: Thu, 20 May 2004 11:56:55 -0400 (EDT) Cc: Joseph Shraibman , pgsql-performance@postgresql.org, PostgreSQL-development X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/174 X-Sequence-Number: 7005 Tom Lane wrote: > Joseph Shraibman writes: > > Neil Conway wrote: > >> PostgreSQL (< 7.5) won't consider using an indexscan when the predicate > >> involves an integer literal and the column datatype is int2 or int8. > > > Is this fixed for 7.5? It isn't checked off on the TODO list at > > http://developer.postgresql.org/todo.php > > It is. I don't know why Bruce hasn't checked it off. > OK, marked as done: * -Allow SELECT * FROM tab WHERE int2col = 4 to use int2col index, int8, float4, numeric/decimal too > > Some other stuff that needs work in TODO: > > : Bracketed items "[]" have more detailed. > > More detailed what? Grammar please. Fixed. "more detail". > : * Remove unreferenced table files and temp tables during database vacuum > : or postmaster startup (Bruce) > > I'm not sure this is still needed given that we now log file deletion in > WAL. OK, removed. > > : * Allow pg_dump to dump sequences using NO_MAXVALUE and NO_MINVALUE > > Seems to be done. OK. > > : * Prevent whole-row references from leaking memory, e.g. SELECT COUNT(tab.*) > > Done. OK. > > : * Make LENGTH() of CHAR() not count trailing spaces > > Done. OK. > > : * Allow SELECT * FROM tab WHERE int2col = 4 to use int2col index, int8, > : float4, numeric/decimal too > > Done, per above. Got it. > > : * Allow more ISOLATION LEVELS to be accepted, but issue a warning for them > > Presently we accept all four with no warning ... OK. Warning part removed. > > : * Add GUC setting to make created tables default to WITHOUT OIDS > > Seems to be done, other than the argument about how pg_dump should work. I did the pg_dump part using SET only where needed. That is done. > > : * Allow fastpast to pass values in portable format > > This was done in 7.4. Removed. > > : * Move psql backslash database information into the backend, use nmumonic > : commands? [psql] > > Spelling problem... Fixed. > > : * JDBC > > With JDBC out of the core, I'm not sure why we still have a JDBC section > in the core TODO. Removed. If they want it they can get it from our CVS history. > : * Have pg_dump -c clear the database using dependency information > > I think this works now. Not really tested, but in principle it should > work. OK. > > : * Cache last known per-tuple offsets to speed long tuple access > > This sounds exactly like attcacheoff, which has been there since > Berkeley. Either remove this or fix the description to give some > idea what's really meant. Added "adjusting for NULLs and TOAST values. The issue is that when NULLs or TOAST is present, those aren't useful. I was thinking we could remember the pattern of the previous row and use those offsets if the TOAST/NULL pattern was the same, or something like that. Is that a valid idea? > : * Automatically place fixed-width, NOT NULL columns first in a table > > This is not ever going to happen, given that we've rejected the idea of > having separate logical and physical column positions. Removed. > > : * Change representation of whole-tuple parameters to functions > > Done. (However, you might want to add something about supporting > composite types as table columns, which isn't done.) OK, marked a done, and added new line: * Support composite types as table columns > : * Allow the regression tests to start postmaster with -i so the tests > : can be run on systems that don't support unix-domain sockets > > Done long ago. Removed. Thanks for the updates! -- 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 Thu May 20 13:01:22 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B04DCD1BB93 for ; Thu, 20 May 2004 13:00:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02234-09 for ; Thu, 20 May 2004 13:00:25 -0300 (ADT) Received: from oscar.sybex.com (oscar.sybex.com [63.86.158.35]) by svr1.postgresql.org (Postfix) with SMTP id 49A4DD1B196 for ; Thu, 20 May 2004 13:00:24 -0300 (ADT) Received: from bert.sybex.com by oscar.sybex.com via smtpd (for svr1.postgresql.org [200.46.204.71]) with SMTP; 20 May 2004 16:00:24 UT In-Reply-To: <6.0.1.1.2.20040518133210.01eb9ec0@mail.traderonline.com> Subject: Re: Interpreting vmstat To: Doug Y Cc: pgsql-performance@postgresql.org X-Mailer: Lotus Notes Release 6.5.1 January 21, 2004 Message-ID: From: Thom Dyson Date: Thu, 20 May 2004 09:00:22 -0700 X-MIMETrack: Serialize by Router on Bert/Sybex(Release 6.5|September 18, 2003) at 05/20/2004 09:00:25 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/175 X-Sequence-Number: 7006 Well, Since I haven't seen any other responds, I'll offer a bit of advice and let others correct me. :) Your shared buffers may be too big (?). It is much larger than the guide on varlena.com recommends. All I can suggest is trying some experiments with halving/doubling the numbers to see which way performance goes. Also, if you are counting on cache to improve performance, then the db has to be loaded into cache the first time. So, are subsequent re-queries faster? Thom Dyson Director of Information Services Sybex, Inc. pgsql-performance-owner@postgresql.org wrote on 05/18/2004 11:12:14 AM: > Hello, > (note best viewed in fixed-width font) > > I'm still trying to find where my performance bottle neck is... > I have 4G ram, PG 7.3.4 > shared_buffers = 75000 > effective_cache_size = 75000 From pgsql-performance-owner@postgresql.org Thu May 20 13:57:22 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0DB42D1CABA for ; Thu, 20 May 2004 13:57:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 23010-07 for ; Thu, 20 May 2004 13:56:57 -0300 (ADT) Received: from tupari.net (node-40242ac2.lga.onnet.us.uu.net [64.36.42.194]) by svr1.postgresql.org (Postfix) with ESMTP id 67601D1C4C3 for ; Thu, 20 May 2004 13:52:25 -0300 (ADT) Received: from [192.168.0.2] ([192.168.0.2]) by tupari.net (8.12.8/8.12.8) with ESMTP id i4KGqDCE021167; Thu, 20 May 2004 12:52:13 -0400 Message-ID: <40ACE23D.2090501@selectacast.net> Date: Thu, 20 May 2004 12:52:13 -0400 From: Joseph Shraibman User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 To: tgl@sss.pgh.pa.us, Bruce Momjian Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL performance in simple queries References: <1117434122.20040520000757@mail.ru> <40ABD6CC.3070206@samurai.com> <1454.1085067239@sss.pgh.pa.us> In-Reply-To: <1454.1085067239@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/176 X-Sequence-Number: 7007 Tom Lane wrote: > > : * JDBC > > With JDBC out of the core, I'm not sure why we still have a JDBC section > in the core TODO. Speaking of which why is the jdbc site so hard to find? For that matter the new foundry can only be found through the news article on the front page. From pgsql-performance-owner@postgresql.org Thu May 20 18:52:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1DD0AD1C4C3 for ; Thu, 20 May 2004 18:52:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 36805-09 for ; Thu, 20 May 2004 18:51:58 -0300 (ADT) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id ED725D1B1B3 for ; Thu, 20 May 2004 18:51:50 -0300 (ADT) Received: from [64.81.245.111] (HELO 192.168.1.102) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 5145531; Thu, 20 May 2004 14:53:25 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Tom Lane , Bruce Momjian Subject: Re: Wierd context-switching issue on Xeon Date: Thu, 20 May 2004 14:52:07 -0700 User-Agent: KMail/1.5.4 Cc: pg@fastcrypt.com, Robert Creager , =?iso-8859-1?q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway References: <200405200120.i4K1KKm06350@candle.pha.pa.us> <24373.1085020886@sss.pgh.pa.us> In-Reply-To: <24373.1085020886@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200405201452.07833.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=RCVD_NUMERIC_HELO X-Spam-Level: X-Archive-Number: 200405/177 X-Sequence-Number: 7008 Guys, > Oh, you wanted a fix? That seems harder :-(. AFAICS we need a redesign > that causes less load on the BufMgrLock. FWIW, we've been pursuing two routes of quick patch fixes. 1) Dave Cramer and I have been testing setting varying rates of spin_delay in an effort to find a "sweet spot" that the individual system seems to like. This has been somewhat delayed by my illness. 2) The OSDL folks have been trying various patches to use Linux 2.6 Futexes in place of semops (if I have that right) which, if successful, would produce a linux-specific fix. However, they haven't yet come up wiith a version of the patch which is stable. I'm really curious, BTW, about how all of Jan's changes to buffer usage in 7.5 affect this issue. Has anyone tested it on a recent snapshot? -- -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu May 20 19:16:01 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 21B58D1B18A for ; Thu, 20 May 2004 19:15:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48356-03 for ; Thu, 20 May 2004 19:15:41 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A8B11D1CAA0 for ; Thu, 20 May 2004 19:15:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4KMEq7T024679; Thu, 20 May 2004 18:14:52 -0400 (EDT) To: josh@agliodbs.com Cc: Bruce Momjian , pg@fastcrypt.com, Robert Creager , =?iso-8859-1?q?Dirk=5FLutzeb=E4ck?= , ohp@pyrenet.fr, Joe Conway , "scott.marlowe" , pgsql-performance@postgresql.org, Neil Conway Subject: Re: Wierd context-switching issue on Xeon In-reply-to: <200405201452.07833.josh@agliodbs.com> References: <200405200120.i4K1KKm06350@candle.pha.pa.us> <24373.1085020886@sss.pgh.pa.us> <200405201452.07833.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 20 May 2004 14:52:07 -0700" Date: Thu, 20 May 2004 18:14:52 -0400 Message-ID: <24678.1085091292@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/178 X-Sequence-Number: 7009 Josh Berkus writes: > I'm really curious, BTW, about how all of Jan's changes to buffer > usage in 7.5 affect this issue. Has anyone tested it on a recent > snapshot? Won't help. (1) Theoretical argument: the problem case is select-only and touches few enough buffers that it need never visit the kernel. The buffer management algorithm is thus irrelevant since there are never any decisions for it to make. If anything CVS tip will have a worse problem because its more complicated management algorithm needs to spend longer holding the BufMgrLock. (2) Experimental argument: I believe that I did check the self-contained test case we eventually developed against CVS tip on one of Red Hat's SMP machines, and indeed it was unhappy. regards, tom lane From pgsql-performance-owner@postgresql.org Fri May 21 11:42:20 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AFD98D1B1CD for ; Fri, 21 May 2004 11:42:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 90361-06 for ; Fri, 21 May 2004 11:42:00 -0300 (ADT) Received: from fep15.012.net.il (fep15.012.net.il [212.117.129.240]) by svr1.postgresql.org (Postfix) with ESMTP id 48F04D1B1F8 for ; Fri, 21 May 2004 11:41:54 -0300 (ADT) Received: from [127.0.0.1] ([80.178.88.219]) by fep15.012.net.il with ESMTP id <20040521144039.KEXY7406.fep15@[80.178.88.219]> for ; Fri, 21 May 2004 17:40:39 +0300 Received: from [127.0.0.1] ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.50) sender ; 21 May 2004 17:42:09 +0300 Date: Fri, 21 May 2004 17:42:09 +0300 From: Vitaly Belman Reply-To: Vitaly Belman X-Priority: 3 (Normal) Message-ID: <40782517171.20040521174209@012.net.il> To: Postgresql Performance Subject: PostgreSQL caching MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200405/179 X-Sequence-Number: 7010 Hello, I have the following problem: When I run some query after I just run the Postmaster, it takse several seconds to execute (sometimes more than 10), if I rerun it again afterwards, it takes mere milliseconds. So, I guess it has to do with PostgreSQL caching.. But how exactly does it work? What does it cache? And how can I control it? I would like to load selected information in the memory before a user runs the query. Can I do it somehow? As PostgreSQL is used in my case as webserver, it isn't really helping if the user has to wait 10 seconds every time he goes to a new page (even if refreshing the page would be really quick, sine Postgre already loaded the data to memory). P.S If the query or its EXPLAIN are critical for a better understanding, let me know. Regards, Vitaly Belman ICQ: 1912453 AIM: VitalyB1984 MSN: tmdagent@hotmail.com Yahoo!: VitalyBe From pgsql-performance-owner@postgresql.org Fri May 21 12:30:11 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EB85CD1C931 for ; Fri, 21 May 2004 12:30:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10287-07 for ; Fri, 21 May 2004 12:29:45 -0300 (ADT) Received: from www.totalcardinc.com (unknown [64.33.232.186]) by svr1.postgresql.org (Postfix) with ESMTP id A7A6DD1B1CA for ; Fri, 21 May 2004 12:29:44 -0300 (ADT) Received: from RSCHWARZW2K ([10.250.0.37]) (authenticated bits=0) by www.totalcardinc.com (8.12.8/8.12.8) with ESMTP id i4LFTYoP004016; Fri, 21 May 2004 10:29:34 -0500 From: "Rosser Schwarz" To: "'Vitaly Belman'" , "'Postgresql Performance'" Subject: Re: PostgreSQL caching Date: Fri, 21 May 2004 10:29:37 -0500 Message-ID: <002801c43f48$6d629930$2500fa0a@CardServices.TCI.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 In-Reply-To: <40782517171.20040521174209@012.net.il> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/180 X-Sequence-Number: 7011 while you weren't looking, Vitaly Belman wrote: > So, I guess it has to do with PostgreSQL caching.. But how exactly > does it work? What does it cache? And how can I control it? PostgreSQL uses the operating system's disk cache. You can hint to the postmaster how much memory is available for caching with the effective_cache_size directive in your postgresql.conf. If you're running a *nix OS, you can find this by watching `top` for a while; in the header, there's a "cached" value (or something to that effect). Watching this value, you can determine a rough average and set your effective_cache_size to that rough average, or perhaps slightly less. I'm not sure how to get this value on Windows. Pgsql uses the OS's disk cache instead of its own cache management because the former is more likely to persist. If the postmaster managed the cache, as soon as the last connection died, the memory allocated for caching would be released, and all the cached data would be lost. Relying instead on the OS to cache data means that, whether or not there's a postmaster, so long as there has been one, there'll be some data cached. You can "prepopulate" the OS disk cache by periodically running a handful of SELECT queries that pull from your most commonly accessed tables in a background process. (A good way of doing that is simply to run your most commonly executed SELECTS.) Those queries should take the performance hit of fetching from disk, while your regular queries hit the cache. /rls -- Rosser Schwarz Total Card, Inc. From pgsql-performance-owner@postgresql.org Fri May 21 12:34:48 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0BA08D1B215 for ; Fri, 21 May 2004 12:34:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 12217-09 for ; Fri, 21 May 2004 12:34:24 -0300 (ADT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id 428E9D1CAAF for ; Fri, 21 May 2004 12:34:23 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 1BRC2N-000NOT-0X; Fri, 21 May 2004 16:34:21 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7019915A6A; Fri, 21 May 2004 16:34:12 +0100 (BST) Message-ID: <40AE2174.7060107@archonet.com> Date: Fri, 21 May 2004 16:34:12 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vitaly Belman Cc: Postgresql Performance Subject: Re: PostgreSQL caching References: <40782517171.20040521174209@012.net.il> In-Reply-To: <40782517171.20040521174209@012.net.il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/181 X-Sequence-Number: 7012 Vitaly Belman wrote: > Hello, > > I have the following problem: > > When I run some query after I just run the Postmaster, it takse > several seconds to execute (sometimes more than 10), if I rerun it > again afterwards, it takes mere milliseconds. > > So, I guess it has to do with PostgreSQL caching.. But how exactly > does it work? What does it cache? And how can I control it? There are two areas of cache - PostgreSQL's shared buffers and the operating system's disk-cache. You can't directly control what data is cached, it just keeps track of recently used data. It sounds like PG isn't being used for a while so your OS decides to use its cache for webserver files. > I would like to load selected information in the memory before a user > runs the query. Can I do it somehow? As PostgreSQL is used in my case > as webserver, it isn't really helping if the user has to wait 10 > seconds every time he goes to a new page (even if refreshing the page > would be really quick, sine Postgre already loaded the data to > memory). If you could "pin" data in the cache it would run quicker, but at the cost of everything else running slower. Suggested steps: 1. Read the configuration/tuning guide at: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php 2. Post a sample query/explain analyse that runs very slowly when not cached. 3. If needs be, you can write a simple timed script that performs a query. Or, the autovacuum daemon might be what you want. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri May 21 15:50:37 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 90F1AD1B1DA for ; Fri, 21 May 2004 15:50:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 87612-06 for ; Fri, 21 May 2004 15:50:12 -0300 (ADT) Received: from snowwhite.lulu.com (stymie.lulu.com [66.193.5.50]) by svr1.postgresql.org (Postfix) with ESMTP id 260FCD1B1CE for ; Fri, 21 May 2004 15:50:09 -0300 (ADT) Received: from lulu.com (meatwad.rdu.lulu.com [10.0.0.32]) (authenticated) by snowwhite.lulu.com (8.11.6/8.11.6) with ESMTP id i4LFx4n03455 for ; Fri, 21 May 2004 11:59:04 -0400 Message-ID: <40AE274F.7020800@lulu.com> Date: Fri, 21 May 2004 11:59:11 -0400 From: Bill Montgomery User-Agent: Mozilla Thunderbird 0.5 (X11/20040210) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Avoiding vacuum full on an UPDATE-heavy table Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/185 X-Sequence-Number: 7016 All, I have a particularly troublesome table in my 7.3.4 database. It typically has less than 50k rows, and a usage pattern of about 1k INSERTs, 50-100k UPDATEs, and no DELETEs per day. It is vacuumed and analyzed three times per week. However, the performance of queries performed on this table slowly degrades over a period of weeks, until even a "select count(*)" takes several seconds. The only way I've found to restore performance is to VACUUM FULL the table, which is highly undesireable in our application due to the locks it imposes. Here is the output of a psql session demonstrating the problem/solution. Note the \timing output after each of the SELECTs: qqqqqqqq=> vacuum analyze xxxx; NOTICE: VACUUM will be committed automatically VACUUM Time: 715900.74 ms qqqqqqqq=> select count(*) from xxxx; count ------- 17978 (1 row) Time: 171789.08 ms qqqqqqqq=> vacuum full verbose xxxx; NOTICE: VACUUM will be committed automatically INFO: --Relation public.xxxx-- INFO: Pages 188903: Changed 60, reaped 188896, Empty 0, New 0; Tup 17987: Vac 1469, Keep/VTL 0/0, UnUsed 9120184, MinLen 92, MaxLen 468; Re-using: Free/Avail. Space 1504083956/1504083872; EndEmpty/Avail. Pages 0/188901. CPU 6.23s/1.07u sec elapsed 55.02 sec. INFO: Index xxxx_yyyy_idx: Pages 29296; Tuples 17987: Deleted 1469. CPU 1.08s/0.20u sec elapsed 61.68 sec. INFO: Index xxxx_zzzz_idx: Pages 18412; Tuples 17987: Deleted 1469. CPU 0.67s/0.05u sec elapsed 17.90 sec. INFO: Rel xxxx: Pages: 188903 --> 393; Tuple(s) moved: 17985. CPU 15.97s/19.11u sec elapsed 384.49 sec. INFO: Index xxxx_yyyy_idx: Pages 29326; Tuples 17987: Deleted 17985. CPU 1.14s/0.65u sec elapsed 32.34 sec. INFO: Index xxxx_zzzz_idx: Pages 18412; Tuples 17987: Deleted 17985. CPU 0.43s/0.32u sec elapsed 13.37 sec. VACUUM Time: 566313.54 ms qqqqqqqq=> select count(*) from xxxx; count ------- 17987 (1 row) Time: 22.82 ms Is there any way to avoid doing a periodic VACUUM FULL on this table, given the fairly radical usage pattern? Or is the (ugly) answer to redesign our application to avoid this usage pattern? Also, how do I read the output of VACUUM FULL? http://www.postgresql.org/docs/7.3/interactive/sql-vacuum.html does not explain how to interpret the output, nor has google helped. I have a feeling that the full vacuum is compressing hundreds of thousands of pages of sparse data into tens of thousands of pages of dense data, thus reducing the number of block reads by an order of magnitude, but I'm not quite sure how to read the output. FWIW, this is last night's relevant output from the scheduled VACUUM ANALYZE. 24 days have passed since the VACUUM FULL above: INFO: --Relation public.xxx-- INFO: Index xxx_yyy_idx: Pages 30427; Tuples 34545: Deleted 77066. CPU 1.88s/0.51u sec elapsed 95.39 sec. INFO: Index xxx_zzz_idx: Pages 19049; Tuples 34571: Deleted 77066. CPU 0.83s/0.40u sec elapsed 27.92 sec. INFO: Removed 77066 tuples in 3474 pages. CPU 0.38s/0.32u sec elapsed 1.33 sec. INFO: Pages 13295: Changed 276, Empty 0; Tup 34540: Vac 77066, Keep 0, UnUsed 474020. Total CPU 3.34s/1.29u sec elapsed 125.00 sec. INFO: Analyzing public.xxx Best Regards, Bill Montgomery From pgsql-performance-owner@postgresql.org Fri May 21 15:20:14 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A667BD1B1CA for ; Fri, 21 May 2004 15:20:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 68633-04 for ; Fri, 21 May 2004 15:19:49 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 3A975D1B232 for ; Fri, 21 May 2004 15:19:48 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4LIJlSx048765 for ; Fri, 21 May 2004 18:19:47 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4LIAAL3047355 for pgsql-performance@postgresql.org; Fri, 21 May 2004 18:10:10 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: PostgreSQL caching Date: Fri, 21 May 2004 13:22:50 -0400 Organization: cbbrowne Computing Inc Lines: 41 Message-ID: <604qq9hez9.fsf@dev6.int.libertyrms.info> References: <40782517171.20040521174209@012.net.il> <40AE2174.7060107@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:ix5Jklr8JbKHQsGinBFpEqF4W68= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/183 X-Sequence-Number: 7014 dev@archonet.com (Richard Huxton) writes: > If you could "pin" data in the cache it would run quicker, but at the > cost of everything else running slower. > > Suggested steps: > 1. Read the configuration/tuning guide at: > http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php > 2. Post a sample query/explain analyse that runs very slowly when not > cached. > 3. If needs be, you can write a simple timed script that performs a > query. Or, the autovacuum daemon might be what you want. I don't think this case will be anywhere near so simple to resolve. I have seen this phenomenon occur when a query needs to pull a moderate number of blocks into memory to satisfy a query that involves some moderate number of rows. Let's say you need 2000 rows, which fit into 400 blocks. The first time the query runs, it needs to pull those 400 blocks off disk, which requires 400 reads of 8K of data. That can easily take a few seconds of I/O. The second time, not only are those blocks cached, they are probably cached in the buffer cache, so that the I/O overhead disappears. There's very likely no problem with the table statistics; they are leading to the right query plan, which happens to need to do 5 seconds of I/O to pull the data into memory. What is essentially required is the "prescient cacheing algorithm," where the postmaster must consult /dev/esp in order to get a prediction of what blocks it may need to refer to in the next sixty seconds. -- (format nil "~S@~S" "cbbrowne" "cbbrowne.com") http://cbbrowne.com/info/linuxdistributions.html "Normally, we don't do people's homework around here, but Venice is a very beautiful city, so I'll make a small exception." --- Robert Redelmeier compromises his principles From pgsql-performance-owner@postgresql.org Fri May 21 14:33:56 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CDC96D1B1CA for ; Fri, 21 May 2004 14:33:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58672-03 for ; Fri, 21 May 2004 14:33:34 -0300 (ADT) Received: from fep10.012.net.il (fep10.012.net.il [212.117.129.245]) by svr1.postgresql.org (Postfix) with ESMTP id B0992D1B1D5 for ; Fri, 21 May 2004 14:33:28 -0300 (ADT) Received: from [127.0.0.1] ([80.178.88.219]) by fep10.012.net.il with ESMTP id <20040521173318.NVBG24359.fep10@[80.178.88.219]>; Fri, 21 May 2004 20:33:18 +0300 Received: from [127.0.0.1] ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.50) sender ; 21 May 2004 20:33:37 +0300 Date: Fri, 21 May 2004 20:33:37 +0300 From: Vitaly Belman Reply-To: Vitaly Belman X-Priority: 3 (Normal) Message-ID: <20792805375.20040521203337@012.net.il> To: Richard Huxton , Rosser Schwarz Cc: Postgresql Performance Subject: Re: PostgreSQL caching In-Reply-To: <40AE2174.7060107@archonet.com> References: <40782517171.20040521174209@012.net.il> <40AE2174.7060107@archonet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200405/182 X-Sequence-Number: 7013 Hello Richard and Rosser, Thank you both for the answers. I tried creating a semi cache by running all the queries and indeed it worked and I might use such way in the future if needed, yet though, I can't help but to feel it isn't exactly the right way to work around this problem. If I do, I might as well increase the effective_cache value as pointed by the config docs. Also on this subject, previously I was only fighting with queries that run poorly even if you run them 10 days in the row.. They don't seem to be cached at all. Does it cahce the query result? If so, it should make any query run almost immediately the second time. If it doesn't cache the actual result, what does it cache? If you'll be so kind though, I'd be glad if you could spot anything to speed up in this query. Here's the query and its plan that happens without any caching: ------------------------------------------------------------------------------------------------------------- QUERY ----- SELECT bv_books. * , vote_avg, vote_count FROM bv_bookgenres, bv_books WHERE bv_books.book_id = bv_bookgenres.book_id AND bv_bookgenres.genre_id = 5830 ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; QUERY PLAN ---------- Limit (cost=2337.41..2337.43 rows=10 width=76) (actual time=7875.000..7875.000 rows=10 loops=1) -> Sort (cost=2337.41..2337.94 rows=214 width=76) (actual time=7875.000..7875.000 rows=10 loops=1) Sort Key: bv_books.vote_avg -> Nested Loop (cost=0.00..2329.13 rows=214 width=76) (actual time=16.000..7844.000 rows=1993 loops=1) -> Index Scan using i_bookgenres_genre_id on bv_bookgenres (cost=0.00..1681.54 rows=214 width=4) (actual time=16.000..3585.000 rows=1993 loops=1) Index Cond: (genre_id = 5830) -> Index Scan using bv_books_pkey on bv_books (cost=0.00..3.01 rows=1 width=76) (actual time=2.137..2.137 rows=1 loops=1993) Index Cond: (bv_books.book_id = "outer".book_id) Total runtime: 7875.000 ms ------------------------------------------------------------------------------------------------------------- Some general information: bv_books holds 17000 rows. bv_bookgenres holds 938797 rows. Using the WHERE (genre_id == 5838) it cuts the number of book_ids to around 2000. As far as indexes are concerned, there's an index on all the rows mentioned in the query (as can be seen from the explain), including the vote_avg row. Thanks and regards, Vitaly Belman ICQ: 1912453 AIM: VitalyB1984 MSN: tmdagent@hotmail.com Yahoo!: VitalyBe Friday, May 21, 2004, 6:34:12 PM, you wrote: RH> Vitaly Belman wrote: >> Hello, >> >> I have the following problem: >> >> When I run some query after I just run the Postmaster, it takse >> several seconds to execute (sometimes more than 10), if I rerun it >> again afterwards, it takes mere milliseconds. >> >> So, I guess it has to do with PostgreSQL caching.. But how exactly >> does it work? What does it cache? And how can I control it? RH> There are two areas of cache - PostgreSQL's shared buffers and the RH> operating system's disk-cache. You can't directly control what data is RH> cached, it just keeps track of recently used data. It sounds like PG RH> isn't being used for a while so your OS decides to use its cache for RH> webserver files. >> I would like to load selected information in the memory before a user >> runs the query. Can I do it somehow? As PostgreSQL is used in my case >> as webserver, it isn't really helping if the user has to wait 10 >> seconds every time he goes to a new page (even if refreshing the page >> would be really quick, sine Postgre already loaded the data to >> memory). RH> If you could "pin" data in the cache it would run quicker, but at the RH> cost of everything else running slower. RH> Suggested steps: RH> 1. Read the configuration/tuning guide at: RH> http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php RH> 2. Post a sample query/explain analyse that runs very slowly when not RH> cached. RH> 3. If needs be, you can write a simple timed script that performs a RH> query. Or, the autovacuum daemon might be what you want. From pgsql-performance-owner@postgresql.org Fri May 21 15:34:29 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7FF35D1B896 for ; Fri, 21 May 2004 15:34:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 81395-03 for ; Fri, 21 May 2004 15:34:07 -0300 (ADT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 09C34D1B196 for ; Fri, 21 May 2004 15:33:56 -0300 (ADT) Received: from [134.22.68.4] (dyn-68-4.tor.dsl.tht.net [134.22.68.4]) by tht.net (Postfix) with ESMTP id 3715676B0C; Fri, 21 May 2004 14:33:59 -0400 (EDT) Subject: Re: PostgreSQL caching From: Rod Taylor To: Chris Browne Cc: Postgresql Performance In-Reply-To: <604qq9hez9.fsf@dev6.int.libertyrms.info> References: <40782517171.20040521174209@012.net.il> <40AE2174.7060107@archonet.com> <604qq9hez9.fsf@dev6.int.libertyrms.info> Content-Type: text/plain Message-Id: <1085164433.20081.265.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 21 May 2004 14:33:54 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/184 X-Sequence-Number: 7015 > What is essentially required is the "prescient cacheing algorithm," > where the postmaster must consult /dev/esp in order to get a > prediction of what blocks it may need to refer to in the next sixty > seconds. Easy enough. Television does it all the time with live shows. The guy with the buzzer always seems to know what will be said before they say it. All we need is a 5 to 10 second delay... From pgsql-performance-owner@postgresql.org Fri May 21 16:02:57 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C912CD1BAAE for ; Fri, 21 May 2004 16:02:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93252-03 for ; Fri, 21 May 2004 16:02:34 -0300 (ADT) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id 4A47DD1B1D5 for ; Fri, 21 May 2004 16:02:33 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with ESMTP id 0DED61ED7; Fri, 21 May 2004 15:02:34 -0400 (EDT) Received: from bob.samurai.com ([127.0.0.1]) by localhost (bob.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 44284-01-7; Fri, 21 May 2004 15:02:33 -0400 (EDT) Received: from [24.156.130.254] (CPE000a95ab279e-CM014470008056.cpe.net.cable.rogers.com [24.156.130.254]) by bob.samurai.com (Postfix) with ESMTP id 026911EBD; Fri, 21 May 2004 15:02:33 -0400 (EDT) Message-ID: <40AE5248.8090807@samurai.com> Date: Fri, 21 May 2004 15:02:32 -0400 From: Neil Conway User-Agent: Mozilla Thunderbird 0.6 (Macintosh/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rosser Schwarz Cc: 'Vitaly Belman' , 'Postgresql Performance' Subject: Re: PostgreSQL caching References: <002801c43f48$6d629930$2500fa0a@CardServices.TCI.com> In-Reply-To: <002801c43f48$6d629930$2500fa0a@CardServices.TCI.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/186 X-Sequence-Number: 7017 Rosser Schwarz wrote: > PostgreSQL uses the operating system's disk cache. ... in addition to its own buffer cache, which is stored in shared memory. You're correct though, in that the best practice is to keep the PostgreSQL cache small and give more memory to the operating system's disk cache. > Pgsql uses the OS's disk cache instead of its own cache management > because the former is more likely to persist. If the postmaster > managed the cache, as soon as the last connection died, the memory > allocated for caching would be released, and all the cached data > would be lost. No; the cache is stored in shared memory. It wouldn't persist over postmaster restarts (without some scheme of saving and restoring it), but that has nothing to do with why the OS disk cache is usually kept larger than the PG shared buffer cache. -Neil From pgsql-performance-owner@postgresql.org Fri May 21 16:23:03 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A1173D1CCBF for ; Fri, 21 May 2004 16:23:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97573-07 for ; Fri, 21 May 2004 16:22:42 -0300 (ADT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id 159BBD1B233 for ; Fri, 21 May 2004 16:22:41 -0300 (ADT) Received: from ool-4352919e.dyn.optonline.net ([67.82.145.158] helo=matth.zeut.net) by outbound.mailhop.org with asmtp (Exim 4.20) id 1BRFbL-000JVc-Mb; Fri, 21 May 2004 15:22:40 -0400 Received: from 192.154.91.225 (SquirrelMail authenticated user dbmail2user); by matth.zeut.net with HTTP; Fri, 21 May 2004 15:22:40 -0400 (EDT) Message-ID: <54139.192.154.91.225.1085167360.squirrel@192.154.91.225> In-Reply-To: <40AE274F.7020800@lulu.com> References: <40AE274F.7020800@lulu.com> Date: Fri, 21 May 2004 15:22:40 -0400 (EDT) Subject: Re: Avoiding vacuum full on an UPDATE-heavy table From: "Matthew T. O'Connor" To: "Bill Montgomery" Cc: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.5.0 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Mail-Handler: MailHop Outbound by DynDNS.org X-Originating-IP: 67.82.145.158 X-Report-Abuse-To: abuse@dyndns.org (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: Zeut X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.0 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME, RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: * X-Archive-Number: 200405/187 X-Sequence-Number: 7018 > Is there any way to avoid doing a periodic VACUUM FULL on this table, > given the fairly radical usage pattern? Or is the (ugly) answer to > redesign our application to avoid this usage pattern? Yes, you should be able to doing avoid periodic VACUUM FULL. The problem is that your table needs to be vacuumed MUCH more often. What should happen is that assuming you have enough FSM space allocated and assuming you vacuum the "right" amount, your table will reach a steady state size. As you could see your from you vacumm verbose output your table was almost entriely dead space. pg_autovacuum would probably help as it monitors activity and vacuumus tables accordingly. It is not included with 7.3.x but if you download it and compile yourself it will work against a 7.3.x server. Good luck, Matthew From pgsql-performance-owner@postgresql.org Fri May 21 17:11:17 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 34E9CD1B1D0 for ; Fri, 21 May 2004 17:11:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 08359-09 for ; Fri, 21 May 2004 17:10:57 -0300 (ADT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 35DBCD1B18A for ; Fri, 21 May 2004 17:10:53 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.11.3/8.11.3) with ESMTP id i4LKAu419330; Fri, 21 May 2004 14:10:56 -0600 (MDT) Message-ID: <40AE6250.6070904@outputservices.com> Date: Fri, 21 May 2004 14:10:56 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/188 X-Sequence-Number: 7019 Not knowing a whole lot about the internals of Pg, one thing jumped out at me, that each trip to get data from bv_books took 2.137 ms, which came to over 4.2 seconds right there. The problem "seems" to be the 1993 times that the nested loop spins, as almost all of the time is spent there. Personally, I am amazed that it takes 3.585 seconds to index scan i_bookgenres_genre_id. Is that a composite index? Analyzing the taables may help, as the optimizer appears to mispredict the number of rows returned. I would be curious to see how it performs with an "IN" clause, which I would suspect would go quite a bit fasrer. Try the following: SELECT bv_books. * , vote_avg, vote_count FROM bv_bookgenres, bv_books WHERE bv_books.book_id IN ( SELECT book_id FROM bv_genres WHERE bv_bookgenres.genre_id = 5830 ) AND bv_bookgenres.genre_id = 5830 ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; In this query, all of the book_id values are pulled at once. Who knows? If you get statisctics on this, please post. Marty From pgsql-performance-owner@postgresql.org Fri May 21 17:36:40 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 52A3ED1B1D0 for ; Fri, 21 May 2004 17:36:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 23023-04 for ; Fri, 21 May 2004 17:36:19 -0300 (ADT) Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id 190DCD1B193 for ; Fri, 21 May 2004 17:36:17 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kcilink.com (Postfix) with ESMTP id 221283F9C for ; Fri, 21 May 2004 16:36:19 -0400 (EDT) Received: from lorax.kcilink.com ([127.0.0.1]) by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03725-03 for ; Fri, 21 May 2004 16:36:18 -0400 (EDT) Received: by lorax.kcilink.com (Postfix, from userid 8) id 9E9A43F22; Fri, 21 May 2004 16:36:18 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Avoiding vacuum full on an UPDATE-heavy table Date: Fri, 21 May 2004 16:36:18 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 18 Message-ID: References: <40AE274F.7020800@lulu.com> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kcilink.com 1085171778 87505 65.205.34.180 (21 May 2004 20:36:18 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Fri, 21 May 2004 20:36:18 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, berkeley-unix) Cancel-Lock: sha1:/tkEJMmq2WeRXnC3z5NvVVNaZgQ= X-Virus-Scanned: by amavisd-new at kcilink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/189 X-Sequence-Number: 7020 >>>>> "BM" == Bill Montgomery writes: BM> Is there any way to avoid doing a periodic VACUUM FULL on this table, BM> given the fairly radical usage pattern? Or is the (ugly) answer to BM> redesign our application to avoid this usage pattern? I'll bet upgrading to 7.4.2 clears up your problems. I'm not sure if it was in 7.3 or 7.4 where the index bloat problem was solved. Try to see if just reindexing will help your performance. Also, run a plain vacuum at least nightly so that your table size stays reasonable. It won't take much time on a table with only 50k rows in it. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Fri May 21 18:32:22 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E4C72D1BCA7 for ; Fri, 21 May 2004 18:32:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48696-04 for ; Fri, 21 May 2004 18:31:54 -0300 (ADT) Received: from snowwhite.lulu.com (stymie.lulu.com [66.193.5.50]) by svr1.postgresql.org (Postfix) with ESMTP id 2D584D1D299 for ; Fri, 21 May 2004 18:29:33 -0300 (ADT) Received: from lulu.com (meatwad.rdu.lulu.com [10.0.0.32]) (authenticated) by snowwhite.lulu.com (8.11.6/8.11.6) with ESMTP id i4LLTQn09991 for ; Fri, 21 May 2004 17:29:26 -0400 Message-ID: <40AE74BD.5050802@lulu.com> Date: Fri, 21 May 2004 17:29:33 -0400 From: Bill Montgomery User-Agent: Mozilla Thunderbird 0.5 (X11/20040210) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Avoiding vacuum full on an UPDATE-heavy table References: <40AE274F.7020800@lulu.com> <54139.192.154.91.225.1085167360.squirrel@192.154.91.225> In-Reply-To: <54139.192.154.91.225.1085167360.squirrel@192.154.91.225> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/190 X-Sequence-Number: 7021 Matthew T. O'Connor wrote: >>Is there any way to avoid doing a periodic VACUUM FULL on this table, >>given the fairly radical usage pattern? Or is the (ugly) answer to >>redesign our application to avoid this usage pattern? >> >> >pg_autovacuum would probably help as it monitors activity and vacuumus >tables accordingly. It is not included with 7.3.x but if you download it >and compile yourself it will work against a 7.3.x server. > > As a quick fix, since we're upgrading to 7.4.2 in a few weeks anyhow (which includes pg_autovacuum), I've simply set up an hourly vacuum on this table. It only takes ~4 seconds to execute when kept up on an hourly basis. Is there any penalty to vacuuming too frequently, other than the time wasted in an unnecessary vacuum operation? My hourly VACUUM VERBOSE output now looks like this: INFO: --Relation public.xxxx-- INFO: Index xxxx_yyyy_idx: Pages 30452; Tuples 34990: Deleted 1226. CPU 0.67s/0.18u sec elapsed 0.87 sec. INFO: Index xxxx_yyyy_idx: Pages 19054; Tuples 34991: Deleted 1226. CPU 0.51s/0.13u sec elapsed 1.35 sec. INFO: Removed 1226 tuples in 137 pages. CPU 0.01s/0.00u sec elapsed 1.30 sec. INFO: Pages 13709: Changed 31, Empty 0; Tup 34990: Vac 1226, Keep 0, UnUsed 567233. Total CPU 1.58s/0.31u sec elapsed 3.91 sec. INFO: Analyzing public.xxxx VACUUM With regards to Vivek's post about index bloat, I tried REINDEXing before I did a VACUUM FULL a month ago when performance had gotten dismal. It didn't help :-( Best Regards, Bill Montgomery From pgsql-performance-owner@postgresql.org Fri May 21 19:09:44 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 541E2D1B1D1 for ; Fri, 21 May 2004 19:09:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59396-07 for ; Fri, 21 May 2004 19:09:25 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E685DD1B211 for ; Fri, 21 May 2004 19:09:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4LM9OBX016536; Fri, 21 May 2004 18:09:24 -0400 (EDT) To: Bill Montgomery Cc: pgsql-performance@postgresql.org Subject: Re: Avoiding vacuum full on an UPDATE-heavy table In-reply-to: <40AE274F.7020800@lulu.com> References: <40AE274F.7020800@lulu.com> Comments: In-reply-to Bill Montgomery message dated "Fri, 21 May 2004 11:59:11 -0400" Date: Fri, 21 May 2004 18:09:24 -0400 Message-ID: <16535.1085177364@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/191 X-Sequence-Number: 7022 Bill Montgomery writes: > I have a particularly troublesome table in my 7.3.4 database. It > typically has less than 50k rows, and a usage pattern of about 1k > INSERTs, 50-100k UPDATEs, and no DELETEs per day. It is vacuumed and > analyzed three times per week. You probably want to vacuum (non-FULL) once a day, if not more often. Also take a look at your FSM settings --- it seems like a good bet that they're not large enough to remember all the free space in your database. With adequate FSM the table should stabilize at a physical size corresponding to number-of-live-rows + number-of-updates-between-VACUUMs, which would be three times the minimum possible size if you vacuum once a day (50K + 100K) or five times if you stick to every-other-day (50K + 200K). Your VACUUM FULL output shows that the table had bloated to hundreds of times the minimum size: > INFO: Rel xxxx: Pages: 188903 --> 393; Tuple(s) moved: 17985. and AFAIK the only way that will happen is if you fail to vacuum at all or don't have enough FSM. The indexes are looking darn large as well. In 7.3 about the only thing you can do about this is REINDEX the table every so often. 7.4 should behave better though. regards, tom lane From pgsql-performance-owner@postgresql.org Fri May 21 20:23:57 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6C935D1B16A for ; Fri, 21 May 2004 20:23:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 80192-06 for ; Fri, 21 May 2004 20:23:36 -0300 (ADT) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by svr1.postgresql.org (Postfix) with ESMTP id C9FD3D1B25F for ; Fri, 21 May 2004 20:23:33 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id B9274BF87 for ; Fri, 21 May 2004 17:22:08 -0600 (MDT) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25861-06 for ; Fri, 21 May 2004 17:22:08 -0600 (MDT) Received: from [192.168.1.12] (c-24-9-24-35.client.comcast.net [24.9.24.35]) by crestone.coronasolutions.com (Postfix) with ESMTP id 6206FBDD9 for ; Fri, 21 May 2004 17:22:08 -0600 (MDT) Message-ID: <40AE8F78.2070901@drivefaster.net> Date: Fri, 21 May 2004 17:23:36 -0600 From: Dan Harris User-Agent: Mozilla Thunderbird 0.6 (Macintosh/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: tuning for AIX 5L with large memory Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at drivefaster.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/192 X-Sequence-Number: 7023 I will soon have at my disposal a new IBM pSeries server. The main mission for this box will be to serve several pg databases. I have ordered 8GB of RAM and want to learn the best way to tune pg and AIX for this configuration. Specifically, I am curious about shared memory limitations. I've had to tune the shmmax on linux machines before but I'm new to AIX and not sure if this is even required on that platform? Google has not been much help for specifics here. Hoping someone else here has a similar platform and can offer some advice.. Thanks! -Dan Harris From pgsql-performance-owner@postgresql.org Fri May 21 23:20:16 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 68AC1D1B17B for ; Fri, 21 May 2004 23:20:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 21891-06 for ; Fri, 21 May 2004 23:19:52 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id B5937D1B18F for ; Fri, 21 May 2004 23:19:48 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4M2JmSx048793 for ; Sat, 22 May 2004 02:19:48 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4M1oLJg043582 for pgsql-performance@postgresql.org; Sat, 22 May 2004 01:50:21 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: tuning for AIX 5L with large memory Date: Fri, 21 May 2004 21:28:08 -0400 Organization: cbbrowne Computing Inc Lines: 40 Message-ID: References: <40AE8F78.2070901@drivefaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:mf/hprJJi+7Rs6uw6jnzFNF/KCs= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/193 X-Sequence-Number: 7024 Clinging to sanity, fbsd@drivefaster.net (Dan Harris) mumbled into her beard: > I will soon have at my disposal a new IBM pSeries server. The main > mission for this box will be to serve several pg databases. I have > ordered 8GB of RAM and want to learn the best way to tune pg and AIX > for this configuration. Specifically, I am curious about shared > memory limitations. I've had to tune the shmmax on linux machines > before but I'm new to AIX and not sure if this is even required on > that platform? Google has not been much help for specifics here. > > Hoping someone else here has a similar platform and can offer some advice.. We have a couple of these at work; they're nice and fast, although the process of compiling things, well, "makes me feel a little unclean." One of our sysadmins did all the "configuring OS stuff" part; I don't recall offhand if there was a need to twiddle something in order to get it to have great gobs of shared memory. A quick Google on this gives me the impression that AIX supports, out of the box, multiple GB of shared memory without special kernel configuration. A DB/2 configuration guide tells users of Solaris and HP/UX that they need to set shmmax in sundry config files and reboot. No such instruction for AIX. If it needs configuring, it's probably somewhere in SMIT. And you can always try starting up an instance to see how big it'll let you make shared memory. The usual rule of thumb has been that having substantially more than 10000 blocks worth of shared memory is unworthwhile. I don't think anyone has done a detailed study on AIX to see if bigger numbers play well or not. I would think that having more than about 1 to 1.5GB of shared memory in use for buffer cache would start playing badly, but I have no numbers. -- select 'cbbrowne' || '@' || 'cbbrowne.com'; http://www3.sympatico.ca/cbbrowne/sap.html Would-be National Mottos: USA: "We don't care where you come from. We can't find our *own* country on a map..." From pgsql-performance-owner@postgresql.org Fri May 21 23:31:44 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id ACFCBD1B896 for ; Fri, 21 May 2004 23:31:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 22823-08 for ; Fri, 21 May 2004 23:31:16 -0300 (ADT) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id AA8C1D1B266 for ; Fri, 21 May 2004 23:31:12 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with ESMTP id 1A6D81F94; Fri, 21 May 2004 22:31:17 -0400 (EDT) Received: from bob.samurai.com ([127.0.0.1]) by localhost (bob.samurai.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 68170-01-8; Fri, 21 May 2004 22:31:16 -0400 (EDT) Received: from [24.156.130.254] (CPE000a95ab279e-CM014470008056.cpe.net.cable.rogers.com [24.156.130.254]) by bob.samurai.com (Postfix) with ESMTP id 2E6021DAD; Fri, 21 May 2004 22:31:16 -0400 (EDT) Message-ID: <40AEBB73.7010105@samurai.com> Date: Fri, 21 May 2004 22:31:15 -0400 From: Neil Conway User-Agent: Mozilla Thunderbird 0.6 (Macintosh/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: tuning for AIX 5L with large memory References: <40AE8F78.2070901@drivefaster.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/194 X-Sequence-Number: 7025 Christopher Browne wrote: > One of our sysadmins did all the "configuring OS stuff" part; I don't > recall offhand if there was a need to twiddle something in order to > get it to have great gobs of shared memory. FWIW, the section on configuring kernel resources under various Unixen[1] doesn't have any documentation for AIX. If someone out there knows which knobs need to be tweaked, would they mind sending in a doc patch? (Or just specifying what needs to be done, and I'll add the SGML.) -Neil [1] http://developer.postgresql.org/docs/postgres/kernel-resources.html#SYSVIPC From pgsql-performance-owner@postgresql.org Sun May 23 03:25:13 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1E8F4D1E05F for ; Sun, 23 May 2004 03:25:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 92516-03 for ; Sun, 23 May 2004 03:24:41 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 77353D1E1DD for ; Sun, 23 May 2004 03:03:51 -0300 (ADT) Received: from fep11.012.net.il (fep11.012.net.il [212.117.129.244]) by www.postgresql.com (Postfix) with ESMTP id 4FD8DCF8807 for ; Sat, 22 May 2004 19:21:08 -0300 (ADT) Received: from [127.0.0.1] ([80.178.88.219]) by fep11.012.net.il with ESMTP id <20040522221908.CWYP3263.fep11@[80.178.88.219]>; Sun, 23 May 2004 01:19:08 +0300 Received: from [127.0.0.1] ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.50) sender ; 23 May 2004 01:22:10 +0300 Date: Sun, 23 May 2004 01:22:09 +0300 From: Vitaly Belman Reply-To: Vitaly Belman X-Priority: 3 (Normal) Message-ID: <188896456515.20040523012209@012.net.il> To: Marty Scholes Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching In-Reply-To: <40AE6250.6070904@outputservices.com> References: <40AE6250.6070904@outputservices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200405/195 X-Sequence-Number: 7026 Hello Marty, MS> Is that a composite index? It is a regular btree index. What is a composite index? MS> Analyzing the taables may help, as the optimizer appears to MS> mispredict the number of rows returned. I'll try analyzing, but I highly doubt that it would help. I analyzed once already and haven't changed the data since. MS> I would be curious to see how it performs with an "IN" clause, MS> which I would suspect would go quite a bit fasrer. Actually it reached 20s before I canceled it... Here's the explain: QUERY PLAN Limit (cost=3561.85..3561.88 rows=10 width=76) -> Sort (cost=3561.85..3562.39 rows=214 width=76) Sort Key: bv_books.vote_avg -> Nested Loop (cost=1760.75..3553.57 rows=214 width=76) -> Index Scan using i_bookgenres_genre_id on bv_bookgenres (cost=0.00..1681.54 rows=214 width=0) Index Cond: (genre_id = 5830) -> Materialize (cost=1760.75..1761.01 rows=26 width=76) -> Nested Loop (cost=1682.07..1760.75 rows=26 width=76) -> HashAggregate (cost=1682.07..1682.07 rows=26 width=4) -> Index Scan using i_bookgenres_genre_id on bv_bookgenres (cost=0.00..1681.54 rows=214 width=4) Index Cond: (genre_id = 5830) -> Index Scan using bv_books_pkey on bv_books (cost=0.00..3.01 rows=1 width=76) Index Cond: (bv_books.book_id = "outer".book_id) Thank you for your try. Regards, Vitaly Belman ICQ: 1912453 AIM: VitalyB1984 MSN: tmdagent@hotmail.com Yahoo!: VitalyBe Friday, May 21, 2004, 11:10:56 PM, you wrote: MS> Not knowing a whole lot about the internals of Pg, one thing jumped out MS> at me, that each trip to get data from bv_books took 2.137 ms, which MS> came to over 4.2 seconds right there. MS> The problem "seems" to be the 1993 times that the nested loop spins, as MS> almost all of the time is spent there. MS> Personally, I am amazed that it takes 3.585 seconds to index scan MS> i_bookgenres_genre_id. Is that a composite index? Analyzing the MS> taables may help, as the optimizer appears to mispredict the number of MS> rows returned. MS> I would be curious to see how it performs with an "IN" clause, which I MS> would suspect would go quite a bit fasrer. Try the following: MS> SELECT bv_books. * , MS> vote_avg, MS> vote_count MS> FROM bv_bookgenres, MS> bv_books MS> WHERE bv_books.book_id IN ( MS> SELECT book_id MS> FROM bv_genres MS> WHERE bv_bookgenres.genre_id = 5830 MS> ) MS> AND bv_bookgenres.genre_id = 5830 MS> ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; MS> In this query, all of the book_id values are pulled at once. MS> Who knows? MS> If you get statisctics on this, please post. MS> Marty MS> ---------------------------(end of MS> broadcast)--------------------------- MS> TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Sun May 23 03:55:56 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0E63DD1E3F8 for ; Sun, 23 May 2004 03:55:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06463-02 for ; Sun, 23 May 2004 03:55:32 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 7A28FD1EBD5 for ; Sun, 23 May 2004 03:05:14 -0300 (ADT) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by www.postgresql.com (Postfix) with ESMTP id 95148CF8AE0 for ; Sun, 23 May 2004 00:30:20 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id 0FAECBFC2 for ; Sat, 22 May 2004 21:28:46 -0600 (MDT) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00729-10 for ; Sat, 22 May 2004 21:28:45 -0600 (MDT) Received: from drivefaster.net (c-24-9-24-35.client.comcast.net [24.9.24.35]) by crestone.coronasolutions.com (Postfix) with ESMTP id 7CC4DBDD0 for ; Sat, 22 May 2004 21:28:45 -0600 (MDT) Message-ID: <40B01AD1.1050708@drivefaster.net> Date: Sat, 22 May 2004 21:30:25 -0600 From: Dan Harris User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org Subject: Re: tuning for AIX 5L with large memory References: <40AE8F78.2070901@drivefaster.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at drivefaster.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/196 X-Sequence-Number: 7027 Christopher Browne wrote: >We have a couple of these at work; they're nice and fast, although the >process of compiling things, well, "makes me feel a little unclean." > > > > Thanks very much for your detailed reply, Christopher. Would you mind elaborating on the "makes me feel a little unclean" statement? Also, I'm curious which models you are running and if you have any anecdotal comparisons for perfomance? I'm completely unfamiliar with AIX, so if there are dark corners that await me, I'd love to hear a little more so I can be prepared. I'm going out on a limb here and jumping to an unfamiliar architecture as well as OS, but the IO performance of these systems has convinced me that it's what I need to break out of my I/O limited x86 systems. I suppose when I do get it, I'll just experiment with different sizes of shared memory and run some benchmarks. For the price of these things, they better be some good marks! Thanks again -Dan Harris From pgsql-performance-owner@postgresql.org Mon May 24 13:51:36 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 868EFD1B19C for ; Mon, 24 May 2004 13:51:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14253-06 for ; Mon, 24 May 2004 13:51:14 -0300 (ADT) Received: from web13126.mail.yahoo.com (web13126.mail.yahoo.com [216.136.174.163]) by svr1.postgresql.org (Postfix) with SMTP id 22D47D1BC4D for ; Mon, 24 May 2004 13:51:12 -0300 (ADT) Message-ID: <20040524165112.72633.qmail@web13126.mail.yahoo.com> Received: from [63.78.248.48] by web13126.mail.yahoo.com via HTTP; Mon, 24 May 2004 09:51:12 PDT Date: Mon, 24 May 2004 09:51:12 -0700 (PDT) From: Litao Wu Subject: index's relpages after table analyzed To: pgsql-performance@postgresql.org In-Reply-To: <16535.1085177364@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/197 X-Sequence-Number: 7028 Hi, After a table analyzed a table, the table's relpages of pg_class gets updated, but not those of associated indexes, which can be updated by "vacuum analyze". Is this a feature or a bug? I have some tables and there are almost only inserts. So I do not care about the "dead tuples", but do care about the statistics. Does the above "future/bug" affect the performance? My PG version is 7.3.2. Thanks, __________________________________ Do you Yahoo!? Yahoo! Domains � Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer From pgsql-performance-owner@postgresql.org Mon May 24 14:21:18 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 477EED1B3CE for ; Mon, 24 May 2004 14:21:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 29036-03 for ; Mon, 24 May 2004 14:20:58 -0300 (ADT) Received: from web13123.mail.yahoo.com (web13123.mail.yahoo.com [216.136.174.141]) by svr1.postgresql.org (Postfix) with SMTP id ED2CCD1BAF5 for ; Mon, 24 May 2004 14:20:55 -0300 (ADT) Message-ID: <20040524172056.26507.qmail@web13123.mail.yahoo.com> Received: from [63.78.248.48] by web13123.mail.yahoo.com via HTTP; Mon, 24 May 2004 10:20:56 PDT Date: Mon, 24 May 2004 10:20:56 -0700 (PDT) From: Litao Wu Subject: Re: index's relpages after table analyzed To: Litao Wu , pgsql-performance@postgresql.org In-Reply-To: <20040524165112.72633.qmail@web13126.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/198 X-Sequence-Number: 7029 >From PG http://developer.postgresql.org/docs/postgres/diskusage.html: "(Remember, relpages is only updated by VACUUM and ANALYZE.)" --- Litao Wu wrote: > Hi, > > After a table analyzed a table, the table's relpages > > of pg_class gets updated, but not those of > associated > indexes, which can be updated by "vacuum analyze". > > Is this a feature or a bug? > > I have some tables and there are almost only > inserts. So I do not care about the "dead tuples", > but do care about the statistics. > > Does the above "future/bug" affect the performance? > > My PG version is 7.3.2. > > Thanks, > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Domains ?Claim yours for only $14.70/year > http://smallbusiness.promotions.yahoo.com/offer > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend __________________________________ Do you Yahoo!? Yahoo! Domains � Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer From pgsql-performance-owner@postgresql.org Mon May 24 16:05:36 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D1256D1B194 for ; Mon, 24 May 2004 16:05:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66614-07 for ; Mon, 24 May 2004 16:05:14 -0300 (ADT) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id D01EAD1B232 for ; Mon, 24 May 2004 16:05:11 -0300 (ADT) Received: from [64.81.245.111] (HELO 192.168.1.102) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 5185903; Mon, 24 May 2004 12:06:46 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Litao Wu , pgsql-performance@postgresql.org Subject: Re: index's relpages after table analyzed Date: Mon, 24 May 2004 12:05:26 -0700 User-Agent: KMail/1.5.4 References: <20040524165112.72633.qmail@web13126.mail.yahoo.com> In-Reply-To: <20040524165112.72633.qmail@web13126.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200405241205.26170.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=RCVD_NUMERIC_HELO X-Spam-Level: X-Archive-Number: 200405/199 X-Sequence-Number: 7030 Litao, > I have some tables and there are almost only > inserts. So I do not care about the "dead tuples", > but do care about the statistics. Then just run ANALYZE on those tables, and not VACUUM. ANALYZE ; > My PG version is 7.3.2. I would suggest upgrading to 7.3.6; the version you are using has several known bugs. -- -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon May 24 16:09:03 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id F0E3DD1BA9E for ; Mon, 24 May 2004 16:08:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 70032-04 for ; Mon, 24 May 2004 16:08:41 -0300 (ADT) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 701FBD1B18A for ; Mon, 24 May 2004 16:08:39 -0300 (ADT) Received: from [64.81.245.111] (HELO 192.168.1.102) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 5185921; Mon, 24 May 2004 12:10:12 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Bill Montgomery , pgsql-performance@postgresql.org Subject: Re: Avoiding vacuum full on an UPDATE-heavy table Date: Mon, 24 May 2004 12:08:50 -0700 User-Agent: KMail/1.5.4 References: <40AE274F.7020800@lulu.com> <54139.192.154.91.225.1085167360.squirrel@192.154.91.225> <40AE74BD.5050802@lulu.com> In-Reply-To: <40AE74BD.5050802@lulu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200405241208.50933.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=RCVD_NUMERIC_HELO X-Spam-Level: X-Archive-Number: 200405/200 X-Sequence-Number: 7031 Bill, > As a quick fix, since we're upgrading to 7.4.2 in a few weeks anyhow > (which includes pg_autovacuum), I've simply set up an hourly vacuum on > this table. It only takes ~4 seconds to execute when kept up on an > hourly basis. Is there any penalty to vacuuming too frequently, other > than the time wasted in an unnecessary vacuum operation? Nope, no penalty other than the I/O and CPU load while vacuuming. If you have a lot of transactions involving serial writes to many tables, sometimes you can get into a deadlock situation, which is annoying, but I wouldn't assume this to be a problem until it crops up. -- -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon May 24 16:48:27 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A6C7ED1B534 for ; Mon, 24 May 2004 16:48:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 85061-02 for ; Mon, 24 May 2004 16:48:04 -0300 (ADT) Received: from web13125.mail.yahoo.com (web13125.mail.yahoo.com [216.136.174.143]) by svr1.postgresql.org (Postfix) with SMTP id E1537D1B276 for ; Mon, 24 May 2004 16:48:01 -0300 (ADT) Message-ID: <20040524194803.8970.qmail@web13125.mail.yahoo.com> Received: from [63.78.248.48] by web13125.mail.yahoo.com via HTTP; Mon, 24 May 2004 12:48:03 PDT Date: Mon, 24 May 2004 12:48:03 -0700 (PDT) From: Litao Wu Subject: Re: index's relpages after table analyzed To: josh@agliodbs.com, pgsql-performance@postgresql.org In-Reply-To: <200405241205.26170.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/201 X-Sequence-Number: 7032 Hi Josh, I know that and that is what I am using now. The problem is I also need to know the relpages each indexe takes and "analyze" seems not update relpages though vacuum and vacuum analyze do. According to PG doc: "Remember, relpages is only updated by VACUUM and ANALYZE" My question is why relpages of indexes do not get updated after "analyze". Here is a quick test: create table test as select * from pg_class where 1=2; create index test_idx on test (relname); insert into test select * from pg_class; select relname, relpages from pg_class where relname in ('test', 'test_idx'); relname | relpages ----------+---------- test | 10 test_idx | 1 (2 rows) analyze test; select relname, relpages from pg_class where relname in ('test', 'test_idx'); relname | relpages ----------+---------- test | 27 test_idx | 1 (2 rows) -- Analyze only updates table's relpage, not index's! vacuum analyze test; select relname, relpages from pg_class where relname in ('test', 'test_idx'); relname | relpages ----------+---------- test | 27 test_idx | 22 (2 rows) -- "acuum analzye" updates both -- "vacuum" only also updates both Thank you for your help! --- Josh Berkus wrote: > Litao, > > > I have some tables and there are almost only > > inserts. So I do not care about the "dead tuples", > > but do care about the statistics. > > Then just run ANALYZE on those tables, and not > VACUUM. > ANALYZE ; > > > My PG version is 7.3.2. > > I would suggest upgrading to 7.3.6; the version you > are using has several > known bugs. > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ From pgsql-performance-owner@postgresql.org Mon May 24 19:52:23 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8E9F8D1BAC0 for ; Mon, 24 May 2004 19:52:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 50331-06 for ; Mon, 24 May 2004 19:52:04 -0300 (ADT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id BD8C1D1B1A9 for ; Mon, 24 May 2004 19:51:59 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.11.3/8.11.3) with ESMTP id i4OMq2910909 for ; Mon, 24 May 2004 16:52:03 -0600 (MDT) Message-ID: <40B27C92.9000109@outputservices.com> Date: Mon, 24 May 2004 16:52:02 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/202 X-Sequence-Number: 7033 > Hello Marty, > > MS> Is that a composite index? > > It is a regular btree index. What is a composite index? My apologies. A composite index is one that consists of multiple fields (aka multicolumn index). The reason I ask is that it was spending almost half the time just searching bv_bookgenres, which seemed odd. I may be speaking out of turn since I am not overly familiar with Pg's quirks and internals. A composite index, or any index of a large field, will lower the number of index items stored per btree node, thereby lowering the branching factor and increasing the tree depth. On tables with many rows, this can result in many more disk accesses for reading the index. An index btree that is 6 levels deep will require at least seven disk accesses (6 for the index, one for the table row) per row retrieved. Not knowing the structure of the indexes, it's hard to say too much about it. The fact that a 1993 row select from an indexed table took 3.5 seconds caused me to take notice. > MS> I would be curious to see how it performs with an "IN" clause, > MS> which I would suspect would go quite a bit fasrer. > > Actually it reached 20s before I canceled it... Here's the explain: I believe that. The code I posted had a nasty join bug. If my math is right, the query was trying to return 1993*1993, or just under 4 million rows. I didn't see the table structure, but I assume that the vote_avg and vote_count fields are in bv_bookgenres. If no fields are actually needed from bv_bookgenres, then the query might be constructed in a way that only the index would be read, without loading any row data. I think that you mentioned this was for a web app. Do you actually have a web page that displays 2000 rows of data? Good luck, Marty From pgsql-performance-owner@postgresql.org Mon May 24 22:23:00 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 52BACD1B215 for ; Mon, 24 May 2004 22:22:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 91001-04 for ; Mon, 24 May 2004 22:22:41 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E0F51D1B344 for ; Mon, 24 May 2004 22:22:36 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4P1McJP016104; Mon, 24 May 2004 21:22:38 -0400 (EDT) To: Litao Wu Cc: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: index's relpages after table analyzed In-reply-to: <20040524194803.8970.qmail@web13125.mail.yahoo.com> References: <20040524194803.8970.qmail@web13125.mail.yahoo.com> Comments: In-reply-to Litao Wu message dated "Mon, 24 May 2004 12:48:03 -0700" Date: Mon, 24 May 2004 21:22:38 -0400 Message-ID: <16103.1085448158@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/203 X-Sequence-Number: 7034 Litao Wu writes: > My question is why relpages of indexes > do not get updated after "analyze". It's an oversight, which just got fixed in CVS tip a few weeks ago. regards, tom lane From pgsql-performance-owner@postgresql.org Mon May 24 23:50:20 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 61C02D1BA9E for ; Mon, 24 May 2004 23:50:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14043-08 for ; Mon, 24 May 2004 23:49:52 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id B99C0D1B19F for ; Mon, 24 May 2004 23:49:47 -0300 (ADT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by www.postgresql.com (Postfix) with ESMTP id E19D5CF542D for ; Mon, 24 May 2004 23:48:27 -0300 (ADT) Received: from notnot (gateway.census.gov.ph [203.172.28.97]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id i4P2fMhv001672 for ; Tue, 25 May 2004 10:41:35 +0800 Message-Id: <200405250241.i4P2fMhv001672@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: Subject: Server process Date: Tue, 25 May 2004 10:54:46 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C44246.B6E5BD70" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcRCA6MiS+zrdTRGQlST2lDr1A7t/Q== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_70_80, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/204 X-Sequence-Number: 7035 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C44246.B6E5BD70 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, How can I automatically kill a process in the database (ex a select or explain) if it exceeds my limit of 2 or 3 mins .. For example : I have a query that already running for 3 or 4 mins I want to kill that process for a reason and return a Signal to the user. Thanks Michael ------=_NextPart_000_0000_01C44246.B6E5BD70 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

How can I automatically kill a process in the database (= ex a select or explain) if it exceeds my limit of 2 or 3 mins ..

 For example : I have a query that already running = for 3 or 4 mins I want to kill that process for a reason and return a

Signal to the user.

 

Thanks

Michael

------=_NextPart_000_0000_01C44246.B6E5BD70-- From pgsql-performance-owner@postgresql.org Tue May 25 00:01:15 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2A818D1CAFD for ; Tue, 25 May 2004 00:00:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 19456-05 for ; Tue, 25 May 2004 00:00:27 -0300 (ADT) Received: from houston.familyhealth.com.au (fhnet.arach.net.au [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id D0E42D1CCCF for ; Tue, 25 May 2004 00:00:18 -0300 (ADT) Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (8.12.9p1/8.12.9) with ESMTP id i4P2x8WL095333; Tue, 25 May 2004 10:59:08 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Message-ID: <40B2B801.9020201@familyhealth.com.au> Date: Tue, 25 May 2004 11:05:37 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Michael Ryan S. Puncia" Cc: pgsql-performance@postgresql.org Subject: Re: Server process References: <200405250241.i4P2fMhv001672@mail.census.gov.ph> In-Reply-To: <200405250241.i4P2fMhv001672@mail.census.gov.ph> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/205 X-Sequence-Number: 7036 Read the docs on going SET statement_timeout TO ...; Chris Michael Ryan S. Puncia wrote: > > > Hi, > > > > How can I automatically kill a process in the database (ex a select or > explain) if it exceeds my limit of 2 or 3 mins .. > > For example : I have a query that already running for 3 or 4 mins I > want to kill that process for a reason and return a > > Signal to the user. > > > > Thanks > > Michael > From pgsql-performance-owner@postgresql.org Tue May 25 12:38:14 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08430D1B8E8 for ; Tue, 25 May 2004 12:38:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 89271-04 for ; Tue, 25 May 2004 12:37:51 -0300 (ADT) Received: from mailservice.tudelft.nl (mailservice.tudelft.nl [130.161.131.5]) by svr1.postgresql.org (Postfix) with ESMTP id 9AF7FD1B175 for ; Tue, 25 May 2004 12:37:47 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by rav.antivirus (Postfix) with ESMTP id 7E09530F0; Tue, 25 May 2004 17:37:46 +0200 (MEST) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mx1.tudelft.nl (Postfix) with ESMTP id 9F70B30D3; Tue, 25 May 2004 17:37:45 +0200 (MEST) Received: from oli.tudelft.nl (oli219.office.oli.tudelft.nl [130.161.3.219]) by listserv.tudelft.nl (8.12.10/8.12.8) with ESMTP id i4PFbiF7020930; Tue, 25 May 2004 17:37:45 +0200 (MEST) Message-ID: <40B36848.1090403@oli.tudelft.nl> Date: Tue, 25 May 2004 17:37:44 +0200 From: Jochem van Dieten Organization: OnLine Internet User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vitaly Belman Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching References: <20792805375.20040521203337@012.net.il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at tudelft.nl X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/206 X-Sequence-Number: 7037 Vitaly Belman wrote: > > If you'll be so kind though, I'd be glad if you could spot anything to > speed up in this query. Here's the query and its plan that happens > without any caching: > > ------------------------------------------------------------------------------------------------------------- > QUERY > ----- > SELECT bv_books. * , > vote_avg, > vote_count > FROM bv_bookgenres, > bv_books > WHERE bv_books.book_id = bv_bookgenres.book_id AND > bv_bookgenres.genre_id = 5830 > ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; > > QUERY PLAN > ---------- > Limit (cost=2337.41..2337.43 rows=10 width=76) (actual time=7875.000..7875.000 rows=10 loops=1) > -> Sort (cost=2337.41..2337.94 rows=214 width=76) (actual time=7875.000..7875.000 rows=10 loops=1) > Sort Key: bv_books.vote_avg > -> Nested Loop (cost=0.00..2329.13 rows=214 width=76) (actual time=16.000..7844.000 rows=1993 loops=1) > -> Index Scan using i_bookgenres_genre_id on bv_bookgenres (cost=0.00..1681.54 rows=214 width=4) (actual time=16.000..3585.000 rows=1993 loops=1) > Index Cond: (genre_id = 5830) > -> Index Scan using bv_books_pkey on bv_books (cost=0.00..3.01 rows=1 width=76) (actual time=2.137..2.137 rows=1 loops=1993) > Index Cond: (bv_books.book_id = "outer".book_id) > Total runtime: 7875.000 ms Presuming that vote_avg is a field in the table bv_bookgenres, try a composite index on genre_id and vote_avg and then see if you can use the limit clause to reduce the number of loop iterations from 1993 to 10. CREATE INDEX test_idx ON bv_bookgenres (genre_id, vote_avg); The following query tries to force that execution lan and, presuming there is a foreign key relation between bv_books.book_id AND bv_bookgenres.book_id, I expect it will give the same results, but be carefull with NULL's: SELECT bv_books. * , vote_avg, vote_count FROM ( SELECT bg.* FROM bv_bookgenres bg WHERE bg.genre_id = 5830 ORDER BY bg.vote_avg DESC LIMIT 10 ) bv_bookgenres, bv_books WHERE bv_books.book_id = bv_bookgenres.book_id ORDER BY vote_avg DESC LIMIT 10; Jochem -- I don't get it immigrants don't work and steal our jobs - Loesje From pgsql-performance-owner@postgresql.org Fri May 28 20:57:00 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 47EC5D1B1B2 for ; Tue, 25 May 2004 15:38:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 60904-05 for ; Tue, 25 May 2004 15:38:03 -0300 (ADT) Received: from mproxy.gmail.com (mproxy.gmail.com [216.239.56.252]) by svr1.postgresql.org (Postfix) with SMTP id 4A476D1B49A for ; Tue, 25 May 2004 15:38:00 -0300 (ADT) Received: by mproxy.gmail.com with SMTP id r62so219755cwc for ; Tue, 25 May 2004 11:37:55 -0700 (PDT) Received: by 10.11.117.43 with SMTP id p43mr46934cwc; Tue, 25 May 2004 11:37:55 -0700 (PDT) Message-ID: Date: Tue, 25 May 2004 11:37:55 -0700 From: Josh Sacks To: pgsql-performance@postgresql.org Subject: Not using Primary Key in query Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/222 X-Sequence-Number: 7053 I can't understand what's going on in this simple query: select c.name from Candidate C where C.candidate_id in (select candidate_id from REFERRAL R where r.employee_id = 3000); Where Candidate.CANDIDATE_ID is the primary key for Candidate. Here's the EXPLAN ANALYZE: Seq Scan on candidate c (cost=100000000.00..100705078.06 rows=143282 width=18) (actual time=2320.01..2320.01 rows=0 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=2.42..2.42 rows=3 width=4) (actual time=0.00..0.00 rows=0 loops=286563) -> Index Scan using referral_employee_id_index on referral r (cost=0.00..2.42 rows=3 width=4) (actual time=0.48..0.48 rows=0 loops=1) Index Cond: (employee_id = 3000) It seems to be accurately estimating the number of rows returned by the sub-query (3), but then it thinks that 143282 rows are going to be returned by the main query, even though we are querying based on the PRIMARY KEY! To prove that in index query is possible, I tried: select c.name from Candidate C where C.candidate_id in (99, 22, 23123, 2344) which resulted in: Index Scan using candidate_id_index, candidate_id_index, candidate_id_index, candidate_id_index on candidate c (cost=0.00..17.52 rows=4 width=18) (actual time=24.437..29.088 rows=3 loops=1) Index Cond: ((candidate_id = 99) OR (candidate_id = 22) OR (candidate_id = 23123) OR (candidate_id = 2344)) Any ideas what's causing the query planner to make such a simple and drastic error? Thanks, Josh From pgsql-performance-owner@postgresql.org Tue May 25 16:53:13 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7C035D1C938 for ; Tue, 25 May 2004 16:53:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 87731-09 for ; Tue, 25 May 2004 16:52:53 -0300 (ADT) Received: from fep11.012.net.il (fep11.012.net.il [212.117.129.244]) by svr1.postgresql.org (Postfix) with ESMTP id 25D5DD1B349 for ; Tue, 25 May 2004 16:52:50 -0300 (ADT) Received: from [127.0.0.1] ([80.178.88.219]) by fep11.012.net.il with ESMTP id <20040525195049.KXGY19540.fep11@[80.178.88.219]>; Tue, 25 May 2004 22:50:49 +0300 Received: from [127.0.0.1] ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.50) sender ; 25 May 2004 22:53:05 +0300 Date: Tue, 25 May 2004 22:53:05 +0300 From: Vitaly Belman Reply-To: Vitaly Belman X-Priority: 3 (Normal) Message-ID: <1371146711781.20040525225305@012.net.il> To: Jochem van Dieten , Marty Scholes Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching In-Reply-To: <40B36848.1090403@oli.tudelft.nl> References: <20792805375.20040521203337@012.net.il> <40B36848.1090403@oli.tudelft.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200405/207 X-Sequence-Number: 7038 Hello Jochem and Marty, I guess I should have posted the table structure before =(: Table structure + Indexes ------------------------- CREATE TABLE public.bv_books ( book_id serial NOT NULL, book_title varchar(255) NOT NULL, series_id int4, series_index int2, annotation_desc_id int4, description_desc_id int4, book_picture varchar(255) NOT NULL, vote_avg float4 NOT NULL, vote_count int4 NOT NULL, CONSTRAINT bv_books_pkey PRIMARY KEY (book_id) ) WITH OIDS; CREATE INDEX i_books_vote_avg ON public.bv_books USING btree (vote_avg); CREATE INDEX i_books_vote_count ON public.bv_books USING btree (vote_count); ------------------------- CREATE TABLE public.bv_bookgenres ( book_id int4 NOT NULL, genre_id int4 NOT NULL, CONSTRAINT bv_bookgenres_pkey PRIMARY KEY (book_id, genre_id), CONSTRAINT fk_bookgenres_book_id FOREIGN KEY (book_id) REFERENCES public.bv_books (book_id) ON UPDATE RESTRICT ON DELETE RESTRICT ) WITH OIDS; CREATE INDEX i_bookgenres_book_id ON public.bv_bookgenres USING btree (book_id); CREATE INDEX i_bookgenres_genre_id ON public.bv_bookgenres USING btree (genre_id); ------------------------- MS> I didn't see the table structure, but I assume that the vote_avg and MS> vote_count fields are in bv_bookgenres. If no fields are actually MS> needed from bv_bookgenres, then the query might be constructed in a way MS> that only the index would be read, without loading any row data. I didn't understand you. vote_avg is stored in bv_books.. So yes, the only thing I need from bv_bookgenres is the id of the book, but I can't store this info in bv_books because there is N to N relationship between them - every book can belong to a number of genres... If that's what you meant. MS> I think that you mentioned this was for a web app. Do you actually have MS> a web page that displays 2000 rows of data? Well.. It is all "paginated", you can access 2000 items of the data (as there are actually 2000 books in the genre) but you only see 10 items at a time.. I mean, probably no one would go over the 2000 books, but I can't just hide them =\. JvD> Presuming that vote_avg is a field in the table bv_bookgenres, JvD> try a composite index on genre_id and vote_avg and then see if JvD> you can use the limit clause to reduce the number of loop JvD> iterations from 1993 to 10. I'm afraid your idea is invalid in my case =\... Naturally I could eventually do data coupling to gain perforemnce boost if this issue will not be solved in other ways. I'll keep your idea in mind anyway, thanks. Once again thanks for you feedback. Regards, Vitaly Belman ICQ: 1912453 AIM: VitalyB1984 MSN: tmdagent@hotmail.com Yahoo!: VitalyBe Tuesday, May 25, 2004, 6:37:44 PM, you wrote: JvD> Vitaly Belman wrote: >> >> If you'll be so kind though, I'd be glad if you could spot anything to >> speed up in this query. Here's the query and its plan that happens >> without any caching: >> >> ------------------------------------------------------------------------------------------------------------- >> QUERY >> ----- >> SELECT bv_books. * , >> vote_avg, >> vote_count >> FROM bv_bookgenres, >> bv_books >> WHERE bv_books.book_id = bv_bookgenres.book_id AND >> bv_bookgenres.genre_id = 5830 >> ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; >> >> QUERY PLAN >> ---------- >> Limit (cost=2337.41..2337.43 rows=10 width=76) (actual >> time=7875.000..7875.000 rows=10 loops=1) >> -> Sort (cost=2337.41..2337.94 rows=214 width=76) (actual >> time=7875.000..7875.000 rows=10 loops=1) >> Sort Key: bv_books.vote_avg >> -> Nested Loop (cost=0.00..2329.13 rows=214 width=76) >> (actual time=16.000..7844.000 rows=1993 loops=1) >> -> Index Scan using i_bookgenres_genre_id on >> bv_bookgenres (cost=0.00..1681.54 rows=214 width=4) (actual >> time=16.000..3585.000 rows=1993 loops=1) >> Index Cond: (genre_id = 5830) >> -> Index Scan using bv_books_pkey on bv_books >> (cost=0.00..3.01 rows=1 width=76) (actual time=2.137..2.137 rows=1 >> loops=1993) >> Index Cond: (bv_books.book_id = "outer".book_id) >> Total runtime: 7875.000 ms JvD> Presuming that vote_avg is a field in the table bv_bookgenres, JvD> try a composite index on genre_id and vote_avg and then see if JvD> you can use the limit clause to reduce the number of loop JvD> iterations from 1993 to 10. JvD> CREATE INDEX test_idx ON bv_bookgenres (genre_id, vote_avg); JvD> The following query tries to force that execution lan and, JvD> presuming there is a foreign key relation between JvD> bv_books.book_id AND bv_bookgenres.book_id, I expect it will give JvD> the same results, but be carefull with NULL's: JvD> SELECT bv_books. * , JvD> vote_avg, JvD> vote_count JvD> FROM ( JvD> SELECT bg.* JvD> FROM bv_bookgenres bg JvD> WHERE bg.genre_id = 5830 JvD> ORDER BY JvD> bg.vote_avg DESC JvD> LIMIT 10 JvD> ) bv_bookgenres, JvD> bv_books JvD> WHERE bv_books.book_id = bv_bookgenres.book_id JvD> ORDER BY JvD> vote_avg DESC JvD> LIMIT 10; JvD> Jochem From pgsql-performance-owner@postgresql.org Tue May 25 18:08:17 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7FA52D1B1B7 for ; Tue, 25 May 2004 18:08:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 13460-10 for ; Tue, 25 May 2004 18:07:56 -0300 (ADT) Received: from bramble.mmrd.com (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id BCD5ED1B16D for ; Tue, 25 May 2004 18:07:50 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id i4PJVU9U011143; Tue, 25 May 2004 15:31:31 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [10.225.10.110]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id i4PL7qN25938; Tue, 25 May 2004 17:07:52 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id LP85F9YC; Tue, 25 May 2004 17:07:49 -0400 Subject: Re: Interpreting vmstat From: Robert Treat To: Doug Y Cc: pgsql-performance@postgresql.org In-Reply-To: <6.0.1.1.2.20040518133210.01eb9ec0@mail.traderonline.com> References: <6.0.1.1.2.20040518133210.01eb9ec0@mail.traderonline.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 25 May 2004 17:07:51 -0400 Message-Id: <1085519271.9368.1916.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/208 X-Sequence-Number: 7039 On Tue, 2004-05-18 at 14:12, Doug Y wrote: > Run a query I've been having trouble with and watch the output of vmstat > (linux): > > $ vmstat 1 > procs memory swap io system > cpu > r b w swpd free buff cache si so bi bo in cs us > sy id > 0 0 0 148 8732 193652 > 2786668 0 0 0 0 292 151 0 2 98 > 2 0 2 148 7040 193652 > 2786668 0 0 0 208 459 697 45 10 45 > 0 0 0 148 9028 193652 > 2786684 0 0 16 644 318 613 25 4 71 > 1 0 0 148 5092 193676 > 2780196 0 0 12 184 441 491 37 5 58 > 0 1 0 148 5212 193684 > 2772512 0 0 112 9740 682 1063 45 12 43 > 1 0 0 148 5444 193684 > 2771584 0 0 120 4216 464 1303 44 3 52 > 1 0 0 148 12232 193660 > 2771620 0 0 244 628 340 681 43 20 38 > 1 0 0 148 12168 193664 > 2771832 0 0 196 552 332 956 42 2 56 > 1 0 0 148 12080 193664 > 2772248 0 0 272 204 371 201 40 1 59 > 1 1 0 148 12024 193664 > 2772624 0 0 368 0 259 127 42 3 55 > > Thats the first 10 lines or so... the query takes 60 seconds to run. > > I'm confused on the bo & bi parts of the io: > IO > bi: Blocks sent to a block device (blocks/s). > bo: Blocks received from a block device (blocks/s). > > yet it seems to be opposite of that... bi only increases when doing a > largish query, while bo also goes up, I typically see periodic bo numbers > in the low 100's, which I'd guess are log writes. > > I would think that my entire DB should end up cached since a raw pg_dump > file is about 1G in size, yet my performance doesn't indicate that that is > the case... running the same query a few minutes later, I'm not seeing a > significant performance improvement. > Been meaning to try and address this thread since it touches on one of the areas that I think is sorely lacking in the postgresql admin knowledge base; how to use various unix commands to deduce performance information. This would seem even more important given that PostgreSQL admins are expected to use said tools to find out some information that the commercial databases provide to there users... but alas this is -performance and not -advocacy so let me get on with it eh? As you noted, bi and bo are actually reversed, and I believe if you search the kernel hackers mailing lists you'll find references to this... here's some more empirical evidence though, the following vmstat was taken from a high-write traffic monitoring type database application... procs memory swap io system cpu r b w swpd free buff cache si so bi bo in cs us sy id 1 0 0 27412 593336 112036 1865936 0 1 0 1 1 0 1 0 0 5 1 1 27412 593336 112036 1865952 0 0 0 477 600 1346 53 7 40 4 0 0 27412 593336 112036 1865960 0 0 0 1296 731 2087 47 5 48 3 3 2 27412 594408 112052 1865972 4 0 4 2973 904 2957 32 20 48 3 1 1 26596 594544 112068 1865976 64 0 64 1433 770 2766 41 22 37 1 1 1 26596 594544 112072 1866004 0 0 5 959 702 1687 50 10 41 3 1 1 26596 594512 112072 1866024 0 0 0 1155 731 2209 52 12 37 2 0 0 26596 594512 112072 1866040 0 0 0 635 511 1293 48 5 46 0 1 1 26596 594472 112076 1866076 0 0 7 739 551 1248 49 8 43 1 0 0 26596 594472 112076 1866088 0 0 0 1048 598 1295 49 8 43 2 0 0 26596 594208 112084 1866696 0 0 203 1253 686 1506 42 16 41 1 0 0 26596 593920 112084 1866716 0 0 0 1184 599 1329 39 12 49 0 1 1 26596 593060 112084 1866740 0 0 3 1036 613 3442 48 8 44 0 1 2 26596 592920 112084 1866752 0 0 0 3825 836 1323 9 14 76 0 0 0 26596 593544 112084 1866788 0 0 0 1064 625 1197 9 15 76 0 1 1 26596 596300 112088 1866808 0 0 0 747 625 1558 7 13 79 0 0 1 26596 599600 112100 1866892 0 0 0 468 489 1331 6 4 91 0 0 0 26596 599600 112100 1866896 0 0 0 237 418 997 5 4 91 0 1 1 26596 599600 112104 1866896 0 0 0 1063 582 1371 7 7 86 0 0 0 26596 599612 112104 1866904 0 0 0 561 648 1556 6 4 89 notice all the bo as it continually writes data to disk. Also notice how generally speaking it has no bi since it does not have to pull data up from disk... you will notice that the couple of times it grabs information from swap space, you'll also find a corresponding pull on the io. getting back to your issue in order to determine if there is a problem in this case, you need to run explain analyze a few times repeatedly, take the relative score given by these runs, and then come back 5-10 minutes later and run explain analyze again and see if the results are drastically different. troll vmstat while you do this to see if there is bi occurring. I probably should mention that just because you see activity on bi doesn't mean that you'll notice any difference in performance against running the query with no bi, it's dependent on a number of factors really. Oh, and as the other poster alluded to, knock down your shared buffers by about 50% and see where that gets you. I might also knock *up* your effective cache size... try doubling that and see how things go. Hope this helps... and others jump in with corrections if needed. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Tue May 25 19:32:29 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6459AD1B19C for ; Tue, 25 May 2004 19:32:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 49303-06 for ; Tue, 25 May 2004 19:32:06 -0300 (ADT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 75C66D1B175 for ; Tue, 25 May 2004 19:31:58 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.11.3/8.11.3) with ESMTP id i4PMOJ901032; Tue, 25 May 2004 16:24:24 -0600 (MDT) Message-ID: <40B3C792.3020106@outputservices.com> Date: Tue, 25 May 2004 16:24:18 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vitaly Belman Cc: Jochem van Dieten , pgsql-performance@postgresql.org, Marty Scholes Subject: Re: PostgreSQL caching References: <20792805375.20040521203337@012.net.il> <40B36848.1090403@oli.tudelft.nl> <1371146711781.20040525225305@012.net.il> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/209 X-Sequence-Number: 7040 Vitaly, This looks like there might be some room for performance improvement... > MS> I didn't see the table structure, but I assume > MS> that the vote_avg and > MS> vote_count fields are in bv_bookgenres. > > I didn't understand you. vote_avg is stored in bv_books. Ok. That helps. The confusion (on my end) came from the SELECT clause of the query you provided: > SELECT bv_books. * , > vote_avg, > vote_count All fields from bv_books were selected (bv_books.*) along with vote_agv and vote_count. My assumption was that vote_avg and vote_count were therefore not in bv_books. At any rate, a query with an IN clause should help quite a bit: SELECT bv_books. * FROM bv_books WHERE bv_books.book_id IN ( SELECT book_id FROM bv_genres WHERE bv_bookgenres.genre_id = 5830 ) ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; Give it a whirl. Marty From pgsql-performance-owner@postgresql.org Wed May 26 10:14:54 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1E07ED1BA8F for ; Wed, 26 May 2004 10:14:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 53317-07 for ; Wed, 26 May 2004 10:14:31 -0300 (ADT) Received: from bramble.mmrd.com (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id 78ABBD1B23F for ; Wed, 26 May 2004 10:14:26 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id i4QBbr9U013418; Wed, 26 May 2004 07:37:54 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [10.225.10.110]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id i4QDDxN13289; Wed, 26 May 2004 09:14:00 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id LP85GDKP; Wed, 26 May 2004 09:13:58 -0400 Subject: Re: PostgreSQL caching From: Robert Treat To: Vitaly Belman Cc: Jochem van Dieten , Marty Scholes , pgsql-performance@postgresql.org In-Reply-To: <1371146711781.20040525225305@012.net.il> References: <20792805375.20040521203337@012.net.il> <40B36848.1090403@oli.tudelft.nl> <1371146711781.20040525225305@012.net.il> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 26 May 2004 09:13:58 -0400 Message-Id: <1085577239.29461.1927.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/210 X-Sequence-Number: 7041 On Tue, 2004-05-25 at 15:53, Vitaly Belman wrote: > >> > >> QUERY PLAN > >> ---------- > >> Limit (cost=2337.41..2337.43 rows=10 width=76) (actual > >> time=7875.000..7875.000 rows=10 loops=1) > >> -> Sort (cost=2337.41..2337.94 rows=214 width=76) (actual > >> time=7875.000..7875.000 rows=10 loops=1) > >> Sort Key: bv_books.vote_avg > >> -> Nested Loop (cost=0.00..2329.13 rows=214 width=76) > >> (actual time=16.000..7844.000 rows=1993 loops=1) > >> -> Index Scan using i_bookgenres_genre_id on > >> bv_bookgenres (cost=0.00..1681.54 rows=214 width=4) (actual > >> time=16.000..3585.000 rows=1993 loops=1) > >> Index Cond: (genre_id = 5830) > >> -> Index Scan using bv_books_pkey on bv_books > >> (cost=0.00..3.01 rows=1 width=76) (actual time=2.137..2.137 rows=1 > >> loops=1993) > >> Index Cond: (bv_books.book_id = "outer".book_id) > >> Total runtime: 7875.000 ms > A question and two experiments... what version of postgresql is this? Try reindexing i_bookgenres_genre_id and capture the explain analyze for that. If it doesn't help try doing set enable_indexscan = false and capture the explain analyze for that. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Wed May 26 10:29:29 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id F2AA2D1B176 for ; Wed, 26 May 2004 10:29:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63156-06 for ; Wed, 26 May 2004 10:29:09 -0300 (ADT) Received: from bramble.mmrd.com (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id 79938D1B459 for ; Wed, 26 May 2004 10:29:05 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id i4QBqv9U013566; Wed, 26 May 2004 07:52:57 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [10.225.10.110]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id i4QDT9N13746; Wed, 26 May 2004 09:29:09 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id LP85GD3D; Wed, 26 May 2004 09:29:06 -0400 Subject: Re: where to find out when a table was last analyzed? From: Robert Treat To: Litao Wu Cc: pgsql-performance@postgresql.org In-Reply-To: <20040518211321.23032.qmail@web13121.mail.yahoo.com> References: <20040518211321.23032.qmail@web13121.mail.yahoo.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 26 May 2004 09:29:06 -0400 Message-Id: <1085578147.9127.1933.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/211 X-Sequence-Number: 7042 On Tue, 2004-05-18 at 17:13, Litao Wu wrote: > All, > > Does PG store when a table was last analyzed? > > Thanks, > no. you can do something like select attname,s.* from pg_statistic s, pg_attribute a, pg_class c where starelid = c.oid and attrelid = c.oid and staattnum = attnum and relname = 'mytable' to see the current statistics on the table, but its not timestamped. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Wed May 26 11:33:21 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D938CD1B3C7 for ; Wed, 26 May 2004 11:33:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 92091-01 for ; Wed, 26 May 2004 11:32:57 -0300 (ADT) Received: from fep11.012.net.il (fep11.012.net.il [212.117.129.244]) by svr1.postgresql.org (Postfix) with ESMTP id 74BBBD1B193 for ; Wed, 26 May 2004 11:32:51 -0300 (ADT) Received: from [127.0.0.1] ([80.178.88.219]) by fep11.012.net.il with ESMTP id <20040526143052.GORZ29697.fep11@[80.178.88.219]>; Wed, 26 May 2004 17:30:52 +0300 Received: from [127.0.0.1] ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.50) sender ; 26 May 2004 17:33:57 +0300 Date: Wed, 26 May 2004 17:33:56 +0300 From: Vitaly Belman Reply-To: Vitaly Belman X-Priority: 3 (Normal) Message-ID: <1673440625.20040526173356@012.net.il> To: Marty Scholes , Robert Treat , Nick Barr Cc: Jochem van Dieten , pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching In-Reply-To: <40B3C792.3020106@outputservices.com> References: <20792805375.20040521203337@012.net.il> <40B36848.1090403@oli.tudelft.nl> <1371146711781.20040525225305@012.net.il> <40B3C792.3020106@outputservices.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200405/212 X-Sequence-Number: 7043 Hello Marty, Nick and Robert, NB> Depending on what version of PG you are running, IN might take a while NB> to complete. If so try an EXISTS instead RT> A question and two experiments... what version of postgresql is this? I am using the newer 7.5dev native Windows port. For this reason I don't think that IN will cause any trouble (I read that this issue was resolved in 7.4). MS> At any rate, a query with an IN clause should help quite a bit MS> SELECT bv_books. * MS> FROM bv_books MS> WHERE bv_books.book_id IN ( MS> SELECT book_id MS> FROM bv_genres MS> WHERE bv_bookgenres.genre_id = 5830 MS> ) MS> ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; It looks like it helps a bit (though you meant "FROM bv_bookgenres", right?). I can't tell you how MUCH it helped though, because of two reasons: 1) As soon as I run a query, it is cached in the memory and I can't really find a good way to flush it out of there to test again except a full computer reset (shutting postmaster down doesn't help). If you have a better idea on this, do tell me =\ (Reminding again, I am on Windows). 2) I *think* I resolved this issue, at least for most of the genre_ids (didn't go through them all, but tried a few with different book count and the results looked quite good). The fault was partly mine, a few weeks ago I increase the statistics for the genre_id column a bit too much (from 10 to 70), I was unsure how exactly it works (and still am) but it helped for a few genre_ids that had a high book count, yet it also hurt the performence for the genres without as much ids. I now halved the stastics (to 58) and almost everything looks good now. Because of that I'll stop working on that query for a while (unless you have some more performance tips on the subject). Big thanks to everyone who helped.. And I might bring this issue later again, it it still will cause too much troubles. RT> Try reindexing i_bookgenres_genre_id and capture the explain RT> analyze for that. Is that's what you meant "REINDEX INDEX i_bookgenres_genre_id"? But it returns no messages what-so-ever =\. I can EXPLAIN it either. RT> If it doesn't help try doing set enable_indexscan = false and RT> capture the explain analyze for that. Here it is: ------------------------------------------------------------------------------------------------------------------------------------------ QUERY PLAN Limit (cost=41099.93..41099.96 rows=10 width=76) (actual time=6734.000..6734.000 rows=10 loops=1) -> Sort (cost=41099.93..41100.45 rows=208 width=76) (actual time=6734.000..6734.000 rows=10 loops=1) Sort Key: bv_books.vote_count -> Merge Join (cost=40229.21..41091.92 rows=208 width=76) (actual time=6078.000..6593.000 rows=1993 loops=1) Merge Cond: ("outer".book_id = "inner".book_id) -> Sort (cost=16817.97..16818.49 rows=208 width=4) (actual time=1062.000..1062.000 rows=1993 loops=1) Sort Key: bv_bookgenres.book_id -> Seq Scan on bv_bookgenres (cost=0.00..16809.96 rows=208 width=4) (actual time=0.000..1047.000 rows=1993 loops=1) Filter: (genre_id = 5830) -> Sort (cost=23411.24..23841.04 rows=171918 width=76) (actual time=5016.000..5189.000 rows=171801 loops=1) Sort Key: bv_books.book_id -> Seq Scan on bv_books (cost=0.00..4048.18 rows=171918 width=76) (actual time=0.000..359.000 rows=171918 loops=1) Total runtime: 6734.000 ms ------------------------------------------------------------------------------------------------------------------------------------------ Regards, Vitaly Belman ICQ: 1912453 AIM: VitalyB1984 MSN: tmdagent@hotmail.com Yahoo!: VitalyBe Wednesday, May 26, 2004, 1:24:18 AM, you wrote: MS> Vitaly, MS> This looks like there might be some room for performance improvement... >> MS> I didn't see the table structure, but I assume >> MS> that the vote_avg and >> MS> vote_count fields are in bv_bookgenres. >> >> I didn't understand you. vote_avg is stored in bv_books. MS> Ok. That helps. The confusion (on my end) came from the SELECT clause MS> of the query you provided: >> SELECT bv_books. * , >> vote_avg, >> vote_count MS> All fields from bv_books were selected (bv_books.*) along with vote_agv MS> and vote_count. My assumption was that vote_avg and vote_count were MS> therefore not in bv_books. MS> At any rate, a query with an IN clause should help quite a bit: MS> SELECT bv_books. * MS> FROM bv_books MS> WHERE bv_books.book_id IN ( MS> SELECT book_id MS> FROM bv_genres MS> WHERE bv_bookgenres.genre_id = 5830 MS> ) MS> ORDER BY vote_avg DESC LIMIT 10 OFFSET 0; MS> Give it a whirl. MS> Marty MS> ---------------------------(end of MS> broadcast)--------------------------- MS> TIP 6: Have you searched our list archives? MS> http://archives.postgresql.org From pgsql-general-owner@postgresql.org Wed May 26 12:34:55 2004 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E5437D1CF36 for ; Wed, 26 May 2004 12:34:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 24392-02 for ; Wed, 26 May 2004 12:34:28 -0300 (ADT) Received: from localhost.localdomain (unknown [200.35.66.77]) by svr1.postgresql.org (Postfix) with ESMTP id D9F58D1D07F for ; Wed, 26 May 2004 12:29:15 -0300 (ADT) Received: from localhost.localdomain (FWVasa [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i4QFQUrZ025993 for ; Wed, 26 May 2004 11:26:30 -0400 Received: (from apache@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id i4QFQUi6025991; Wed, 26 May 2004 11:26:30 -0400 X-Authentication-Warning: localhost.localdomain: apache set sender to mario_soto@venezolanadeavaluos.com using -f Received: from 200.35.66.77 (proxying for 192.168.0.100) (SquirrelMail authenticated user mario_soto) by mail.venezolanadeavaluos.com with HTTP; Wed, 26 May 2004 11:26:30 -0400 (VET) Message-ID: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> Date: Wed, 26 May 2004 11:26:30 -0400 (VET) Subject: performance very slow From: "Mario Soto" To: X-Priority: 1 Importance: High X-Mailer: SquirrelMail (version 1.2.10) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.6 tagged_above=0.0 required=5.0 tests=LINES_OF_YELLING, LINES_OF_YELLING_2, X_PRIORITY_HIGH X-Spam-Level: X-Archive-Number: 200405/791 X-Sequence-Number: 61225 Hi. i hava a postresql 7.4.2 in a production server. tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. The postresql.conf say: #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #--------------------------------------------------------------------------- # - Memory - shared_buffers = 1000 # min 16, at least max_connections*2, 8KB each sort_mem = 1024 # min 64, size in KB vacuum_mem = 8192 # min 1024, size in KB # - Free Space Map - max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each max_fsm_relations = 1000 # min 100, ~50 bytes each # - Kernel Resource Usage - max_files_per_process = 1000 # min 25 #preload_libraries = '' #--------------------------------------------------------------------------- # WRITE AHEAD LOG #--------------------------------------------------------------------------- # - Settings - fsync = true # turns forced synchronization on or off wal_sync_method = fsync # the default varies across platforms: # fsync, fdatasync, open_sync, or open_datasync wal_buffers = 8 # min 4, 8KB each # - Checkpoints - checkpoint_segments = 3 # in logfile segments, min 1, 16MB each checkpoint_timeout = 300 # range 30-3600, in seconds checkpoint_warning = 30 # 0 is off, in seconds commit_delay = 0 # range 0-100000, in microseconds commit_siblings = 5 # range 1-1000 #--------------------------------------------------------------------------- # QUERY TUNING #--------------------------------------------------------------------------- # - Planner Method Enabling - enable_hashagg = true enable_hashjoin = true enable_indexscan = true enable_mergejoin = true enable_nestloop = true enable_seqscan = true enable_sort = true enable_tidscan = true # - Planner Cost Constants - effective_cache_size = 1000 # typically 8KB each 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 = true geqo_threshold = 11 geqo_effort = 1 geqo_generations = 0 geqo_pool_size = 0 # default based on tables in statement, # range 128-1024 geqo_selection_bias = 2.0 # range 1.5-2.0 # - Other Planner Options - default_statistics_target = 100 # range 1-1000 from_collapse_limit = 30 join_collapse_limit = 30 # 1 disables collapsing of explicit JOINs #--------------------------------------------------------------------------- # ERROR REPORTING AND LOGGING #--------------------------------------------------------------------------- # - Syslog - #syslog = 0 # range 0-2; 0=stdout; 1=both; 2=syslog #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' # - When to Log - #client_min_messages = notice # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # log, info, notice, warning, error #log_min_messages = notice # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, log, fatal, # panic #log_error_verbosity = default # terse, default, or verbose messages #log_min_error_statement = panic # Values in order of increasing severity: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) #log_min_duration_statement = -1 # Log all statements whose # execution time exceeds the value, in # milliseconds. Zero prints all queries. # Minus-one disables. #silent_mode = false # DO NOT USE without Syslog! # - What to Log - debug_print_parse = true debug_print_rewritten = true debug_print_plan = true debug_pretty_print = true log_connections = true log_duration = true log_pid = true log_statement = true log_timestamp = true log_hostname = true log_source_port = true #--------------------------------------------------------------------------- # RUNTIME STATISTICS #--------------------------------------------------------------------------- # - Statistics Monitoring - log_parser_stats = true log_planner_stats = true log_executor_stats = true #log_statement_stats = true # - Query/Index Statistics Collector - stats_start_collector = true stats_command_string = true stats_block_level = true stats_row_level = true stats_reset_on_server_start = true #--------------------------------------------------------------------------- # CLIENT CONNECTION DEFAULTS #--------------------------------------------------------------------------- # - Statement Behavior - #search_path = '$user,public' # schema names #check_function_bodies = true #default_transaction_isolation = 'read committed' #default_transaction_read_only = false #statement_timeout = 0 # 0 is disabled, in milliseconds # - Locale and Formatting - #datestyle = 'iso, mdy' #timezone = unknown # actually, defaults to TZ environment setting #australian_timezones = false #extra_float_digits = 0 # min -15, max 2 #client_encoding = sql_ascii # actually, defaults to database encoding # These settings are initialized by initdb -- they may be changed lc_messages = 'es_VE.UTF-8' # locale for system error message strings lc_monetary = 'es_VE.UTF-8' # locale for monetary formatting lc_numeric = 'es_VE.UTF-8' # locale for number formatting lc_time = 'es_VE.UTF-8' # locale for time formatting # - Other Defaults - explain_pretty_print = true #dynamic_library_path = '$libdir' #max_expr_depth = 10000 # min 10 #--------------------------------------------------------------------------- # LOCK MANAGEMENT #--------------------------------------------------------------------------- #deadlock_timeout = 1000 # in milliseconds #max_locks_per_transaction = 64 # min 10, ~260*max_connections bytes each #--------------------------------------------------------------------------- # VERSION/PLATFORM COMPATIBILITY #--------------------------------------------------------------------------- # - Previous Postgres Versions - #add_missing_from = true #regex_flavor = advanced # advanced, extended, or basic #sql_inheritance = true # - Other Platforms & Clients - #transform_null_equals = false BUT THE PERFORMANCE IT�S VERY SLOW what can do ????? Thank Mario Soto From pgsql-performance-owner@postgresql.org Wed May 26 13:18:44 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 74A74D1B1B2 for ; Wed, 26 May 2004 13:18:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42109-05 for ; Wed, 26 May 2004 13:18:21 -0300 (ADT) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 228B6D1B193 for ; Wed, 26 May 2004 13:18:20 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 5203961; Wed, 26 May 2004 09:19:53 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Vitaly Belman Subject: Re: PostgreSQL caching Date: Wed, 26 May 2004 09:17:35 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-performance@postgresql.org References: <20792805375.20040521203337@012.net.il> <40B3C792.3020106@outputservices.com> <1673440625.20040526173356@012.net.il> In-Reply-To: <1673440625.20040526173356@012.net.il> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200405260917.35537.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/213 X-Sequence-Number: 7044 Vitaly, > I am using the newer 7.5dev native Windows port. For this reason I > don't think that IN will cause any trouble (I read that this issue was > resolved in 7.4). Well, for performance, all bets are off for the dev Windows port. Last I checked, the Win32 team was still working on *stability* and hadn't yet even looked at performance. Not that you can't improve the query, just that it might not fix the problem. Therefore ... your detailed feedback is appreciated, especially if you can compare stuff to the same database running on a Linux, Unix, or BSD machine. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed May 26 13:26:19 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 54C34D1B1BD for ; Wed, 26 May 2004 13:26:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 45285-06 for ; Wed, 26 May 2004 13:25:52 -0300 (ADT) Received: from snowwhite.lulu.com (stymie.lulu.com [66.193.5.50]) by svr1.postgresql.org (Postfix) with ESMTP id 8CDEDD1B1B8 for ; Wed, 26 May 2004 13:25:50 -0300 (ADT) Received: from lulu.com (meatwad.rdu.lulu.com [10.0.0.32]) (authenticated) by snowwhite.lulu.com (8.11.6/8.11.6) with ESMTP id i4QGPhn06790; Wed, 26 May 2004 12:25:43 -0400 Message-ID: <40B4C509.4000902@lulu.com> Date: Wed, 26 May 2004 12:25:45 -0400 From: Bill Montgomery User-Agent: Mozilla Thunderbird 0.5 (X11/20040210) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mario Soto , pgsql-performance@postgresql.org Subject: Re: [GENERAL] performance very slow References: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> In-Reply-To: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/214 X-Sequence-Number: 7045 Mario Soto wrote: >Hi. i hava a postresql 7.4.2 in a production server. > >tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. > > Mario, Start with reading this: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html Without knowing anything about the size of your database, your usage patterns, or your disk subsystem (the most important part of a database server, imho) I would suggest you first increase the number of shared_buffers allocated to Postgres. Most recommend keeping this number below 10000, but I've found I get the best performance with about 24000 shared_buffers with a ~5GB database on a machine with 4GB of ram, dedicated to Postgres. You'll have to experiment to see what works best for you. Also, make sure you VACUUM and ANALYZE on a regular basis. Again, the frequency of this really depends on your data and usage patterns. More frequent write operations require more frequent vacuuming. Good luck. Best Regards, Bill Montgomery >The postresql.conf say: > >#--------------------------------------------------------------------------- ># RESOURCE USAGE (except WAL) >#--------------------------------------------------------------------------- > ># - Memory - > >shared_buffers = 1000 # min 16, at least max_connections*2, 8KB >each >sort_mem = 1024 # min 64, size in KB >vacuum_mem = 8192 # min 1024, size in KB > ># - Free Space Map - > >max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each >max_fsm_relations = 1000 # min 100, ~50 bytes each > ># - Kernel Resource Usage - > >max_files_per_process = 1000 # min 25 >#preload_libraries = '' > > >#--------------------------------------------------------------------------- ># WRITE AHEAD LOG >#--------------------------------------------------------------------------- > ># - Settings - > >fsync = true # turns forced synchronization on or off >wal_sync_method = fsync # the default varies across platforms: > # fsync, fdatasync, open_sync, or >open_datasync >wal_buffers = 8 # min 4, 8KB each > ># - Checkpoints - > >checkpoint_segments = 3 # in logfile segments, min 1, 16MB each >checkpoint_timeout = 300 # range 30-3600, in seconds >checkpoint_warning = 30 # 0 is off, in seconds >commit_delay = 0 # range 0-100000, in microseconds >commit_siblings = 5 # range 1-1000 > >#--------------------------------------------------------------------------- ># QUERY TUNING >#--------------------------------------------------------------------------- > ># - Planner Method Enabling - > >enable_hashagg = true >enable_hashjoin = true >enable_indexscan = true >enable_mergejoin = true >enable_nestloop = true >enable_seqscan = true >enable_sort = true >enable_tidscan = true > ># - Planner Cost Constants - > >effective_cache_size = 1000 # typically 8KB each >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 = true >geqo_threshold = 11 >geqo_effort = 1 >geqo_generations = 0 >geqo_pool_size = 0 # default based on tables in statement, > # range 128-1024 >geqo_selection_bias = 2.0 # range 1.5-2.0 > ># - Other Planner Options - > >default_statistics_target = 100 # range 1-1000 >from_collapse_limit = 30 >join_collapse_limit = 30 # 1 disables collapsing of explicit JOINs > > >#--------------------------------------------------------------------------- ># ERROR REPORTING AND LOGGING >#--------------------------------------------------------------------------- > ># - Syslog - > >#syslog = 0 # range 0-2; 0=stdout; 1=both; 2=syslog >#syslog_facility = 'LOCAL0' >#syslog_ident = 'postgres' > ># - When to Log - > >#client_min_messages = notice # Values, in order of decreasing detail: > # debug5, debug4, debug3, debug2, debug1, > # log, info, notice, warning, error > >#log_min_messages = notice # Values, in order of decreasing detail: > # debug5, debug4, debug3, debug2, debug1, > # info, notice, warning, error, log, fatal, > # panic > >#log_error_verbosity = default # terse, default, or verbose messages > >#log_min_error_statement = panic # Values in order of increasing severity: > # debug5, debug4, debug3, debug2, debug1, > # info, notice, warning, error, panic(off) > >#log_min_duration_statement = -1 # Log all statements whose > # execution time exceeds the value, in > # milliseconds. Zero prints all queries. > # Minus-one disables. > >#silent_mode = false # DO NOT USE without Syslog! > ># - What to Log - > > > >debug_print_parse = true >debug_print_rewritten = true >debug_print_plan = true >debug_pretty_print = true >log_connections = true >log_duration = true >log_pid = true >log_statement = true >log_timestamp = true >log_hostname = true >log_source_port = true > > >#--------------------------------------------------------------------------- ># RUNTIME STATISTICS >#--------------------------------------------------------------------------- > ># - Statistics Monitoring - > >log_parser_stats = true >log_planner_stats = true >log_executor_stats = true >#log_statement_stats = true > ># - Query/Index Statistics Collector - > >stats_start_collector = true >stats_command_string = true >stats_block_level = true >stats_row_level = true >stats_reset_on_server_start = true > > >#--------------------------------------------------------------------------- ># CLIENT CONNECTION DEFAULTS >#--------------------------------------------------------------------------- > ># - Statement Behavior - > >#search_path = '$user,public' # schema names >#check_function_bodies = true >#default_transaction_isolation = 'read committed' >#default_transaction_read_only = false >#statement_timeout = 0 # 0 is disabled, in milliseconds > ># - Locale and Formatting - > >#datestyle = 'iso, mdy' >#timezone = unknown # actually, defaults to TZ environment >setting >#australian_timezones = false >#extra_float_digits = 0 # min -15, max 2 >#client_encoding = sql_ascii # actually, defaults to database encoding > ># These settings are initialized by initdb -- they may be changed >lc_messages = 'es_VE.UTF-8' # locale for system error message >strings >lc_monetary = 'es_VE.UTF-8' # locale for monetary formatting >lc_numeric = 'es_VE.UTF-8' # locale for number formatting >lc_time = 'es_VE.UTF-8' # locale for time formatting > ># - Other Defaults - > >explain_pretty_print = true >#dynamic_library_path = '$libdir' >#max_expr_depth = 10000 # min 10 > > >#--------------------------------------------------------------------------- ># LOCK MANAGEMENT >#--------------------------------------------------------------------------- > >#deadlock_timeout = 1000 # in milliseconds >#max_locks_per_transaction = 64 # min 10, ~260*max_connections bytes each > > >#--------------------------------------------------------------------------- ># VERSION/PLATFORM COMPATIBILITY >#--------------------------------------------------------------------------- > ># - Previous Postgres Versions - > >#add_missing_from = true >#regex_flavor = advanced # advanced, extended, or basic >#sql_inheritance = true > ># - Other Platforms & Clients - > >#transform_null_equals = false > > > >BUT THE PERFORMANCE IT�S VERY SLOW > >what can do ????? > >Thank > > >Mario Soto > > > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > From pgsql-performance-owner@postgresql.org Fri May 28 20:56:44 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 813A5D1B16F for ; Wed, 26 May 2004 13:39:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 47746-09 for ; Wed, 26 May 2004 13:39:09 -0300 (ADT) Received: from localhost.localdomain (unknown [200.35.66.77]) by svr1.postgresql.org (Postfix) with ESMTP id B9768D1B189 for ; Wed, 26 May 2004 13:39:07 -0300 (ADT) Received: from localhost.localdomain (FWVasa [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i4QGZvrZ026141; Wed, 26 May 2004 12:36:16 -0400 Received: (from apache@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id i4QGZvJZ026139; Wed, 26 May 2004 12:35:57 -0400 X-Authentication-Warning: localhost.localdomain: apache set sender to mario_soto@venezolanadeavaluos.com using -f Received: from 200.35.66.77 (proxying for 192.168.0.100) (SquirrelMail authenticated user mario_soto) by mail.venezolanadeavaluos.com with HTTP; Wed, 26 May 2004 12:35:57 -0400 (VET) Message-ID: <38009.200.35.66.77.1085589357.squirrel@mail.venezolanadeavaluos.com> Date: Wed, 26 May 2004 12:35:57 -0400 (VET) Subject: Re: [GENERAL] performance very slow From: "Mario Soto" To: In-Reply-To: <40B4C509.4000902@lulu.com> References: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> <40B4C509.4000902@lulu.com> X-Priority: 3 Importance: Normal Cc: X-Mailer: SquirrelMail (version 1.2.10) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/221 X-Sequence-Number: 7052 OK. Thank fou your help. In this moment the size of database its 2GB. And the machine it�s only to postgresql. Gracias > Mario Soto wrote: > >>Hi. i hava a postresql 7.4.2 in a production server. >> >>tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. >> >> > Mario, > > Start with reading this: > > http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > > Without knowing anything about the size of your database, your usage > patterns, or your disk subsystem (the most important part of a database > server, imho) I would suggest you first increase the number of > shared_buffers allocated to Postgres. Most recommend keeping this number > below 10000, but I've found I get the best performance with about 24000 > shared_buffers with a ~5GB database on a machine with 4GB of ram, > dedicated to Postgres. You'll have to experiment to see what works best > for you. > > Also, make sure you VACUUM and ANALYZE on a regular basis. Again, the > frequency of this really depends on your data and usage patterns. More > frequent write operations require more frequent vacuuming. > > Good luck. > > Best Regards, > > Bill Montgomery > >>The postresql.conf say: >> >>#--------------------------------------------------------------------------- >> # RESOURCE USAGE (except WAL) >>#--------------------------------------------------------------------------- >> >># - Memory - >> >>shared_buffers = 1000 # min 16, at least max_connections*2, >> 8KB each >>sort_mem = 1024 # min 64, size in KB >>vacuum_mem = 8192 # min 1024, size in KB >> >># - Free Space Map - >> >>max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes >> each max_fsm_relations = 1000 # min 100, ~50 bytes each >> >># - Kernel Resource Usage - >> >>max_files_per_process = 1000 # min 25 >>#preload_libraries = '' >> >> >>#--------------------------------------------------------------------------- >> # WRITE AHEAD LOG >>#--------------------------------------------------------------------------- >> >># - Settings - >> >>fsync = true # turns forced synchronization on or >> off wal_sync_method = fsync # the default varies across platforms: >> # fsync, fdatasync, open_sync, or >>open_datasync >>wal_buffers = 8 # min 4, 8KB each >> >># - Checkpoints - >> >>checkpoint_segments = 3 # in logfile segments, min 1, 16MB each >>checkpoint_timeout = 300 # range 30-3600, in seconds >>checkpoint_warning = 30 # 0 is off, in seconds >>commit_delay = 0 # range 0-100000, in microseconds >> commit_siblings = 5 # range 1-1000 >> >>#--------------------------------------------------------------------------- >> # QUERY TUNING >>#--------------------------------------------------------------------------- >> >># - Planner Method Enabling - >> >>enable_hashagg = true >>enable_hashjoin = true >>enable_indexscan = true >>enable_mergejoin = true >>enable_nestloop = true >>enable_seqscan = true >>enable_sort = true >>enable_tidscan = true >> >># - Planner Cost Constants - >> >>effective_cache_size = 1000 # typically 8KB each >>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 = true >>geqo_threshold = 11 >>geqo_effort = 1 >>geqo_generations = 0 >>geqo_pool_size = 0 # default based on tables in statement, >> # range 128-1024 >>geqo_selection_bias = 2.0 # range 1.5-2.0 >> >># - Other Planner Options - >> >>default_statistics_target = 100 # range 1-1000 >>from_collapse_limit = 30 >>join_collapse_limit = 30 # 1 disables collapsing of explicit >> JOINs >> >> >>#--------------------------------------------------------------------------- >> # ERROR REPORTING AND LOGGING >>#--------------------------------------------------------------------------- >> >># - Syslog - >> >>#syslog = 0 # range 0-2; 0=stdout; 1=both; 2=syslog >> #syslog_facility = 'LOCAL0' >>#syslog_ident = 'postgres' >> >># - When to Log - >> >>#client_min_messages = notice # Values, in order of decreasing >> detail: >> # debug5, debug4, debug3, debug2, >> debug1, # log, info, notice, warning, >> error >> >>#log_min_messages = notice # Values, in order of decreasing >> detail: >> # debug5, debug4, debug3, debug2, >> debug1, # info, notice, warning, >> error, log, fatal, # panic >> >>#log_error_verbosity = default # terse, default, or verbose messages >> >>#log_min_error_statement = panic # Values in order of increasing >> severity: >> # debug5, debug4, debug3, debug2, >> debug1, # info, notice, warning, >> error, panic(off) >> >>#log_min_duration_statement = -1 # Log all statements whose >> # execution time exceeds the value, in >> # milliseconds. Zero prints all >> queries. # Minus-one disables. >> >>#silent_mode = false # DO NOT USE without Syslog! >> >># - What to Log - >> >> >> >>debug_print_parse = true >>debug_print_rewritten = true >>debug_print_plan = true >>debug_pretty_print = true >>log_connections = true >>log_duration = true >>log_pid = true >>log_statement = true >>log_timestamp = true >>log_hostname = true >>log_source_port = true >> >> >>#--------------------------------------------------------------------------- >> # RUNTIME STATISTICS >>#--------------------------------------------------------------------------- >> >># - Statistics Monitoring - >> >>log_parser_stats = true >>log_planner_stats = true >>log_executor_stats = true >>#log_statement_stats = true >> >># - Query/Index Statistics Collector - >> >>stats_start_collector = true >>stats_command_string = true >>stats_block_level = true >>stats_row_level = true >>stats_reset_on_server_start = true >> >> >>#--------------------------------------------------------------------------- >> # CLIENT CONNECTION DEFAULTS >>#--------------------------------------------------------------------------- >> >># - Statement Behavior - >> >>#search_path = '$user,public' # schema names >>#check_function_bodies = true >>#default_transaction_isolation = 'read committed' >>#default_transaction_read_only = false >>#statement_timeout = 0 # 0 is disabled, in milliseconds >> >># - Locale and Formatting - >> >>#datestyle = 'iso, mdy' >>#timezone = unknown # actually, defaults to TZ environment >> setting >>#australian_timezones = false >>#extra_float_digits = 0 # min -15, max 2 >>#client_encoding = sql_ascii # actually, defaults to database >> encoding >> >># These settings are initialized by initdb -- they may be changed >> lc_messages = 'es_VE.UTF-8' # locale for system error >> message strings >>lc_monetary = 'es_VE.UTF-8' # locale for monetary >> formatting lc_numeric = 'es_VE.UTF-8' # locale for number >> formatting lc_time = 'es_VE.UTF-8' # locale for time >> formatting >> >># - Other Defaults - >> >>explain_pretty_print = true >>#dynamic_library_path = '$libdir' >>#max_expr_depth = 10000 # min 10 >> >> >>#--------------------------------------------------------------------------- >> # LOCK MANAGEMENT >>#--------------------------------------------------------------------------- >> >>#deadlock_timeout = 1000 # in milliseconds >>#max_locks_per_transaction = 64 # min 10, ~260*max_connections bytes >> each >> >> >>#--------------------------------------------------------------------------- >> # VERSION/PLATFORM COMPATIBILITY >>#--------------------------------------------------------------------------- >> >># - Previous Postgres Versions - >> >>#add_missing_from = true >>#regex_flavor = advanced # advanced, extended, or basic >>#sql_inheritance = true >> >># - Other Platforms & Clients - >> >>#transform_null_equals = false >> >> >> >>BUT THE PERFORMANCE IT�S VERY SLOW >> >>what can do ????? >> >>Thank >> >> >>Mario Soto >> >> >> >>---------------------------(end of >> broadcast)--------------------------- TIP 2: you can get off all lists >> at once with the unregister command >> (send "unregister YourEmailAddressHere" to >> majordomo@postgresql.org) >> From pgsql-patches-owner@postgresql.org Wed May 26 14:21:48 2004 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E2829D1B23F; Wed, 26 May 2004 14:21:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 67054-06; Wed, 26 May 2004 14:20:56 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id F34ECD1B175; Wed, 26 May 2004 14:20:54 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4QHKrT1041750; Wed, 26 May 2004 17:20:54 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4QHA4Kd023235; Wed, 26 May 2004 17:10:04 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.performance, comp.databases.postgresql.patches Subject: Re: tuning for AIX 5L with large memory Date: Wed, 26 May 2004 12:37:24 -0400 Organization: cbbrowne Computing Inc Lines: 53 Message-ID: <60brkbdu0r.fsf@dev6.int.libertyrms.info> References: <40AE8F78.2070901@drivefaster.net> <40AEBB73.7010105@samurai.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:eaOcZu0G9kvc0F4ipBPXo08lXmo= To: "pgsql-patches@postgresql.org.pgsql-performance"@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/386 X-Sequence-Number: 11102 neilc@samurai.com (Neil Conway) writes: > Christopher Browne wrote: >> One of our sysadmins did all the "configuring OS stuff" part; I don't >> recall offhand if there was a need to twiddle something in order to >> get it to have great gobs of shared memory. > > FWIW, the section on configuring kernel resources under various > Unixen[1] doesn't have any documentation for AIX. If someone out there > knows which knobs need to be tweaked, would they mind sending in a doc > patch? (Or just specifying what needs to be done, and I'll add the > SGML.) After verifying that nobody wound up messing with the kernel parameters, here's a docs patch... Index: runtime.sgml =================================================================== RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/runtime.sgml,v retrieving revision 1.263 diff -c -u -r1.263 runtime.sgml --- runtime.sgml 29 Apr 2004 04:37:09 -0000 1.263 +++ runtime.sgml 26 May 2004 16:35:43 -0000 @@ -3557,6 +3557,26 @@ + + AIX + AIXIPC configuration + + + At least as of version 5.1, it should not be necessary to do + any special configuration for such parameters as + SHMMAX, as it appears this is configured to + allow all memory to be used as shared memory. That is the + sort of configuration commonly used for other databases such + as DB/2. + + It may, however, be necessary to modify the global + ulimit information in + /etc/security/limits, as the default hard + limits for filesizes (fsize) and numbers of + files (nofiles) may be too low. + + + Solaris -- select 'cbbrowne' || '@' || 'acm.org'; http://www.ntlug.org/~cbbrowne/linuxxian.html Hail to the sun god, he sure is a fun god, Ra, Ra, Ra!! From pgsql-performance-owner@postgresql.org Wed May 26 14:21:36 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E5C7DD1B241 for ; Wed, 26 May 2004 14:21:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 64674-09 for ; Wed, 26 May 2004 14:20:56 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7CCE3D1B16F for ; Wed, 26 May 2004 14:20:54 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4QHKrSx041750 for ; Wed, 26 May 2004 17:20:53 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4QHA5vB023251 for pgsql-performance@postgresql.org; Wed, 26 May 2004 17:10:05 GMT From: Chris Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: tuning for AIX 5L with large memory Date: Wed, 26 May 2004 12:58:55 -0400 Organization: cbbrowne Computing Inc Lines: 58 Message-ID: <60wu2zcegg.fsf@dev6.int.libertyrms.info> References: <40AE8F78.2070901@drivefaster.net> <40B01AD1.1050708@drivefaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:eujnUQV+gPiIsDoxrZnL7fyLWMs= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/215 X-Sequence-Number: 7046 fbsd@drivefaster.net (Dan Harris) writes: > Christopher Browne wrote: > >>We have a couple of these at work; they're nice and fast, although the >>process of compiling things, well, "makes me feel a little unclean." >> > Thanks very much for your detailed reply, Christopher. Would you mind > elaborating on the "makes me feel a little unclean" statement? The way AIX manages symbol tables for shared libraries is fairly astounding in its verbosity. Go and try to compile, by hand, a shared library, and you'll see :-). > Also, I'm curious which models you are running and if you have any > anecdotal comparisons for perfomance? I'm completely unfamiliar > with AIX, so if there are dark corners that await me, I'd love to > hear a little more so I can be prepared. I'm going out on a limb > here and jumping to an unfamiliar architecture as well as OS, but > the IO performance of these systems has convinced me that it's what > I need to break out of my I/O limited x86 systems. It would probably be better for Andrew Sullivan to speak to the details on that. The main focus of comparison has been between AIX and Solaris, and the AIX systems have looked generally pretty good. We haven't yet had AIX under what could be truly assessed as "heavy load." That comes, in part, from the fact that brand-new latest-generation pSeries hardware is _way_ faster than three-year-old Solaris hardware. Today's top-of-the-line is faster than what was high-end three years ago, so the load that the Sun boxes can cope with "underwhelms" the newer IBM hardware :-). > I suppose when I do get it, I'll just experiment with different > sizes of shared memory and run some benchmarks. For the price of > these things, they better be some good marks! Well, there's more than one way of looking at these things. One of the important perspectives to me is the one of reliability. A system that is Way Fast, but which crashes once in a while with some hardware fault is no good. I have been getting accustomed to Sun and Dell systems crashing way too often :-(. One of the merits of the pSeries hardware is that it's got the maturity of IBM's long term experience at building reliable servers. If the IBM hardware was a bit slower (unlikely, based on it being way newer than the older Suns), but had suitable reliability, that would seem a reasonable tradeoff to me. I take the very same perspective on the discussions of "which filesystem is best?" Raw speed is NOT the only issue; it is secondary, as far as I am concerned, to "Is It Reliable?" -- (format nil "~S@~S" "cbbrowne" "ntlug.org") http://cbbrowne.com/info/lsf.html Appendium to the Rules of the Evil Overlord #1: "I will not build excessively integrated security-and-HVAC systems. They may be Really Cool, but are far too vulnerable to breakdowns." From pgsql-general-owner@postgresql.org Wed May 26 14:47:17 2004 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9B0A3D1B16F for ; Wed, 26 May 2004 14:47:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 80823-04 for ; Wed, 26 May 2004 14:46:53 -0300 (ADT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.189]) by svr1.postgresql.org (Postfix) with ESMTP id F2201D1B1D1 for ; Wed, 26 May 2004 14:46:50 -0300 (ADT) Received: from [212.227.126.179] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1BT2UN-0000R4-00; Wed, 26 May 2004 19:46:51 +0200 Received: from [80.146.152.166] (helo=lorien.finner.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1BT2UM-0000U5-00; Wed, 26 May 2004 19:46:51 +0200 Received: from isengard.finner.de (isengard.finner.de [192.168.14.20]) by lorien.finner.de (Invenius Mailomatics) with ESMTP id 7D03256E13; Wed, 26 May 2004 19:46:44 +0200 (CEST) Received: by isengard.finner.de (Postfix, from userid 500) id 3CB0C88722; Wed, 26 May 2004 19:46:42 +0200 (CEST) Date: Wed, 26 May 2004 19:46:32 +0200 From: Frank Finner To: "Mario Soto" Cc: pgsql-general@postgresql.org Subject: Re: performance very slow Message-Id: <20040526194632.4c4f9f09.postgresql@finner.de> In-Reply-To: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> References: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> X-Mailer: Sylpheed version 0.8.10claws72 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="=.eu)kYzYd4qOuOJ" X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:2d1f62c261f062640f582804a7b1040c X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.4 tagged_above=0.0 required=5.0 tests=MIME_BASE64_LATIN, MIME_BASE64_TEXT, RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/796 X-Sequence-Number: 61230 --=.eu)kYzYd4qOuOJ Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: base64 SGksDQoNCnNoYXJlZF9idWZmZXJzIHNlZW1zIHF1aXRlIGxvdyBmb3IgYSBz ZXJ2ZXIgdG8gbWUuIEZvciBiZXN0IHBlcmZvcm1hbmNlLCB5b3UNCnNob3Vs ZCByZWFkIGFuZCBmb2xsb3cgdGhlIG9wdGltaXNhdGlvbiBhcnRpY2xlcyBv bg0KaHR0cDovL3RlY2hkb2NzLnBvc3RncmVzcWwub3JnLy4NCg0KUmVnYXJk cywgRnJhbmsgDQoNCg0KDQpPbiBXZWQsIDI2IE1heSAyMDA0IDExOjI2OjMw IC0wNDAwIChWRVQpICJNYXJpbyBTb3RvIg0KPG1hcmlvX3NvdG9AdmVuZXpv bGFuYWRlYXZhbHVvcy5jb20+IHNhdCBkb3duLCB0aG91Z2h0IGxvbmcgYW5k IHRoZW4gd3JvdGU6DQoNCj4gSGkuIGkgaGF2YSBhIHBvc3RyZXNxbCA3LjQu MiBpbiBhIHByb2R1Y3Rpb24gc2VydmVyLg0KPiANCj4gdGhhIG1hY2hpbmUg aXMgYSBQZW50aXVtIElWIDIsNiBHSFogQU5EIDEgR0IgSU4gUkFNIHdpdGgg bElOVVggUkggOS4wLg0KPiANCg0KLi4uDQoNCj4gDQo+IA0KPiBCVVQgVEhF IFBFUkZPUk1BTkNFIElUtFMgVkVSWSBTTE9XDQo+IA0KPiB3aGF0IGNhbiBk byA/Pz8/Pw0KPiANCj4gVGhhbmsNCj4gDQo+IA0KPiBNYXJpbyBTb3RvDQo+ IA0KPiANCg== --=.eu)kYzYd4qOuOJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iD8DBQFAtNgC9yTJ83o5N2cRAqUHAJ41DHj3yTX+jI1MfGvTgSYUsgzJAgCfeMSw 7EjrbouA2RrzsvgEr3HvK08= =3JHM -----END PGP SIGNATURE----- --=.eu)kYzYd4qOuOJ-- From pgsql-performance-owner@postgresql.org Wed May 26 15:00:07 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5D504D1B241 for ; Wed, 26 May 2004 14:59:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 84086-06 for ; Wed, 26 May 2004 14:59:37 -0300 (ADT) Received: from fep11.012.net.il (fep11.012.net.il [212.117.129.244]) by svr1.postgresql.org (Postfix) with ESMTP id E6AB7D1B503 for ; Wed, 26 May 2004 14:59:33 -0300 (ADT) Received: from [127.0.0.1] ([80.178.88.219]) by fep11.012.net.il with ESMTP id <20040526175731.IPPO29697.fep11@[80.178.88.219]>; Wed, 26 May 2004 20:57:31 +0300 Received: from [127.0.0.1] ([127.0.0.1]) by [127.0.0.1] with ESMTP (SpamPal v1.50) sender ; 26 May 2004 21:00:35 +0300 Date: Wed, 26 May 2004 21:00:34 +0300 From: Vitaly Belman Reply-To: Vitaly Belman X-Priority: 3 (Normal) Message-ID: <3115838500.20040526210034@012.net.il> To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL caching In-Reply-To: <200405260917.35537.josh@agliodbs.com> References: <20792805375.20040521203337@012.net.il> <40B3C792.3020106@outputservices.com> <1673440625.20040526173356@012.net.il> <200405260917.35537.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: base64 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=3.0 tagged_above=0.0 required=5.0 tests=MIME_BASE64_LATIN, MIME_BASE64_TEXT, PRIORITY_NO_NAME X-Spam-Level: *** X-Archive-Number: 200405/217 X-Sequence-Number: 7048 SGVsbG8gSm9zaCwNCg0KSkI+IE5vdCB0aGF0IHlvdSBjYW4ndCBpbXByb3Zl IHRoZSBxdWVyeSwganVzdCB0aGF0IGl0IG1pZ2h0IG5vdCBmaXgNCkpCPiB0 aGUgcHJvYmxlbS4NCg0KWWVzLCBJJ20gYXdhcmUgaXQgbWlnaHQgYmUgc2xv d2VyIHRoYW4gdGhlIExpbnV4IHZlcnNpb24sIGJ1dCB0aGVuLCBhcw0KeW91 IHNhaWQsIEkgc3RpbGwgY2FuIGltcHJvdmUgdGhlIHF1ZXJ5IChhcyBJIGRp ZCB3aXRoIHlvdXIgaGVscCBub3cpLg0KDQpCdXQgdHJ1ZSwgaWYgdGhlcmUn cyBzb21ldGhpbmcgYXdmdWxseSB3cm9uZyB3aXRoIFdpbjMyIHBvcnQNCnBl cmZvcm1hbmNlLCBJIG1pZ2h0IGJlIGRvaW5nIHNvbWUgb3ZlcndvcmsuLi4N Cg0KSkI+IFRoZXJlZm9yZSAuLi4geW91ciBkZXRhaWxlZCBmZWVkYmFjayBp cyBhcHByZWNpYXRlZCwgZXNwZWNpYWxseSBpZiB5b3UgY2FuDQpKQj4gY29t cGFyZSBzdHVmZiB0byB0aGUgc2FtZSBkYXRhYmFzZSBydW5uaW5nIG9uIGEg TGludXgsIFVuaXgsIG9yIEJTRCBtYWNoaW5lLg0KDQpJIGNhbid0IGVhc2ls eSBpbnN0YWxsIExpbnV4IHJpZ2h0IG5vdy4uIEJ1dCBJIGFtIGNvbnNpZGVy aW5nIHVzaW5nIGl0DQp0aHJvdWdoIFZNV2FyZS4gRG8geW91IHRoaW5rIGl0 IHdvdWxkIHN1ZmZpY2UgYXMgYSBjb21wcmFzaW9uPw0KDQpGcm9tIHdoYXQg SSBzYXcgKGUuZw0KaHR0cDovL3VzdWFyaW9zLmx5Y29zLmVzL2hlcm5hbmRw L2FydGljbGVzL3ZwY3ZzLmh0bWwpIHRoZSBwZXJmb3JtYW5jZQ0KYXJlIGJh ZCBvbmx5IHdoZW4gaXQncyBjb21pbmcgdG8gZ3JhcGhpY3MsIG90aGVyd2lz ZSBpdCBsb29rcyBwcmV0dHkNCmdvb2QuDQoNClJlZ2FyZHMsDQogVml0YWx5 IEJlbG1hbg0KIA0KIElDUTogMTkxMjQ1Mw0KIEFJTTogVml0YWx5QjE5ODQN CiBNU046IHRtZGFnZW50QGhvdG1haWwuY29tDQogWWFob28hOiBWaXRhbHlC ZQ0KDQpXZWRuZXNkYXksIE1heSAyNiwgMjAwNCwgNzoxNzozNSBQTSwgeW91 IHdyb3RlOg0KDQpKQj4gVml0YWx5LA0KDQo+PiBJIGFtIHVzaW5nIHRoZSBu ZXdlciA3LjVkZXYgbmF0aXZlIFdpbmRvd3MgcG9ydC4gRm9yIHRoaXMgcmVh c29uIEkNCj4+IGRvbid0IHRoaW5rIHRoYXQgSU4gd2lsbCBjYXVzZSBhbnkg dHJvdWJsZSAoSSByZWFkIHRoYXQgdGhpcyBpc3N1ZSB3YXMNCj4+IHJlc29s dmVkIGluIDcuNCkuDQoNCkpCPiBXZWxsLCBmb3IgcGVyZm9ybWFuY2UsIGFs bCBiZXRzIGFyZSBvZmYgZm9yIHRoZSBkZXYgV2luZG93cyBwb3J0LiAgIExh c3QgSQ0KSkI+IGNoZWNrZWQsIHRoZSBXaW4zMiB0ZWFtIHdhcyBzdGlsbCB3 b3JraW5nIG9uICpzdGFiaWxpdHkqIGFuZCBoYWRuJ3QgeWV0IGV2ZW4NCkpC PiBsb29rZWQgYXQgcGVyZm9ybWFuY2UuICBOb3QgdGhhdCB5b3UgY2FuJ3Qg aW1wcm92ZSB0aGUgcXVlcnksIGp1c3QgdGhhdCBpdA0KSkI+IG1pZ2h0IG5v dCBmaXggdGhlIHByb2JsZW0uDQoNCkpCPiBUaGVyZWZvcmUgLi4uIHlvdXIg ZGV0YWlsZWQgZmVlZGJhY2sgaXMgYXBwcmVjaWF0ZWQsIGVzcGVjaWFsbHkg aWYgeW91IGNhbg0KSkI+IGNvbXBhcmUgc3R1ZmYgdG8gdGhlIHNhbWUgZGF0 YWJhc2UgcnVubmluZyBvbiBhIExpbnV4LCBVbml4LCBvciBCU0QgbWFjaGlu ZS4NCg0K From pgsql-general-owner@postgresql.org Wed May 26 16:04:22 2004 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 04116D1B3CA for ; Wed, 26 May 2004 16:04:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07134-07 for ; Wed, 26 May 2004 16:03:59 -0300 (ADT) Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 9C786D1C7F0 for ; Wed, 26 May 2004 16:03:56 -0300 (ADT) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id 941E98086; Wed, 26 May 2004 21:03:56 +0200 (CEST) Date: Wed, 26 May 2004 21:03:56 +0200 (CEST) From: Dennis Bjorklund To: Mario Soto Cc: pgsql-general@postgresql.org Subject: Re: performance very slow In-Reply-To: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> 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 postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/799 X-Sequence-Number: 61233 On Wed, 26 May 2004, Mario Soto wrote: > tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. > > BUT THE PERFORMANCE IT�S VERY SLOW How often do you run VACUUM ANALYZE? You might want to do that every night or every hour (depending on how much updates you have). Some of your config values could and should be tuned, read something like http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html Still, if it's very slow it's probably not just a little tweaking of these variables that solves everything. If that is the case you need to find a slow query, run EXPLAIN ANALYZE on it and try to figure out why it is slow. There is a list to help with performance issues called pgsql-performance that you might want to post to (and read its archive). But before anything else, make sure you run VACUUM ANALYZE regulary. -- /Dennis Bj�rklund From pgsql-general-owner@postgresql.org Wed May 26 16:16:23 2004 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 91629D1B3C7 for ; Wed, 26 May 2004 16:16:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 17717-08 for ; Wed, 26 May 2004 16:16:01 -0300 (ADT) Received: from localhost.localdomain (unknown [200.35.66.77]) by svr1.postgresql.org (Postfix) with ESMTP id 9EF70D1B188 for ; Wed, 26 May 2004 16:15:58 -0300 (ADT) Received: from localhost.localdomain (FWVasa [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i4QJDFrZ026395; Wed, 26 May 2004 15:13:15 -0400 Received: (from apache@localhost) by localhost.localdomain (8.12.8/8.12.8/Submit) id i4QJDFan026393; Wed, 26 May 2004 15:13:15 -0400 X-Authentication-Warning: localhost.localdomain: apache set sender to mario_soto@venezolanadeavaluos.com using -f Received: from 200.35.66.77 (proxying for 192.168.0.100) (SquirrelMail authenticated user mario_soto) by mail.venezolanadeavaluos.com with HTTP; Wed, 26 May 2004 15:13:14 -0400 (VET) Message-ID: <45130.200.35.66.77.1085598794.squirrel@mail.venezolanadeavaluos.com> Date: Wed, 26 May 2004 15:13:14 -0400 (VET) Subject: Re: performance very slow From: "Mario Soto" To: In-Reply-To: References: <36620.200.35.66.77.1085585190.squirrel@mail.venezolanadeavaluos.com> X-Priority: 3 Importance: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.10) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/800 X-Sequence-Number: 61234 OK. i see the link and change parameters in postgresql.conf i.e. When excecute a insert statement the memory up to 90% to use . it's normal ??????? Thank for yor help and sorry for my bad englis Regards Mario Soto > On Wed, 26 May 2004, Mario Soto wrote: > >> tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. >> >> BUT THE PERFORMANCE IT�S VERY SLOW > > How often do you run VACUUM ANALYZE? You might want to do that every > night or every hour (depending on how much updates you have). > > Some of your config values could and should be tuned, read something > like > > http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > > Still, if it's very slow it's probably not just a little tweaking of > these variables that solves everything. > > If that is the case you need to find a slow query, run EXPLAIN ANALYZE > on it and try to figure out why it is slow. There is a list to help with > performance issues called pgsql-performance that you might want to post > to (and read its archive). > > But before anything else, make sure you run VACUUM ANALYZE regulary. > > -- > /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Thu May 27 10:57:33 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EC647D1CF2A for ; Thu, 27 May 2004 10:56:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 43548-10 for ; Thu, 27 May 2004 10:56:18 -0300 (ADT) Received: from ms-smtp-02.tampabay.rr.com (ms-smtp-02-smtplb.tampabay.rr.com [65.32.5.132]) by svr1.postgresql.org (Postfix) with ESMTP id 42442D1B3B6 for ; Thu, 27 May 2004 10:56:13 -0300 (ADT) Received: from MATTSPC (222-60.26-24.tampabay.rr.com [24.26.60.222]) by ms-smtp-02.tampabay.rr.com (8.12.10/8.12.7) with ESMTP id i4RDuBnb020333; Thu, 27 May 2004 09:56:12 -0400 (EDT) Message-Id: <200405271356.i4RDuBnb020333@ms-smtp-02.tampabay.rr.com> From: "Matthew Nuzum" To: "'Vitaly Belman'" Cc: Subject: Re: PostgreSQL caching Date: Thu, 27 May 2004 09:56:00 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-reply-to: <3115838500.20040526210034@012.net.il> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Thread-index: AcRDTeI2hkBm9FAzSsGV6bg3w6CDPwAouMog X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/218 X-Sequence-Number: 7049 > > Hello Josh, > > JB> Not that you can't improve the query, just that it might not fix > JB> the problem. > > Yes, I'm aware it might be slower than the Linux version, but then, as > you said, I still can improve the query (as I did with your help now). > > But true, if there's something awfully wrong with Win32 port > performance, I might be doing some overwork... > > JB> Therefore ... your detailed feedback is appreciated, especially if you > can > JB> compare stuff to the same database running on a Linux, Unix, or BSD > machine. > > I can't easily install Linux right now.. But I am considering using it > through VMWare. Do you think it would suffice as a comprasion? > > From what I saw (e.g > http://usuarios.lycos.es/hernandp/articles/vpcvs.html) the performance > are bad only when it's coming to graphics, otherwise it looks pretty > good. > > Regards, > Vitaly Belman > An interesting alternative that I've been using lately is colinux (http://colinux.sf.net). It lets you run linux in windows and compared to vmware, I find it remarkably faster and when it is idle less resource intensive. I have vmware but if I'm only going to use a console based program, colinux seems to outperform it. Note that it may simply be interactive processes that run better because it has a simpler interface and does not try to emulate the display hardware. (Therefore no X unless you use vmware) It seems though that there is less overhead and if that's the case, then everything should run faster. Also note that getting it installed is a little more work than vmware. If you're running it on a workstation that you use for normal day-to-day tasks though I think you'll like it because you can detach the terminal and let it run in the background. When I do that I often forget it is running because it produces such a low load on the system. If you are going to give it a try, the one trick I used to get things going was to download the newest beta of winpcap and then the networking came up easily. Everything else was a piece of cake. Matthew Nuzum | Makers of "Elite Content Management System" www.followers.net | View samples of Elite CMS in action matt@followers.net | http://www.followers.net/portfolio/ From pgsql-performance-owner@postgresql.org Thu May 27 19:41:13 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5BDB5D1CDE8 for ; Thu, 27 May 2004 19:41:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 54777-06 for ; Thu, 27 May 2004 19:40:52 -0300 (ADT) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by svr1.postgresql.org (Postfix) with ESMTP id 8801AD1C952 for ; Thu, 27 May 2004 19:40:47 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id B6325C09E for ; Thu, 27 May 2004 16:39:06 -0600 (MDT) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04230-01 for ; Thu, 27 May 2004 16:39:06 -0600 (MDT) Received: from [192.168.1.12] (c-24-9-24-35.client.comcast.net [24.9.24.35]) by crestone.coronasolutions.com (Postfix) with ESMTP id 5AB6DBDC1 for ; Thu, 27 May 2004 16:39:06 -0600 (MDT) Message-ID: <40B66E71.7060703@drivefaster.net> Date: Thu, 27 May 2004 16:40:49 -0600 From: Dan Harris User-Agent: Mozilla Thunderbird 0.6 (Macintosh/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Hardware opinions wanted Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at drivefaster.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/219 X-Sequence-Number: 7050 I wanted to solicit some opinions on architecture and performance from you guys. I am torn right now between these two systems to replace my aging DB server: 4 x 2.2 GHz Opteron 8GB RAM Ultra320 15kRPM RAID5 with 128MB cache and 2-way 1.2GHz POWER4+ IBM pSeries 615 8GB RAM Ultra320 15kRPM RAID5 with 64MB cache I plan on serving ~80GB of pgsql database on this machine. The current machine handles around 1.5 million queries per day. I am having some trouble finding direct comparisons between the two architectures. The OS will most likely be Linux ( I'm hedging on AIX for now ). The pSeries has 8MB cache per CPU card ( 2 CPU on a card ) while the Opteron has 1MB for each processor. I know the POWER4+ is a very fast machine but I wonder if having more processors in the Opteron system would beat it for database serving? FWIW, they are very close in price. Ignoring the fault-tolerance features of the pSeries, which one would you pick for performance? Thanks, Dan From pgsql-performance-owner@postgresql.org Fri May 28 07:43:25 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4317DD1B272 for ; Fri, 28 May 2004 07:43:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 68524-01 for ; Fri, 28 May 2004 07:42:55 -0300 (ADT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 4A530D1BA9E for ; Fri, 28 May 2004 07:42:51 -0300 (ADT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1BTep8-0001qb-00; Fri, 28 May 2004 12:42:50 +0200 Received: from bm.office.turtle-entertainment.de ([212.6.194.129]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1BTep8-0007Iz-00; Fri, 28 May 2004 12:42:50 +0200 Message-ID: <40B717BF.9060507@turtle-entertainment.de> Date: Fri, 28 May 2004 12:43:11 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dan Harris Cc: pgsql-performance@postgresql.org Subject: Re: Hardware opinions wanted References: <40B66E71.7060703@drivefaster.net> In-Reply-To: <40B66E71.7060703@drivefaster.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=2.6 tagged_above=0.0 required=5.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_SORBS X-Spam-Level: ** X-Archive-Number: 200405/220 X-Sequence-Number: 7051 Dan Harris wrote: > I am torn right now between these two systems to replace my aging DB > server: > > 4 x 2.2 GHz Opteron > 8GB RAM > Ultra320 15kRPM RAID5 with 128MB cache > > and > > 2-way 1.2GHz POWER4+ IBM pSeries 615 > 8GB RAM > Ultra320 15kRPM RAID5 with 64MB cache I don't know anything about the pSeries, but have a look in the archives, there was recently a rather long thread about Xeon vs. Opteron. The Opteron was the clear winner. Personally I think that you can't be wrong with the 4-way Opteron. It scales very well and if you don't need the fault tolerance of the pSeries platform, then you should be able to save one or two bucks with opteron way. Btw: If you want to save a few more bucks, then drop the 15k and take 10k drives. They are of almost same speed. Regards, Bjoern From pgsql-performance-owner@postgresql.org Sat May 29 02:06:34 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3E925D1B1B3 for ; Sat, 29 May 2004 02:06:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 78037-08 for ; Sat, 29 May 2004 02:06:31 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 024F9D1B16F for ; Sat, 29 May 2004 02:06:30 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4T566iH015005; Sat, 29 May 2004 01:06:06 -0400 (EDT) To: Josh Sacks Cc: pgsql-performance@postgresql.org Subject: Re: Not using Primary Key in query In-reply-to: References: Comments: In-reply-to Josh Sacks message dated "Tue, 25 May 2004 11:37:55 -0700" Date: Sat, 29 May 2004 01:06:05 -0400 Message-ID: <15004.1085807165@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/224 X-Sequence-Number: 7055 Josh Sacks writes: > I can't understand what's going on in this simple query: If you are using anything older than PG 7.4, you should not expect good performance from WHERE ... IN (sub-SELECT) queries. There's essentially no optimization happening there. regards, tom lane From pgsql-performance-owner@postgresql.org Sat May 29 04:04:54 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A0BABD1B173 for ; Sat, 29 May 2004 04:04:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09175-09 for ; Sat, 29 May 2004 04:04:45 -0300 (ADT) Received: from mailrelay1.yourhostingaccount.com (mailrelay1.yourhostingaccount.com [38.113.1.58]) by svr1.postgresql.org (Postfix) with SMTP id C374CD1B1B7 for ; Sat, 29 May 2004 04:04:42 -0300 (ADT) Received: (qmail 30949 invoked from network); 29 May 2004 07:04:38 -0000 Received: from unknown (HELO mail.yourhostingaccount.com) (10.1.1.70) by 0 with SMTP; 29 May 2004 07:04:38 -0000 Received: server.yourhostingaccount.com ([10.1.1.1] helo=server.yourhostingaccount.com) by mail.yourhostingaccount.com with esmtp (Exim 4.34) id 1BTxtV-0004g4-Ch for pgsql-performance@postgresql.org; Sat, 29 May 2004 03:04:37 -0400 Received: from [212.76.66.43] (helo=rajahsoftvels) by smtp.yourhostingaccount.com with asmtp (Exim 4.34) id 1BTxKf-0007pa-Kt for pgsql-performance@postgresql.org; Sat, 29 May 2004 02:28:38 -0400 From: "rajaguru" To: Subject: Logging all query in one seperate File Date: Sat, 29 May 2004 09:28:35 +0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C4455F.52C5F050" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcRFRitvQJHQUtIoRq+vcBbaxQWQog== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-UserInfo: ccb2106cb1195d1ee81352797f4037d2:3c5a145c62cd08d6007689eb1450d9fe Message-Id: <20040529070442.C374CD1B1B7@svr1.postgresql.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/225 X-Sequence-Number: 7056 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C4455F.52C5F050 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hai all, I want to log my queries send to the Postgresql server. I heard that we can do this my specifying the file name in /etc/rc.d/init.d/Postgresql initiating file. But I don't know. If this is the way means how to do that. Or anyother way is there. Thanks is advance Raja ------=_NextPart_000_0000_01C4455F.52C5F050 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hai all,

          I= want to log my queries send to the Postgresql server. I heard that we can do this my specifying the file name in

/etc/rc.d/init.d/Postgresql  initiating file. But I= don’t know. If this is the way means how to do that. Or anyother way is there.

 

Thanks is advance

Raja  

------=_NextPart_000_0000_01C4455F.52C5F050-- From pgsql-performance-owner@postgresql.org Sat May 29 06:31:58 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C097AD1B1CE for ; Sat, 29 May 2004 06:31:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 44292-10 for ; Sat, 29 May 2004 06:31:54 -0300 (ADT) Received: from frodo.hserus.net (frodo.hserus.net [204.74.68.40]) by svr1.postgresql.org (Postfix) with ESMTP id 745A2D1B193 for ; Sat, 29 May 2004 06:31:51 -0300 (ADT) Received: from concord.pspl.co.in ([202.54.11.72]:63304 helo=ps0499.intranet.pspl.co.in) by frodo.hserus.net with asmtp (Cipher TLSv1:RC4-MD5:128) (Exim 4.34 #0) id 1BU0By-000Doe-Bl by authid with plain; Sat, 29 May 2004 15:01:50 +0530 From: Shridhar Daithankar Reply-To: shridhar@frodo.hserus.net To: share-postgres@think42.com Subject: Re: filesystem option tuning Date: Sat, 29 May 2004 15:01:45 +0530 User-Agent: KMail/1.6.1 Cc: Richard Huxton , pgsql-performance@postgresql.org References: <20040515125227.A29574@p15097255.pureserver.info> <40A8F0B6.6060703@archonet.com> <20040519093239.A26016@p15097255.pureserver.info> In-Reply-To: <20040519093239.A26016@p15097255.pureserver.info> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200405291501.45229.shridhar@frodo.hserus.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, RCVD_IN_NJABL_SPAM X-Spam-Level: X-Archive-Number: 200405/226 X-Sequence-Number: 7057 On Wednesday 19 May 2004 13:02, share-postgres@think42.com wrote: > > - If you can put WAL on separate disk(s), all the better. > > Does that mean only the xlog, or also the clog? As far as I understand, the > clog contains some meta-information on the xlog, so presumably it is > flushed to disc synchronously together with the xlog? That would mean that > they each need a separate disk to prevent one disk having to seek too > often...? You can put clog and xlog on same drive. That should be enough in most cases. xlog is written sequentially and never read back other than for recovery after a crash. clog is typically 8KB or a page and should not be an IO overhead even in high traffic databases. > > - Battery-backed write-cache for your SCSI controller can be a big > > performance win > > I probably won't be able to get such a setup for this project; that's why I > am bothering about which disk will be seeking how often. As I said earlier, xlog is written sequentially and if I am not mistaken clog as well. So there should not be much seeking if they are on a separate drive. (Please correct me if I am wrong) > > - Tablespaces _should_ be available in the next release of PG, we'll > > know for sure soon. That might make life simpler for you if you do want > > to spread your database around by hand, > > Ok, I think tablespaces are not the important thing - at least for this > project of ours. Well, if you have tablespaces, you don't have to mess with symlinking clog/xlog or use location facility which is bit rough. You should be able to manage such a setup solely from postgresql. That is an advantage of tablespaces. > Here goes ... we are talking about a database cluster with two tables where > things are happening, one is a kind of log that is simply "appended" to and > will expect to reach a size of several million entries in the time window > that is kept, the other is a persistent backing of application data that > will mostly see read-modify-writes of single records. Two writers to the > history, one writer to the data table. The volume of data is not very high > and RAM is enough... Even if you have enough RAM, you should use pg_autovacuum so that your tables are in shape. This is especially required when your update/insert rate is high. If your history logs needs to be rotated, you can take advantage of the fact that DDL's in postgresql are fully transacted. So you can drop the table in a transaction but nobody will notice anything unless it is committed. Makes a transparent rotation. HTH Shridhar From pgsql-performance-owner@postgresql.org Sat May 29 15:31:33 2004 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2F99ED1B366 for ; Sat, 29 May 2004 15:31:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 60225-01 for ; Sat, 29 May 2004 15:31:32 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id A1C0ED1CECA for ; Sat, 29 May 2004 15:31:11 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by www.postgresql.com (Postfix) with ESMTP id 62FE3CF6A7A for ; Sat, 29 May 2004 12:19:51 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4TFI6SZ020196; Sat, 29 May 2004 11:18:07 -0400 (EDT) To: shridhar@frodo.hserus.net Cc: share-postgres@think42.com, Richard Huxton , pgsql-performance@postgresql.org Subject: Re: filesystem option tuning In-reply-to: <200405291501.45229.shridhar@frodo.hserus.net> References: <20040515125227.A29574@p15097255.pureserver.info> <40A8F0B6.6060703@archonet.com> <20040519093239.A26016@p15097255.pureserver.info> <200405291501.45229.shridhar@frodo.hserus.net> Comments: In-reply-to Shridhar Daithankar message dated "Sat, 29 May 2004 15:01:45 +0530" Date: Sat, 29 May 2004 11:18:06 -0400 Message-ID: <20195.1085843886@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/227 X-Sequence-Number: 7058 Shridhar Daithankar writes: > On Wednesday 19 May 2004 13:02, share-postgres@think42.com wrote: > - If you can put WAL on separate disk(s), all the better. >> >> Does that mean only the xlog, or also the clog? > You can put clog and xlog on same drive. You can, but I think you shouldn't. The entire argument for giving xlog its own drive revolves around the fact that xlog is written sequentially, and so if it has its own spindle then you have near-zero seek requirements. As soon as you give that drive any other work to do, you start losing the low-seek property. Now as Shridhar says, clog is not a very high-I/O-volume thing, so in one sense it doesn't much matter which drive you put it on. But it seems to me that clog acts much more like ordinary table files than it acts like xlog. regards, tom lane